Syntax Highlighting bei externen Editoren

Aus FHEMWiki
Zur Navigation springen Zur Suche springen
Info green.pngFhem enthält seit April 2014 beim "Internen Editor" und den "Objektdetails" eine eigene Die Nutzung eines externen Editors ist grundsätzlich nicht notwendig und ist als "Expertenmodus" anzusehen.


Syntax Highlighting für Notepad++

es gibt eine Syntax Highlighting Erweiterung für Notepad++

Forums Beitrag:

Syntax Highlighting für Atom

Es gibt auch eine Syntax Highlighting Erweiterung für Atom - A hackable text editor for the 21st Century Hier geht der Dank an Fank


Syntax Highlighting für nano

Auf der Linux-Shell bietet der Editor nano von Haus aus Syntax-Highlighting für verschiedenste Sprachen. Für die Konfigurations-Dateien des fhem kann leicht ein eigenes Syntax-Highlighting erstellt werden. Dazu sind folgende Schritte notwendig:

1. Eine neue nano-Konfiguration erstellen (Bsp. s.u.), zB.

 nano ~/fhem.nanorc

2. Die Konfiguration aktivieren, zB.

 echo "~/fhem.nanorc" >> ~/.profile

Änderungen an der fhem.nanorc werden sofort wirksam. Sie kann also sehr einfach den eigenen Bedürfnissen angepasst werden.


Beispiel-Konfiguration für die fhem.nanorc

Die folgende Beispiel-Konfiguration ist von /usr/share/nano/perl.nanorc abgeleitet. Sie bedient die meisten festen Sprachelemente des fhem (vgl. command.ref).

Device-spezifische Syntax ist beispielhaft für FHT eingefügt und muss ggf. für andere Devices entsprechend ergänzt werden.

Hinweis: Alle Zeilen fangen mit dem Begriff "color" an - in der Darstellung unten werden einige Zeilen umgebrochen, was in der Konfigurationsdatei nicht sein darf.

## Here is an example for fhem.
##

# All fhem config file have the extension .cfg
syntax "fhem" "\.cfg$"

# fhem commands
color red "\<(apptime|attr|backup|CULflash|cmdalias|configdb|copy|createlog|define|delete|deleteattr|deletereading|displayattr|fheminfo|get|getstate|help|IF|include|inform|JsonList|JsonList2|list|modify|notice|quit|rename|restore|re
readcfg|save|set|setdefaultattr|setreading|setstate|trigger|usb|version|xmllist|cmd)\>"
color blue "\<(shutdown|restart|sleep|update|reload|check)\>"

# Devices
color blue "\<(global|ALL3076|ALL4000T|ALL4027|GPIO4|Alarm|BS|CALVIEW|CM11|CO20|CUL|CUL_EM|CUL_FHTTK|CUL_HM|CUL_HOERMANN|CUL_IR|CUL_MAX|CUL_RFR|CUL_TCM97001|CUL_TX|CUL_WS|ComfoAir|EC3000|ECMD|ECMDDevice|EGPM|EGPM2LAN|EIB|EM|EMEM|EMG
Z|EMT7110|EMWZ|ENECSYSGW|ENECSYSINV|ENIGMA2|ESA2000|EnOcean|FBAHA|FBDECT|FHT|FHT8V|FHZ|FRAMEBUFFER|FRITZBOX|FRM|FRM_AD|FRM_I2C|FRM_IN|FRM_LCD|FRM_OUT|FRM_PWM|FRM_RGB|FRM_ROTENC|FRM_SERVO|FRM_STEPPER|FReplacer|FS20|GDS|GEOFANCY|GUEST
|HEATRONIC|HMLAN|HMS|HMinfo|HTTPMOD|HUEBridge|HUEDevice|HXB|HXBDevice|I2C_BMP180|I2C_DS1307|I2C_EEPROM|I2C_LCD|I2C_MCP23008|I2C_MCP23017|I2C_MCP342x|I2C_PCA9532|I2C_PCF8574|I2C_SHT21|I2C_TSL2561|IPCAM|IPWE|IT|Itach_IR|Itach_IRDevice
|Itach_Relay|JSONMETER|Jabber|JeeLink|KM271|KOPP_FC|KOSTALPIKO|KS300|LGTV|LINDY_HDMI_SWITCH|LIRC|LUXTRONIK2|LaCrosse|Level|M232|M232Counter|M232Voltage|MAX|MAXLAN|MPD|MQTT|MQTT_BRIDGE|MQTT_DEVICE|MSG|MSGFile|MSGMail|MYSENSORS|MYSENS
ORS_DEVICE|MilightBridge|MilightDevice|NUT|NetIO230B|Netzer|NetzerI2C|ONKYO_AVR|OPENWEATHER|OREGON|OWAD|OWCOUNT|OWDevice|OWFS|OWID|OWLCD|OWMULTI|OWSWITCH|OWServer|OWTEMP|OWTHERM|OWX|OWX_ASYNC|PCA301|PHTV|PID20|PIFACE|PIONEERAVR|PION
EERAVRZONE|POKEYS|PROPLANTA|PushNotifier|Pushbullet|Pushover|RESIDENTS|RFXCOM|RFXMETER|RFXX10REC|ROOMMATE|RPII2C|RPI_GPIO|Revolt|SCIVT|SHC|SHCdev|SISPM|SIS_PMS|SMARTMON|SML|SOMFY|SONOS|SONOSPLAYER|STACKABLE_CC|STV|SWAP|SWAP_00000022
00000003|SWAP_0000002200000008|SYSMON|TCM|TEK603|THZ|TRX|TRX_ELSE|TRX_LIGHT|TRX_SECURITY|TRX_WEATHER|TUL|TellStick|Text2Speech|UNIRoll|USBWX|USF1000|VCONTROL|VIERA|VantagePro2|WEBCOUNT|WEBIO|WEBIO_12DIGITAL|WMBUS|WS2000|WS300|WS3600
|WWO|Weather|X10|XBMC|XmlList|YAMAHA_AVR|YAMAHA_BD|YAMAHA_NP|ZWDongle|ZWave|cloneDummy|harmony|km200|netatmo|panStamp|pilight|withings|xxLG7000)\>"
color blue "\<(flashCommand|hexFile)\>"

# Header modules
color magenta "\<(at|autocreate|average|Calendar|configDB|CustomReadings|DOIF|Dashboard|DbLog|dewpoint|dummy|eventTypes|FHEM2FHEM|FHEMWEB|FB_CALLMONITOR|FileLog|FLOORPLAN|HCS|HTTPSRV|Heating_Control|holiday|HourCounter|InfoPanel|Lig
htScene|logProxy|mailcheck|notify|PRESENCE|PachLog|RSS|RandomTimer|rain|readingsGroup|readingsHistory|readingsProxy|remotecontrol|SUNRISE_EL|SYSSTAT|sequence|speedtest|statistics|structure|telnet|Twilight|THRESHOLD|Utils|WeekdayTime
r|watchdog|weblink|weco|WOL)\>"
color blue "\<(SVG)\>"

# Other key words
color magenta "\<(TYPE|perl|commands|room|valueIcon|valueStyle|nameStyle|path|label|plotfunction|HISTORY|CURRENT|group|regexp1WontReactivate|alias|notime|nostate|mapping|IODev|htmlattr|stateFormat|userReadings|icon|fixedrange|commen
t|userattr)\>"
color blue "\<(htmlCode|absent|present|lan-ping|iframe|sysstat|link|image|99_myUtils.pm)\>"

# Interface key words
color magenta "\<(defaultRoom|hiddenroom|sortRooms|menuEntries|stylesheetPrefix)\>"
color blue "\<(smallscreen|touchpad)\>"

# Logging key words
color magenta "\<(FileLog|DBLog|filelog|DbLogExclude)\>"
color blue "\<(fakelog)\>"

# Event key words
color magenta "\<(event-on-change-reading|event-min-interval|event-on-update-reading|event-aggregator)\>"
color blue "\<(state)\>"

# Floorplan key words
color magenta "\<(|fp_arrange|fp_backgroundimg)\>"
color blue "\<()\>"

# Dashboard key words
color magenta "\<(dashboard_colcount|dashboard_rowcentercolwidth|dashboard_tab1groups|dashboard_tab1name|dashboard_tab1sorting|dashboard_tabcount)\>"
color blue "\<()\>"

# FHT specific key words
color green "\<(actuator|desired-temp|measured-temp|day-temp|night-temp|report1|report2|refreshvalues|mode|holiday1|holiday2|holiday_short|manu-temp|year|month|day|hour|minute|time|date|lowtemp-offset|windowopen-temp|mon-from1|mon-t
o1|mon-from2|mon-to2|tue-from1|tue-to1|tue-from2|tue-to2|wed-from1|wed-to1|wed-from2|wed-to2|thu-from1|thu-to1|thu-from2|thu-to2|fri-from1|fri-to1|fri-from2|fri-to2|sat-from1|sat-to1|sat-from2|sat-to2|sun-from1|sun-to1|sun-from2|sun
-to2|window|battery)\>"

# Strings
color yellow ""[0-9a-zA-Z_-]*""

# Commends
color brightwhite "#.*"

# Descriptions
color brightgreen "##.*"

# Individual key words
color cyan "(readingsRegex_|readingsName_)[0-9a-zA-Z_-]*"