58 lines
3.6 KiB
Text
58 lines
3.6 KiB
Text
## Nano syntax highlighting file for PowerShell
|
|
## Written by Rashil Gandhi (https://github.com/rashil2000)
|
|
## Enhanced by davidhcefx (https://github.com/davidhcefx)
|
|
|
|
syntax "PowerShell" "\.[pP][sS][1]$" "\.[pP][sS][mM][1]$"
|
|
comment "# "
|
|
|
|
## Commands
|
|
# https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands
|
|
icolor brightblue "\<(Add|Clear|Close|Copy|Enter|Exit|Find|Format|Get|Hide|Join|Lock|Move|New|Open|Optimize|Pop|Push|Redo|Remove|Rename|Reset|Resize|Search|Select|Set|Show|Skip|Split|Step|Switch|Undo|Unlock|Watch|Backup|Checkpoint|Compare|Compress|Convert|ConvertFrom|ConvertTo|Dismount|Edit|Expand|Export|Group|Import|Initialize|Limit|Merge|Out|Publish|Restore|Save|Sync|Unpublish|Update|Approve|Assert|Complete|Confirm|Deny|Disable|Enable|Install|Invoke|Register|Request|Restart|Resume|Start|Stop|Submit|Suspend|Uninstall|Unregister|Wait|Debug|Measure|Ping|Repair|Resolve|Test|Trace|Connect|Disconnect|Read|Receive|Send|Write|Block|Grant|Protect|Revoke|Unblock|Unprotect|Use|ForEach|Sort|Tee|Where)+(-)[[:alnum:]_]+"
|
|
# Builtin aliases
|
|
icolor brightblue "\<(ac|asnp|cat|cd|CFS|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|curl|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|0|epal|epcsv|epsn|erase|etsn|exsn|fc|fhx|fl|ft|fw|gal|gbp|gc|gcb|gci|gcm|gcs|gdr|gerr|ghy|gi|gin|gjb|gl|gm|gmo|gp|gps|gpv|group|gsn|gsnp|gsv|gtz|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|scb|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|stz|sujb|sv|swmi|tee|trcm|type|wget|where|wjb|write)\>"
|
|
|
|
## Operators
|
|
icolor green "-\<(and|as|band|bnot|bor|bxor|casesensitive|ccontains|ceq|cge|cgt|cle|clike|clt|cmatch|cne|cnotcontains|cnotlike|cnotmatch|contains|creplace|csplit|eq|exact|f|file|ge|gt|icontains|ieq|ige|igt|ile|ilike|ilt|imatch|in|ine|inotcontains|inotlike|inotmatch|ireplace|is|isnot|isplit|join|le|like|lt|match|ne|not|notcontains|notin|notlike|notmatch|or|regex|replace|shl|shr|split|wildcard|xor)\>"
|
|
|
|
## Variables
|
|
icolor brightred "\$[[:alnum:]_]+"
|
|
|
|
## Keywords
|
|
icolor brightcyan "\<(if|else|foreach|return|do|while|until|elseif|begin|for|trap|data|dynamicparam|end|break|throw|param|continue|finally|in|switch|exit|filter|try|process|catch|hidden|static|parameter)\>"
|
|
icolor brightcyan "\<(class|enum|function|using|assembly|command|module|namespace|type)\>"
|
|
|
|
## Types
|
|
icolor green "\<(string|char|byte|int|long|bool|decimal|single|double|DateTime|xml|array|hashtable|void)\>"
|
|
|
|
# TODO: This logic seems a bit off... look into this
|
|
## Comments
|
|
color cyan start="<#" end="#>"
|
|
color cyan "(^|[[:space:]])#[^>].*$"
|
|
|
|
## Quoted text
|
|
color brightyellow "\"[^\"]*\""
|
|
color brightyellow "'[^']*'"
|
|
## Here strings
|
|
icolor brightmagenta start="@\"" end="\"@"
|
|
icolor brightmagenta start="@'" end="'@"
|
|
|
|
## Trailing whitespace
|
|
color ,red "[[:space:]]+$"
|
|
|
|
# rainbow indent
|
|
color ,brightblack "^[[:space:]]{32}"
|
|
color ,black "^[[:space:]]{30}"
|
|
color ,brightblack "^[[:space:]]{28}"
|
|
color ,black "^[[:space:]]{26}"
|
|
color ,brightblack "^[[:space:]]{24}"
|
|
color ,black "^[[:space:]]{22}"
|
|
color ,brightblack "^[[:space:]]{20}"
|
|
color ,black "^[[:space:]]{18}"
|
|
color ,brightblack "^[[:space:]]{16}"
|
|
color ,black "^[[:space:]]{14}"
|
|
color ,brightblack "^[[:space:]]{12}"
|
|
color ,black "^[[:space:]]{10}"
|
|
color ,brightblack "^[[:space:]]{8}"
|
|
color ,black "^[[:space:]]{6}"
|
|
color ,brightblack "^[[:space:]]{4}"
|
|
color ,black "^[[:space:]]{2}"
|