forked from scopatz/nanorc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scopatz#331 from davidhcefx/master
A Better Syntax Highlighting for Batch-file Shell Script
- Loading branch information
Showing
1 changed file
with
24 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,34 @@ | ||
## Nano syntax highlighting file for Batch | ||
## Written by Dante Falzone https://github.com/DanteFalzone0 | ||
## Here is an example for Batch file shell script. | ||
## Author: davidhcefx (https://github.com/davidhcefx), based on Mitch Bumgarner's version. | ||
## License: MIT License | ||
|
||
syntax "Batch" "\.[bB][aA][tT]$" "\.[cC][mM][dD]$" | ||
comment "REM" | ||
syntax "batch" "\.(bat|cmd)$" | ||
header "^@[eE](cho|CHO) (on|off|ON|OFF)" | ||
comment "::" | ||
|
||
## Commands for basic I/O | ||
icolor green "\<(cls|echo|pause|choice|more|type)\>" | ||
# Native commands, symbols, and comparisons. | ||
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 | ||
icolor green "\<(assoc|cd|copy|del|move|path|rd|ren|vol|attrib|chkdsk|comp|convert)\>" | ||
icolor green "\<(expand|format|label|subst|xcopy|robocopy|fc|diskpart|md|mkdir)\>" | ||
# Options. | ||
color brightmagenta "[[:blank:]]/[A-Za-z]+\>" | ||
|
||
## Other commands | ||
icolor cyan "\<(ver|dir|date|exit|prompt|start|time|cmd|driverquery|find|help|ipconfig)\>" | ||
icolor cyan "\<(net|ping|shutdown|sort|systeminfo|taskkill|tasklist|tree|title|set)\>" | ||
# Common commands. (with Sublime and Github highlighting as a reference) | ||
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)\>" | ||
|
||
## Operators | ||
icolor yellow "[.:;,+*-/|=!<>&%@\"]" | ||
# Variable names. (spaces not allowed) | ||
color brightred "%([[:alpha:]`~@#$*(){}:',.?+=_-]|\[|\])([[:alnum:]`~@#$*(){}:',.?+=_-]|\[|\])*%" | ||
color brightred "!([[:alnum:]`~@#$%*(){}:',.?+=_-]|\[|\])([[:alnum:]`~@#$%*(){}:',.?+=_-]|\[|\])*!" | ||
|
||
## Executable files | ||
icolor brightred "[[:graph:]]+\.exe[[:space:]]" | ||
icolor brightred "[[:graph:]]+\.exe$" | ||
# Parameter names for arguments and loop. | ||
color brightred "%(~[[:alpha:]$]*)?[0-9*]\>" "%%(~[[:alpha:]$]*)?[[:alpha:]]\>" | ||
|
||
## Switches and labels | ||
icolor brightmagenta "/[[:graph:]]+$" | ||
icolor brightmagenta "/[[:graph:]]+[[:space:]]" | ||
# Comments. | ||
icolor cyan "^[[:space:]]*(\<rem\>|::).*" | ||
|
||
## Numerals | ||
icolor brightyellow "[[:digit:]]" | ||
# Strings. | ||
icolor brightyellow ""(\^.|[^"])*"" | ||
|
||
## Block delimeters | ||
icolor magenta "[(){}]" | ||
|
||
## Comments | ||
icolor brightblue "REM.*" | ||
|
||
## Trailing whitespace | ||
# Trailling whitespace | ||
color ,green "[[:space:]]+$" |