| 1 |
filetype: zsh |
| 2 |
|
| 3 |
detect: |
| 4 |
filename: "(\\.zsh$|\\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$)" |
| 5 |
header: "^#!.*/(env +)?zsh( |$)" |
| 6 |
|
| 7 |
rules: |
| 8 |
## Numbers |
| 9 |
- constant.number: "\\b[0-9]+\\b" |
| 10 |
|
| 11 |
## Conditionals and control flow |
| 12 |
- statement: "\\b(always|break|bye|case|continue|disown|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b" |
| 13 |
|
| 14 |
- statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)" |
| 15 |
## Conditional flags |
| 16 |
- special: "-[Ldefgruwx]\\b" |
| 17 |
- special: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b" |
| 18 |
|
| 19 |
## Bash-inherited |
| 20 |
- statement: "\\b((un)?alias|bindkey|builtin|cd|declare|eval|exec|export|jobs|let|popd|pushd|set|source|typeset|umask|unset)\\b" |
| 21 |
## ZSH-specific |
| 22 |
- type: "\\b(add-zsh-hook|autoload|chdir|compinit|dirs|(dis|en)able|echotc|emulate|print|prompt(init)?|(un)?setopt|zle|zmodload|zstyle|whence)\\b" |
| 23 |
|
| 24 |
## Common linux commands |
| 25 |
- statement: "\\b((g|ig)?awk|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|tar)\\b" |
| 26 |
|
| 27 |
## Coreutils commands |
| 28 |
- statement: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|echo|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b" |
| 29 |
|
| 30 |
## Function definition |
| 31 |
- identifier: "^\\s+(function\\s+)[0-9A-Z_]+\\s+\\(\\)" # (i) |
| 32 |
|
| 33 |
## Variables |
| 34 |
- identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" #(i) |
| 35 |
|
| 36 |
- constant.string: |
| 37 |
start: "\"" |
| 38 |
end: "\"" |
| 39 |
skip: "\\\\." |
| 40 |
rules: |
| 41 |
- constant.specialChar: "\\\\." |
| 42 |
|
| 43 |
- constant.string: |
| 44 |
start: "'" |
| 45 |
end: "'" |
| 46 |
rules: [] |
| 47 |
|
| 48 |
- comment: |
| 49 |
start: "(^|\\s)#" |
| 50 |
end: "$" |
| 51 |
rules: [] |
| 52 |
|