/usr/share/vim/syntax/zsh.vim is in zsh-lovers 0.8.3-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | " Vim syntax file
" Language: Zsh shell script
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/syntax/pcp/zsh/
" Latest Revision: 2004-12-12
" arch-tag: 2e2c7097-99cb-4b87-a771-3a819b69995e
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" Set iskeyword since we need `-' (and potentially others) in keywords.
" For version 5.x: Set it globally
" For version 6.x: Set it locally
if version >= 600
command -nargs=1 SetIsk setlocal iskeyword=<args>
else
command -nargs=1 SetIsk set iskeyword=<args>
endif
SetIsk @,48-57,_,-
delcommand SetIsk
" Todo
syn keyword zshTodo contained TODO FIXME XXX NOTE
" Comments
syn region zshComment matchgroup=zshComment start='\%(^\|\s\)#' end='$' contains=zshTodo
" PreProc
syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$'
" Strings
syn match zshQuoted '\\.'
syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+ contains=zshQuoted,@zshDerefs,@zshSubst
syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+
" XXX: This should probably be more precise, but Zsh seems a bit confused about it itself
syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+ end=+'+ contains=zshQuoted
syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)'
" Precommand Modifiers
syn keyword zshPrecommand noglob nocorrect exec command builtin - time
" Delimiters
syn keyword zshDelimiter do done
" Conditionals
syn keyword zshConditional if then elif else fi case in esac select
" Loops
syn keyword zshRepeat for while until repeat foreach
" Exceptions
syn keyword zshException always
" Keywords
syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite
" Functions
syn match zshKSHFunction contained '\k\+'
syn match zshFunction '^\s*\k\+\ze\s*()'
" Operators
syn match zshOperator '||\|&&\|;\|&!\='
" Here Documents
if version < 600
" Do nothing for now TODO: do something
else
syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' end='^\z1$' contains=@zshSubst
syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' end='^\s*\z1$' contains=@zshSubst
syn region zshHereDoc matchgroup=zshRedir start='<<\s*\(["']\)\z(\S*\)\1' end='^\z1$'
syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\(["']\)\z(\S*\)\1' end='^\s*\z1$'
endif
" Redirections
syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)'
syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\='
syn match zshRedir '|&\='
" Variable Assignments
syn match zshVariable '\<\h\w*\ze+\=='
" XXX: how safe is this?
syn region zshVariable oneline matchgroup=zshVariable start='\$\@<!\<\h\w*\[' end='\]\ze+\==' contains=@zshSubst
" Variable Dereferencing
syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref
if !exists("g:zsh_syntax_variables")
let s:zsh_syntax_variables = 'all'
else
let s:zsh_syntax_variables = g:zsh_syntax_variables
endif
syn match zshShortDeref '\$[!#$*@?_-]\w\@!'
syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>'
syn match zshLongDeref '\$\%(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)'
syn match zshLongDeref '\$\%(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)'
syn match zshLongDeref '\$\%(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)'
syn match zshDeref '\$[=^~]*[#+]*\h\w*\>'
" Commands
syn match zshCommands '\%(^\|\s\)[.:]\ze\s'
syn keyword zshCommands alias autoload bg bindkey break bye cap cd chdir
syn keyword zshCommands clone comparguments compcall compctl compdescribe
syn keyword zshCommands compfiles compgroups compquote comptags comptry
syn keyword zshCommands compvalues continue declare dirs disable disown
syn keyword zshCommands echo echotc echoti emulate enable eval exec exit
syn keyword zshCommands export false fc fg functions getcap getln
syn keyword zshCommands getopts hash history jobs kill let limit
syn keyword zshCommands log logout popd print printf pushd pushln
syn keyword zshCommands pwd r read readonly rehash return sched set
syn keyword zshCommands setcap setopt shift source stat suspend test times
syn keyword zshCommands trap true ttyctl type ulimit umask unalias
syn keyword zshCommands unfunction unhash unlimit unset unsetopt vared
syn keyword zshCommands wait whence where which zcompile zformat zftp zle
syn keyword zshCommands zmodload zparseopts zprof zpty zregexparse zsocket
syn keyword zshCommands zstyle ztcp
" Types
syn keyword zshTypes float integer local typeset
" Switches
" XXX: this may be too much
syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+'
" Numbers
syn match zshNumber '[-+]\=0x\x\+\>'
syn match zshNumber '[-+]\=0\o\+\>'
syn match zshNumber '[-+]\=\d\+#[-+]\=\w\+\>'
syn match zshNumber '[-+]\=\d\+\.\d\+\>'
" Substitution
syn cluster zshSubst contains=zshSubst,zshOldSubst
syn region zshSubst matchgroup=zshSubstDelim transparent start='\$(' skip='\\)' end=')' contains=TOP
syn region zshSubst matchgroup=zshSubstDelim transparent start='\$((' skip='\\)' end='))' contains=TOP
syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}' end='}' contains=@zshSubst
syn region zshOldSubst matchgroup=zshSubstDelim start=+`+ skip=+\\`+ end=+`+ contains=TOP,zshOldSubst
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_zsh_syn_inits")
if version < 508
let did_zsh_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink zshTodo Todo
HiLink zshComment Comment
HiLink zshPreProc PreProc
HiLink zshQuoted SpecialChar
HiLink zshString String
HiLink zshStringDelimiter zshString
HiLink zshPOSIXString zshString
HiLink zshJobSpec Special
HiLink zshPrecommand Special
HiLink zshDelimiter Keyword
HiLink zshConditional Conditional
HiLink zshException Exception
HiLink zshRepeat Repeat
HiLink zshKeyword Keyword
HiLink zshFunction Function
HiLink zshKSHFunction zshFunction
HiLink zshHereDoc String
HiLink zshOperator Operator
HiLink zshRedir Operator
HiLink zshVariable Identifier
HiLink zshDereferencing PreProc
if s:zsh_syntax_variables =~ 'short\|all'
HiLink zshShortDeref zshDereferencing
else
HiLink zshShortDeref None
endif
if s:zsh_syntax_variables =~ 'long\|all'
HiLink zshLongDeref zshDereferencing
else
HiLink zshLongDeref None
endif
if s:zsh_syntax_variables =~ 'all'
HiLink zshDeref zshDereferencing
else
HiLink zshDerefDeref None
endif
HiLink zshCommands Keyword
HiLink zshTypes Type
HiLink zshSwitches Special
HiLink zshNumber Number
HiLink zshSubst PreProc
HiLink zshOldSubst zshSubst
HiLink zshSubstDelim zshSubst
delcommand HiLink
endif
let b:current_syntax = "zsh"
" vim: set sts=2 sw=2:
|