zsh.vim 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. " Vim syntax file
  2. " Language: Zsh shell script
  3. " Maintainer: Christian Brabandt <cb@256bit.org>
  4. " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
  5. " Latest Revision: 2022-07-26
  6. " License: Vim (see :h license)
  7. " Repository: https://github.com/chrisbra/vim-zsh
  8. if exists("b:current_syntax")
  9. finish
  10. endif
  11. let s:cpo_save = &cpo
  12. set cpo&vim
  13. function! s:ContainedGroup()
  14. " needs 7.4.2008 for execute() function
  15. let result='TOP'
  16. " vim-pandoc syntax defines the @langname cluster for embedded syntax languages
  17. " However, if no syntax is defined yet, `syn list @zsh` will return
  18. " "No syntax items defined", so make sure the result is actually a valid syn cluster
  19. for cluster in ['markdownHighlight_zsh', 'zsh']
  20. try
  21. " markdown syntax defines embedded clusters as @markdownhighlight_<lang>,
  22. " pandoc just uses @<lang>, so check both for both clusters
  23. let a=split(execute('syn list @'. cluster), "\n")
  24. if len(a) == 2 && a[0] =~# '^---' && a[1] =~? cluster
  25. return '@'. cluster
  26. endif
  27. catch /E392/
  28. " ignore
  29. endtry
  30. endfor
  31. return result
  32. endfunction
  33. let s:contained=s:ContainedGroup()
  34. syn iskeyword @,48-57,_,192-255,#,-
  35. if get(g:, 'zsh_fold_enable', 0)
  36. setlocal foldmethod=syntax
  37. endif
  38. syn match zshQuoted '\\.'
  39. syn match zshPOSIXQuoted '\\[xX][0-9a-fA-F]\{1,2}'
  40. syn match zshPOSIXQuoted '\\[0-7]\{1,3}'
  41. syn match zshPOSIXQuoted '\\u[0-9a-fA-F]\{1,4}'
  42. syn match zshPOSIXQuoted '\\U[1-9a-fA-F]\{1,8}'
  43. syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+
  44. \ contains=zshQuoted,@zshDerefs,@zshSubstQuoted fold
  45. syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ fold
  46. syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+
  47. \ skip=+\\[\\']+ end=+'+ contains=zshPOSIXQuoted,zshQuoted
  48. syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)'
  49. syn match zshNumber '[+-]\=\<\d\+\>'
  50. syn match zshNumber '[+-]\=\<0x\x\+\>'
  51. syn match zshNumber '[+-]\=\<0\o\+\>'
  52. syn match zshNumber '[+-]\=\d\+#[-+]\=\w\+\>'
  53. syn match zshNumber '[+-]\=\d\+\.\d\+\>'
  54. syn keyword zshPrecommand noglob nocorrect exec command builtin - time
  55. syn keyword zshDelimiter do done end
  56. syn keyword zshConditional if then elif else fi esac select
  57. syn keyword zshCase case nextgroup=zshCaseWord skipwhite
  58. syn match zshCaseWord /\S\+/ nextgroup=zshCaseIn skipwhite contained transparent
  59. syn keyword zshCaseIn in nextgroup=zshCasePattern skipwhite skipnl contained
  60. syn match zshCasePattern /\S[^)]*)/ contained
  61. syn keyword zshRepeat while until repeat
  62. syn keyword zshRepeat for foreach nextgroup=zshVariable skipwhite
  63. syn keyword zshException always
  64. syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite
  65. syn match zshKSHFunction contained '\w\S\+'
  66. syn match zshFunction '^\s*\k\+\ze\s*()'
  67. syn match zshOperator '||\|&&\|;\|&!\='
  68. " <<<, <, <>, and variants.
  69. syn match zshRedir '\d\=\(<<<\|<&\s*[0-9p-]\=\|<>\?\)'
  70. " >, >>, and variants.
  71. syn match zshRedir '\d\=\(>&\s*[0-9p-]\=\|&>>\?\|>>\?&\?\)[|!]\='
  72. " | and |&, but only if it's not preceeded or
  73. " followed by a | to avoid matching ||.
  74. syn match zshRedir '|\@1<!|&\=|\@!'
  75. syn region zshHereDoc matchgroup=zshRedir
  76. \ start='<\@<!<<\s*\z([^<]\S*\)'
  77. \ end='^\z1\>'
  78. \ contains=@zshSubst,@zshDerefs,zshQuoted,zshPOSIXString
  79. syn region zshHereDoc matchgroup=zshRedir
  80. \ start='<\@<!<<\s*\\\z(\S\+\)'
  81. \ end='^\z1\>'
  82. \ contains=@zshSubst,@zshDerefs,zshQuoted,zshPOSIXString
  83. syn region zshHereDoc matchgroup=zshRedir
  84. \ start='<\@<!<<-\s*\\\=\z(\S\+\)'
  85. \ end='^\s*\z1\>'
  86. \ contains=@zshSubst,@zshDerefs,zshQuoted,zshPOSIXString
  87. syn region zshHereDoc matchgroup=zshRedir
  88. \ start=+<\@<!<<\s*\(["']\)\z(\S\+\)\1+
  89. \ end='^\z1\>'
  90. syn region zshHereDoc matchgroup=zshRedir
  91. \ start=+<\@<!<<-\s*\(["']\)\z(\S\+\)\1+
  92. \ end='^\s*\z1\>'
  93. syn match zshVariable '\<\h\w*' contained
  94. syn match zshVariableDef '\<\h\w*\ze+\=='
  95. " XXX: how safe is this?
  96. syn region zshVariableDef oneline
  97. \ start='\$\@<!\<\h\w*\[' end='\]\ze+\?=\?'
  98. \ contains=@zshSubst
  99. syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref,zshDollarVar
  100. syn match zshShortDeref '\$[!#$*@?_-]\w\@!'
  101. syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>'
  102. syn match zshLongDeref '\$\%(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)'
  103. syn match zshLongDeref '\$\%(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)'
  104. syn match zshLongDeref '\$\%(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)'
  105. syn match zshDollarVar '\$\h\w*'
  106. syn match zshDeref '\$[=^~]*[#+]*\h\w*\>'
  107. syn match zshCommands '\%(^\|\s\)[.:]\ze\s'
  108. syn keyword zshCommands alias autoload bg bindkey break bye cap cd
  109. \ chdir clone comparguments compcall compctl
  110. \ compdescribe compfiles compgroups compquote
  111. \ comptags comptry compvalues continue dirs
  112. \ disable disown echo echotc echoti emulate
  113. \ enable eval exec exit export false fc fg
  114. \ functions getcap getln getopts hash history
  115. \ jobs kill let limit log logout popd print
  116. \ printf prompt pushd pushln pwd r read
  117. \ rehash return sched set setcap shift
  118. \ source stat suspend test times trap true
  119. \ ttyctl type ulimit umask unalias unfunction
  120. \ unhash unlimit unset vared wait
  121. \ whence where which zcompile zformat zftp zle
  122. \ zmodload zparseopts zprof zpty zrecompile
  123. \ zregexparse zsocket zstyle ztcp
  124. " Options, generated by from the zsh source with the make-options.zsh script.
  125. syn case ignore
  126. syn match zshOptStart
  127. \ /\v^\s*%(%(un)?setopt|set\s+[-+]o)/
  128. \ nextgroup=zshOption skipwhite
  129. syn keyword zshOption nextgroup=zshOption,zshComment skipwhite contained
  130. \ auto_cd no_auto_cd autocd noautocd auto_pushd no_auto_pushd autopushd noautopushd cdable_vars
  131. \ no_cdable_vars cdablevars nocdablevars cd_silent no_cd_silent cdsilent nocdsilent chase_dots
  132. \ no_chase_dots chasedots nochasedots chase_links no_chase_links chaselinks nochaselinks posix_cd
  133. \ posixcd no_posix_cd noposixcd pushd_ignore_dups no_pushd_ignore_dups pushdignoredups
  134. \ nopushdignoredups pushd_minus no_pushd_minus pushdminus nopushdminus pushd_silent no_pushd_silent
  135. \ pushdsilent nopushdsilent pushd_to_home no_pushd_to_home pushdtohome nopushdtohome
  136. \ always_last_prompt no_always_last_prompt alwayslastprompt noalwayslastprompt always_to_end
  137. \ no_always_to_end alwaystoend noalwaystoend auto_list no_auto_list autolist noautolist auto_menu
  138. \ no_auto_menu automenu noautomenu auto_name_dirs no_auto_name_dirs autonamedirs noautonamedirs
  139. \ auto_param_keys no_auto_param_keys autoparamkeys noautoparamkeys auto_param_slash
  140. \ no_auto_param_slash autoparamslash noautoparamslash auto_remove_slash no_auto_remove_slash
  141. \ autoremoveslash noautoremoveslash bash_auto_list no_bash_auto_list bashautolist nobashautolist
  142. \ complete_aliases no_complete_aliases completealiases nocompletealiases complete_in_word
  143. \ no_complete_in_word completeinword nocompleteinword glob_complete no_glob_complete globcomplete
  144. \ noglobcomplete hash_list_all no_hash_list_all hashlistall nohashlistall list_ambiguous
  145. \ no_list_ambiguous listambiguous nolistambiguous list_beep no_list_beep listbeep nolistbeep
  146. \ list_packed no_list_packed listpacked nolistpacked list_rows_first no_list_rows_first listrowsfirst
  147. \ nolistrowsfirst list_types no_list_types listtypes nolisttypes menu_complete no_menu_complete
  148. \ menucomplete nomenucomplete rec_exact no_rec_exact recexact norecexact bad_pattern no_bad_pattern
  149. \ badpattern nobadpattern bare_glob_qual no_bare_glob_qual bareglobqual nobareglobqual brace_ccl
  150. \ no_brace_ccl braceccl nobraceccl case_glob no_case_glob caseglob nocaseglob case_match
  151. \ no_case_match casematch nocasematch case_paths no_case_paths casepaths nocasepaths csh_null_glob
  152. \ no_csh_null_glob cshnullglob nocshnullglob equals no_equals noequals extended_glob no_extended_glob
  153. \ extendedglob noextendedglob force_float no_force_float forcefloat noforcefloat glob no_glob noglob
  154. \ glob_assign no_glob_assign globassign noglobassign glob_dots no_glob_dots globdots noglobdots
  155. \ glob_star_short no_glob_star_short globstarshort noglobstarshort glob_subst no_glob_subst globsubst
  156. \ noglobsubst hist_subst_pattern no_hist_subst_pattern histsubstpattern nohistsubstpattern
  157. \ ignore_braces no_ignore_braces ignorebraces noignorebraces ignore_close_braces
  158. \ no_ignore_close_braces ignoreclosebraces noignoreclosebraces ksh_glob no_ksh_glob kshglob nokshglob
  159. \ magic_equal_subst no_magic_equal_subst magicequalsubst nomagicequalsubst mark_dirs no_mark_dirs
  160. \ markdirs nomarkdirs multibyte no_multibyte nomultibyte nomatch no_nomatch nonomatch null_glob
  161. \ no_null_glob nullglob nonullglob numeric_glob_sort no_numeric_glob_sort numericglobsort
  162. \ nonumericglobsort rc_expand_param no_rc_expand_param rcexpandparam norcexpandparam rematch_pcre
  163. \ no_rematch_pcre rematchpcre norematchpcre sh_glob no_sh_glob shglob noshglob unset no_unset nounset
  164. \ warn_create_global no_warn_create_global warncreateglobal nowarncreateglobal warn_nested_var
  165. \ no_warn_nested_var warnnestedvar no_warnnestedvar append_history no_append_history appendhistory
  166. \ noappendhistory bang_hist no_bang_hist banghist nobanghist extended_history no_extended_history
  167. \ extendedhistory noextendedhistory hist_allow_clobber no_hist_allow_clobber histallowclobber
  168. \ nohistallowclobber hist_beep no_hist_beep histbeep nohistbeep hist_expire_dups_first
  169. \ no_hist_expire_dups_first histexpiredupsfirst nohistexpiredupsfirst hist_fcntl_lock
  170. \ no_hist_fcntl_lock histfcntllock nohistfcntllock hist_find_no_dups no_hist_find_no_dups
  171. \ histfindnodups nohistfindnodups hist_ignore_all_dups no_hist_ignore_all_dups histignorealldups
  172. \ nohistignorealldups hist_ignore_dups no_hist_ignore_dups histignoredups nohistignoredups
  173. \ hist_ignore_space no_hist_ignore_space histignorespace nohistignorespace hist_lex_words
  174. \ no_hist_lex_words histlexwords nohistlexwords hist_no_functions no_hist_no_functions
  175. \ histnofunctions nohistnofunctions hist_no_store no_hist_no_store histnostore nohistnostore
  176. \ hist_reduce_blanks no_hist_reduce_blanks histreduceblanks nohistreduceblanks hist_save_by_copy
  177. \ no_hist_save_by_copy histsavebycopy nohistsavebycopy hist_save_no_dups no_hist_save_no_dups
  178. \ histsavenodups nohistsavenodups hist_verify no_hist_verify histverify nohistverify
  179. \ inc_append_history no_inc_append_history incappendhistory noincappendhistory
  180. \ inc_append_history_time no_inc_append_history_time incappendhistorytime noincappendhistorytime
  181. \ share_history no_share_history sharehistory nosharehistory all_export no_all_export allexport
  182. \ noallexport global_export no_global_export globalexport noglobalexport global_rcs no_global_rcs
  183. \ globalrcs noglobalrcs rcs no_rcs norcs aliases no_aliases noaliases clobber no_clobber noclobber
  184. \ clobber_empty no_clobber_empty clobberempty noclobberempty correct no_correct nocorrect correct_all
  185. \ no_correct_all correctall nocorrectall dvorak no_dvorak nodvorak flow_control no_flow_control
  186. \ flowcontrol noflowcontrol ignore_eof no_ignore_eof ignoreeof noignoreeof interactive_comments
  187. \ no_interactive_comments interactivecomments nointeractivecomments hash_cmds no_hash_cmds hashcmds
  188. \ nohashcmds hash_dirs no_hash_dirs hashdirs nohashdirs hash_executables_only
  189. \ no_hash_executables_only hashexecutablesonly nohashexecutablesonly mail_warning no_mail_warning
  190. \ mailwarning nomailwarning path_dirs no_path_dirs pathdirs nopathdirs path_script no_path_script
  191. \ pathscript nopathscript print_eight_bit no_print_eight_bit printeightbit noprinteightbit
  192. \ print_exit_value no_print_exit_value printexitvalue noprintexitvalue rc_quotes no_rc_quotes
  193. \ rcquotes norcquotes rm_star_silent no_rm_star_silent rmstarsilent normstarsilent rm_star_wait
  194. \ no_rm_star_wait rmstarwait normstarwait short_loops no_short_loops shortloops noshortloops
  195. \ short_repeat no_short_repeat shortrepeat noshortrepeat sun_keyboard_hack no_sun_keyboard_hack
  196. \ sunkeyboardhack nosunkeyboardhack auto_continue no_auto_continue autocontinue noautocontinue
  197. \ auto_resume no_auto_resume autoresume noautoresume bg_nice no_bg_nice bgnice nobgnice check_jobs
  198. \ no_check_jobs checkjobs nocheckjobs check_running_jobs no_check_running_jobs checkrunningjobs
  199. \ nocheckrunningjobs hup no_hup nohup long_list_jobs no_long_list_jobs longlistjobs nolonglistjobs
  200. \ monitor no_monitor nomonitor notify no_notify nonotify posix_jobs posixjobs no_posix_jobs
  201. \ noposixjobs prompt_bang no_prompt_bang promptbang nopromptbang prompt_cr no_prompt_cr promptcr
  202. \ nopromptcr prompt_sp no_prompt_sp promptsp nopromptsp prompt_percent no_prompt_percent
  203. \ promptpercent nopromptpercent prompt_subst no_prompt_subst promptsubst nopromptsubst
  204. \ transient_rprompt no_transient_rprompt transientrprompt notransientrprompt alias_func_def
  205. \ no_alias_func_def aliasfuncdef noaliasfuncdef c_bases no_c_bases cbases nocbases c_precedences
  206. \ no_c_precedences cprecedences nocprecedences debug_before_cmd no_debug_before_cmd debugbeforecmd
  207. \ nodebugbeforecmd err_exit no_err_exit errexit noerrexit err_return no_err_return errreturn
  208. \ noerrreturn eval_lineno no_eval_lineno evallineno noevallineno exec no_exec noexec function_argzero
  209. \ no_function_argzero functionargzero nofunctionargzero local_loops no_local_loops localloops
  210. \ nolocalloops local_options no_local_options localoptions nolocaloptions local_patterns
  211. \ no_local_patterns localpatterns nolocalpatterns local_traps no_local_traps localtraps nolocaltraps
  212. \ multi_func_def no_multi_func_def multifuncdef nomultifuncdef multios no_multios nomultios
  213. \ octal_zeroes no_octal_zeroes octalzeroes nooctalzeroes pipe_fail no_pipe_fail pipefail nopipefail
  214. \ source_trace no_source_trace sourcetrace nosourcetrace typeset_silent no_typeset_silent
  215. \ typesetsilent notypesetsilent typeset_to_unset no_typeset_to_unset typesettounset notypesettounset
  216. \ verbose no_verbose noverbose xtrace no_xtrace noxtrace append_create no_append_create appendcreate
  217. \ noappendcreate bash_rematch no_bash_rematch bashrematch nobashrematch bsd_echo no_bsd_echo bsdecho
  218. \ nobsdecho continue_on_error no_continue_on_error continueonerror nocontinueonerror
  219. \ csh_junkie_history no_csh_junkie_history cshjunkiehistory nocshjunkiehistory csh_junkie_loops
  220. \ no_csh_junkie_loops cshjunkieloops nocshjunkieloops csh_junkie_quotes no_csh_junkie_quotes
  221. \ cshjunkiequotes nocshjunkiequotes csh_nullcmd no_csh_nullcmd cshnullcmd nocshnullcmd ksh_arrays
  222. \ no_ksh_arrays ksharrays noksharrays ksh_autoload no_ksh_autoload kshautoload nokshautoload
  223. \ ksh_option_print no_ksh_option_print kshoptionprint nokshoptionprint ksh_typeset no_ksh_typeset
  224. \ kshtypeset nokshtypeset ksh_zero_subscript no_ksh_zero_subscript kshzerosubscript
  225. \ nokshzerosubscript posix_aliases no_posix_aliases posixaliases noposixaliases posix_argzero
  226. \ no_posix_argzero posixargzero noposixargzero posix_builtins no_posix_builtins posixbuiltins
  227. \ noposixbuiltins posix_identifiers no_posix_identifiers posixidentifiers noposixidentifiers
  228. \ posix_strings no_posix_strings posixstrings noposixstrings posix_traps no_posix_traps posixtraps
  229. \ noposixtraps sh_file_expansion no_sh_file_expansion shfileexpansion noshfileexpansion sh_nullcmd
  230. \ no_sh_nullcmd shnullcmd noshnullcmd sh_option_letters no_sh_option_letters shoptionletters
  231. \ noshoptionletters sh_word_split no_sh_word_split shwordsplit noshwordsplit traps_async
  232. \ no_traps_async trapsasync notrapsasync interactive no_interactive nointeractive login no_login
  233. \ nologin privileged no_privileged noprivileged restricted no_restricted norestricted shin_stdin
  234. \ no_shin_stdin shinstdin noshinstdin single_command no_single_command singlecommand nosinglecommand
  235. \ beep no_beep nobeep combining_chars no_combining_chars combiningchars nocombiningchars emacs
  236. \ no_emacs noemacs overstrike no_overstrike nooverstrike single_line_zle no_single_line_zle
  237. \ singlelinezle nosinglelinezle vi no_vi novi zle no_zle nozle brace_expand no_brace_expand
  238. \ braceexpand nobraceexpand dot_glob no_dot_glob dotglob nodotglob hash_all no_hash_all hashall
  239. \ nohashall hist_append no_hist_append histappend nohistappend hist_expand no_hist_expand histexpand
  240. \ nohistexpand log no_log nolog mail_warn no_mail_warn mailwarn nomailwarn one_cmd no_one_cmd onecmd
  241. \ noonecmd physical no_physical nophysical prompt_vars no_prompt_vars promptvars nopromptvars stdin
  242. \ no_stdin nostdin track_all no_track_all trackall notrackall
  243. syn case match
  244. syn keyword zshTypes float integer local typeset declare private readonly
  245. " XXX: this may be too much
  246. " syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+'
  247. " TODO: $[...] is the same as $((...)), so add that as well.
  248. syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst
  249. syn cluster zshSubstQuoted contains=zshSubstQuoted,zshOldSubst,zshMathSubst
  250. exe 'syn region zshSubst matchgroup=zshSubstDelim transparent start=/\$(/ skip=/\\)/ end=/)/ contains='.s:contained. ' fold'
  251. exe 'syn region zshSubstQuoted matchgroup=zshSubstDelim transparent start=/\$(/ skip=/\\)/ end=/)/ contains='.s:contained. ' fold'
  252. syn region zshSubstQuoted matchgroup=zshSubstDelim start='\${' skip='\\}' end='}' contains=@zshSubst,zshBrackets,zshQuoted fold
  253. syn region zshParentheses transparent start='(' skip='\\)' end=')' fold
  254. syn region zshGlob start='(#' end=')'
  255. syn region zshMathSubst matchgroup=zshSubstDelim transparent
  256. \ start='\%(\$\?\)[<=>]\@<!((' skip='\\)' end='))'
  257. \ contains=zshParentheses,@zshSubst,zshNumber,
  258. \ @zshDerefs,zshString fold
  259. " The ms=s+1 prevents matching zshBrackets several times on opening brackets
  260. " (see https://github.com/chrisbra/vim-zsh/issues/21#issuecomment-576330348)
  261. syn region zshBrackets contained transparent start='{'ms=s+1 skip='\\}'
  262. \ end='}' fold
  263. exe 'syn region zshBrackets transparent start=/{/ms=s+1 skip=/\\}/ end=/}/ contains='.s:contained. ' fold'
  264. syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}'
  265. \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString fold
  266. exe 'syn region zshOldSubst matchgroup=zshSubstDelim start=/`/ skip=/\\[\\`]/ end=/`/ contains='.s:contained. ',zshOldSubst fold'
  267. syn sync minlines=50 maxlines=90
  268. syn sync match zshHereDocSync grouphere NONE '<<-\=\s*\%(\\\=\S\+\|\(["']\)\S\+\1\)'
  269. syn sync match zshHereDocEndSync groupthere NONE '^\s*EO\a\+\>'
  270. syn keyword zshTodo contained TODO FIXME XXX NOTE
  271. syn region zshComment oneline start='\%(^\|\s\+\)#' end='$'
  272. \ contains=zshTodo,@Spell fold
  273. syn region zshComment start='^\s*#' end='^\%(\s*#\)\@!'
  274. \ contains=zshTodo,@Spell fold
  275. syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$'
  276. hi def link zshTodo Todo
  277. hi def link zshComment Comment
  278. hi def link zshPreProc PreProc
  279. hi def link zshQuoted SpecialChar
  280. hi def link zshPOSIXQuoted SpecialChar
  281. hi def link zshString String
  282. hi def link zshStringDelimiter zshString
  283. hi def link zshPOSIXString zshString
  284. hi def link zshJobSpec Special
  285. hi def link zshPrecommand Special
  286. hi def link zshDelimiter Keyword
  287. hi def link zshConditional Conditional
  288. hi def link zshCase zshConditional
  289. hi def link zshCaseIn zshCase
  290. hi def link zshException Exception
  291. hi def link zshRepeat Repeat
  292. hi def link zshKeyword Keyword
  293. hi def link zshFunction None
  294. hi def link zshKSHFunction zshFunction
  295. hi def link zshHereDoc String
  296. hi def link zshOperator None
  297. hi def link zshRedir Operator
  298. hi def link zshVariable None
  299. hi def link zshVariableDef zshVariable
  300. hi def link zshDereferencing PreProc
  301. hi def link zshShortDeref zshDereferencing
  302. hi def link zshLongDeref zshDereferencing
  303. hi def link zshDeref zshDereferencing
  304. hi def link zshDollarVar zshDereferencing
  305. hi def link zshCommands Keyword
  306. hi def link zshOptStart Keyword
  307. hi def link zshOption Constant
  308. hi def link zshTypes Type
  309. hi def link zshSwitches Special
  310. hi def link zshNumber Number
  311. hi def link zshSubst PreProc
  312. hi def link zshSubstQuoted zshSubst
  313. hi def link zshMathSubst zshSubst
  314. hi def link zshOldSubst zshSubst
  315. hi def link zshSubstDelim zshSubst
  316. hi def link zshGlob zshSubst
  317. let b:current_syntax = "zsh"
  318. let &cpo = s:cpo_save
  319. unlet s:cpo_save