neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

zsh.vim (23642B)


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