mirror of
https://github.com/scopatz/nanorc
synced 2024-10-31 23:00:00 +01:00
Merge pull request #331 from davidhcefx/master
A Better Syntax Highlighting for Batch-file Shell Script
This commit is contained in:
commit
87befaf064
53
batch.nanorc
53
batch.nanorc
@ -1,39 +1,34 @@
|
|||||||
## Nano syntax highlighting file for Batch
|
## Here is an example for Batch file shell script.
|
||||||
## Written by Dante Falzone https://github.com/DanteFalzone0
|
## Author: davidhcefx (https://github.com/davidhcefx), based on Mitch Bumgarner's version.
|
||||||
|
## License: MIT License
|
||||||
|
|
||||||
syntax "Batch" "\.[bB][aA][tT]$" "\.[cC][mM][dD]$"
|
syntax "batch" "\.(bat|cmd)$"
|
||||||
comment "REM"
|
header "^@[eE](cho|CHO) (on|off|ON|OFF)"
|
||||||
|
comment "::"
|
||||||
|
|
||||||
## Commands for basic I/O
|
# Native commands, symbols, and comparisons.
|
||||||
icolor green "\<(cls|echo|pause|choice|more|type)\>"
|
icolor green "\<(ASSOC|CALL|CD|CLS|CMDEXTVERSION|COLOR|COPY|DATE|DEL|DIR|ECHO|ENDLOCAL|ERASE|ERRORLEVEL|EXIT|FOR|FTYPE|GOTO|IF|MD|MKLINK|MOVE|PATH|PAUSE|POPD|PROMPT|PUSHD|RD|REM|REN|SET|SETLOCAL|SHIFT|START|TIME|TITLE|TYPE|VER|VERIFY|VOL)\>"
|
||||||
|
icolor green "\<(EQU|NEQ|LSS|LEQ|GTR|GEQ|DEFINED|EXIST|NOT)\>"
|
||||||
|
color green "[:|<>=&@\\^]"
|
||||||
|
|
||||||
## Commands for file operations
|
# Options.
|
||||||
icolor green "\<(assoc|cd|copy|del|move|path|rd|ren|vol|attrib|chkdsk|comp|convert)\>"
|
color brightmagenta "[[:blank:]]/[A-Za-z]+\>"
|
||||||
icolor green "\<(expand|format|label|subst|xcopy|robocopy|fc|diskpart|md|mkdir)\>"
|
|
||||||
|
|
||||||
## Other commands
|
# Common commands. (with Sublime and Github highlighting as a reference)
|
||||||
icolor cyan "\<(ver|dir|date|exit|prompt|start|time|cmd|driverquery|find|help|ipconfig)\>"
|
icolor brightblue "\<(APPEND|ARP|AT|ATTRIB|AUTOFAIL|BACKUP|BCDBOOT|BCDEDIT|BITSADMIN|BREAK|CACLS|CERTREQ|CERTUTIL|CHANGE|CHCP|CHDIR|CHKDSK|CHKNTFS|CHOICE|CIPHER|CleanMgr|CLIP|CMD|CMDKEY|COMP|COMPACT|CONVERT|CSVDE|DEFRAG|DELTREE|DevCon|DIRQUOTA|DISKCOMP|DISKCOPY|DISKPART|DISKSHADOW|DNSCMD|DOSKEY|DriverQuery|DSACLs|DSAdd|DSGet|DSQuery|DSMod|DSMove|DSRM|Dsmgmt|EVENTCREATE|EXPAND|EXPLORER|EXTRACT|FC|FIND|FINDSTR|FORFILES|FORMAT|FREEDISK|FSUTIL|FTP|GETMAC|GPRESULT|GPUPDATE|GRAFTABL|HELP|HOSTNAME|iCACLS|IEXPRESS|IPCONFIG|INUSE|KEYB|LABEL|LODCTR|LOGMAN|LOGOFF|MAKECAB|MKDIR|MODE|MORE|MOUNTVOL|MSG|MSIEXEC|MSINFO32|MSTSC|NET|NETDOM|NETSH|NBTSTAT|NETSTAT|NLTEST|NSLOOKUP|NTBACKUP|NTDSUtil|OPENFILES|PATHPING|PING|POWERCFG|PRINT|PRNCNFG|PRNMNGR|Query|RASDIAL|RASPHONE|RECOVER|REG|REGEDIT|REGSVR32|REGINI|RENAME|REPLACE|Reset|RESTORE|RMDIR|ROBOCOPY|ROUTE|RUNAS|RUNDLL32|SC|SCHTASKS|SetSPN|SETX|SFC|SHUTDOWN|SORT|SSH|SUBINACL|SUBST|SYSTEMINFO|TAKEOWN|TASKLIST|TASKKILL|TELNET|TIMEOUT|TRACERT|TREE|TSDISCON|TSKILL|TypePerf|TZUTIL|VSSADMIN|W32TM|WAITFOR|WBADMIN|WECUTIL|WEVTUTIL|WHERE|WHOAMI|WINRM|WINRS|WMIC|XCACLS|XCOPY)\>"
|
||||||
icolor cyan "\<(net|ping|shutdown|sort|systeminfo|taskkill|tasklist|tree|title|set)\>"
|
|
||||||
|
|
||||||
## Operators
|
# Variable names. (spaces not allowed)
|
||||||
icolor yellow "[.:;,+*-/|=!<>&%@\"]"
|
color brightred "%([[:alpha:]`~@#$*(){}:',.?+=_-]|\[|\])([[:alnum:]`~@#$*(){}:',.?+=_-]|\[|\])*%"
|
||||||
|
color brightred "!([[:alnum:]`~@#$%*(){}:',.?+=_-]|\[|\])([[:alnum:]`~@#$%*(){}:',.?+=_-]|\[|\])*!"
|
||||||
|
|
||||||
## Executable files
|
# Parameter names for arguments and loop.
|
||||||
icolor brightred "[[:graph:]]+\.exe[[:space:]]"
|
color brightred "%(~[[:alpha:]$]*)?[0-9*]\>" "%%(~[[:alpha:]$]*)?[[:alpha:]]\>"
|
||||||
icolor brightred "[[:graph:]]+\.exe$"
|
|
||||||
|
|
||||||
## Switches and labels
|
# Comments.
|
||||||
icolor brightmagenta "/[[:graph:]]+$"
|
icolor cyan "^[[:space:]]*(\<rem\>|::).*"
|
||||||
icolor brightmagenta "/[[:graph:]]+[[:space:]]"
|
|
||||||
|
|
||||||
## Numerals
|
# Strings.
|
||||||
icolor brightyellow "[[:digit:]]"
|
icolor brightyellow ""(\^.|[^"])*""
|
||||||
|
|
||||||
## Block delimeters
|
# Trailling whitespace
|
||||||
icolor magenta "[(){}]"
|
|
||||||
|
|
||||||
## Comments
|
|
||||||
icolor brightblue "REM.*"
|
|
||||||
|
|
||||||
## Trailing whitespace
|
|
||||||
color ,green "[[:space:]]+$"
|
color ,green "[[:space:]]+$"
|
||||||
|
Loading…
Reference in New Issue
Block a user