Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | f2571c6 | 2015-06-09 19:44:55 +0200 | [diff] [blame] | 2 | " Language: Zsh shell script |
| 3 | " Maintainer: Christian Brabandt <cb@256bit.org> |
| 4 | " Previous Maintainer: Nikolai Weibull <now@bitwi.se> |
Bram Moolenaar | 23515b4 | 2020-11-29 14:36:24 +0100 | [diff] [blame] | 5 | " Latest Revision: 2020-11-21 |
Bram Moolenaar | f2571c6 | 2015-06-09 19:44:55 +0200 | [diff] [blame] | 6 | " License: Vim (see :h license) |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 7 | " Repository: https://github.com/chrisbra/vim-zsh |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 9 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 10 | finish |
| 11 | endif |
| 12 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 13 | let s:cpo_save = &cpo |
| 14 | set cpo&vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 15 | |
Bram Moolenaar | b17893a | 2020-03-14 08:19:51 +0100 | [diff] [blame] | 16 | function! s:ContainedGroup() |
Bram Moolenaar | 23515b4 | 2020-11-29 14:36:24 +0100 | [diff] [blame] | 17 | " needs 7.4.2008 for execute() function |
Bram Moolenaar | b17893a | 2020-03-14 08:19:51 +0100 | [diff] [blame] | 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 ['markdownHighlightzsh', '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,#,- |
Bram Moolenaar | f391327 | 2016-02-25 00:00:01 +0100 | [diff] [blame] | 40 | if get(g:, 'zsh_fold_enable', 0) |
| 41 | setlocal foldmethod=syntax |
| 42 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 43 | |
Bram Moolenaar | fa3b723 | 2021-12-24 13:18:38 +0000 | [diff] [blame] | 44 | syn match zshQuoted '\\.' |
Bram Moolenaar | b17893a | 2020-03-14 08:19:51 +0100 | [diff] [blame] | 45 | syn match zshPOSIXQuoted '\\[xX][0-9a-fA-F]\{1,2}' |
| 46 | syn match zshPOSIXQuoted '\\[0-7]\{1,3}' |
| 47 | syn match zshPOSIXQuoted '\\u[0-9a-fA-F]\{1,4}' |
| 48 | syn match zshPOSIXQuoted '\\U[1-9a-fA-F]\{1,8}' |
Bram Moolenaar | fa3b723 | 2021-12-24 13:18:38 +0000 | [diff] [blame] | 49 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 50 | syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+ |
Bram Moolenaar | f391327 | 2016-02-25 00:00:01 +0100 | [diff] [blame] | 51 | \ contains=zshQuoted,@zshDerefs,@zshSubst fold |
| 52 | syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ fold |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 53 | syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+ |
Bram Moolenaar | b17893a | 2020-03-14 08:19:51 +0100 | [diff] [blame] | 54 | \ skip=+\\[\\']+ end=+'+ contains=zshPOSIXQuoted,zshQuoted |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 55 | syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 56 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 57 | syn keyword zshPrecommand noglob nocorrect exec command builtin - time |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 58 | |
Bram Moolenaar | f2571c6 | 2015-06-09 19:44:55 +0200 | [diff] [blame] | 59 | syn keyword zshDelimiter do done end |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 60 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 61 | syn keyword zshConditional if then elif else fi case in esac select |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 62 | |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 63 | syn keyword zshRepeat while until repeat |
| 64 | |
| 65 | syn keyword zshRepeat for foreach nextgroup=zshVariable skipwhite |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 66 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 67 | syn keyword zshException always |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 68 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 69 | syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 70 | |
Bram Moolenaar | f391327 | 2016-02-25 00:00:01 +0100 | [diff] [blame] | 71 | syn match zshKSHFunction contained '\w\S\+' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 72 | syn match zshFunction '^\s*\k\+\ze\s*()' |
| 73 | |
| 74 | syn match zshOperator '||\|&&\|;\|&!\=' |
| 75 | |
| 76 | syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)' |
| 77 | syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' |
| 78 | syn match zshRedir '|&\=' |
| 79 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 80 | syn region zshHereDoc matchgroup=zshRedir |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 81 | \ start='<\@<!<<\s*\z([^<]\S*\)' |
| 82 | \ end='^\z1\>' |
Bram Moolenaar | 7db25fe | 2018-05-13 00:02:36 +0200 | [diff] [blame] | 83 | \ contains=@zshSubst,@zshDerefs,zshQuoted,zshPOSIXString |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 84 | syn region zshHereDoc matchgroup=zshRedir |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 85 | \ start='<\@<!<<\s*\\\z(\S\+\)' |
| 86 | \ end='^\z1\>' |
Bram Moolenaar | 7db25fe | 2018-05-13 00:02:36 +0200 | [diff] [blame] | 87 | \ contains=@zshSubst,@zshDerefs,zshQuoted,zshPOSIXString |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 88 | syn region zshHereDoc matchgroup=zshRedir |
| 89 | \ start='<\@<!<<-\s*\\\=\z(\S\+\)' |
| 90 | \ end='^\s*\z1\>' |
Bram Moolenaar | 7db25fe | 2018-05-13 00:02:36 +0200 | [diff] [blame] | 91 | \ contains=@zshSubst,@zshDerefs,zshQuoted,zshPOSIXString |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 92 | syn region zshHereDoc matchgroup=zshRedir |
Bram Moolenaar | f2571c6 | 2015-06-09 19:44:55 +0200 | [diff] [blame] | 93 | \ start=+<\@<!<<\s*\(["']\)\z(\S\+\)\1+ |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 94 | \ end='^\z1\>' |
| 95 | syn region zshHereDoc matchgroup=zshRedir |
| 96 | \ start=+<\@<!<<-\s*\(["']\)\z(\S\+\)\1+ |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 97 | \ end='^\s*\z1\>' |
| 98 | |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 99 | syn match zshVariable '\<\h\w*' contained |
| 100 | |
| 101 | syn match zshVariableDef '\<\h\w*\ze+\==' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 102 | " XXX: how safe is this? |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 103 | syn region zshVariableDef oneline |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 104 | \ start='\$\@<!\<\h\w*\[' end='\]\ze+\?=\?' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 105 | \ contains=@zshSubst |
| 106 | |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 107 | syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref,zshDollarVar |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 108 | |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 109 | syn match zshShortDeref '\$[!#$*@?_-]\w\@!' |
| 110 | syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 111 | |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 112 | syn match zshLongDeref '\$\%(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' |
| 113 | syn match zshLongDeref '\$\%(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' |
| 114 | syn match zshLongDeref '\$\%(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 115 | |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 116 | syn match zshDollarVar '\$\h\w*' |
| 117 | syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 118 | |
| 119 | syn match zshCommands '\%(^\|\s\)[.:]\ze\s' |
| 120 | syn keyword zshCommands alias autoload bg bindkey break bye cap cd |
| 121 | \ chdir clone comparguments compcall compctl |
| 122 | \ compdescribe compfiles compgroups compquote |
| 123 | \ comptags comptry compvalues continue dirs |
| 124 | \ disable disown echo echotc echoti emulate |
| 125 | \ enable eval exec exit export false fc fg |
| 126 | \ functions getcap getln getopts hash history |
| 127 | \ jobs kill let limit log logout popd print |
Bram Moolenaar | 96f45c0 | 2019-10-26 19:53:45 +0200 | [diff] [blame] | 128 | \ printf pushd pushln pwd r read |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 129 | \ rehash return sched set setcap shift |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 130 | \ source stat suspend test times trap true |
| 131 | \ ttyctl type ulimit umask unalias unfunction |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 132 | \ unhash unlimit unset vared wait |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 133 | \ whence where which zcompile zformat zftp zle |
Bram Moolenaar | 7db25fe | 2018-05-13 00:02:36 +0200 | [diff] [blame] | 134 | \ zmodload zparseopts zprof zpty zrecompile |
| 135 | \ zregexparse zsocket zstyle ztcp |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 136 | |
Bram Moolenaar | fa3b723 | 2021-12-24 13:18:38 +0000 | [diff] [blame] | 137 | " Options, generated by from the zsh source with the make-options.zsh script. |
Bram Moolenaar | f2571c6 | 2015-06-09 19:44:55 +0200 | [diff] [blame] | 138 | syn case ignore |
Bram Moolenaar | fa3b723 | 2021-12-24 13:18:38 +0000 | [diff] [blame] | 139 | syn match zshOptStart |
| 140 | \ /\v^\s*%(%(un)?setopt|set\s+[-+]o)/ |
| 141 | \ nextgroup=zshOption skipwhite |
| 142 | syn match zshOption nextgroup=zshOption,zshComment skipwhite contained /\v |
| 143 | \ <%(no_?)?%( |
| 144 | \ auto_?cd|auto_?pushd|cdable_?vars|cd_?silent|chase_?dots|chase_?links|posix_?cd|pushd_?ignore_?dups|pushd_?minus|pushd_?silent|pushd_?to_?home|always_?last_?prompt|always_?to_?end|auto_?list|auto_?menu|auto_?name_?dirs|auto_?param_?keys|auto_?param_?slash|auto_?remove_?slash|bash_?auto_?list|complete_?aliases|complete_?in_?word|glob_?complete|hash_?list_?all|list_?ambiguous|list_?beep|list_?packed|list_?rows_?first|list_?types|menu_?complete|rec_?exact|bad_?pattern|bare_?glob_?qual|brace_?ccl|case_?glob|case_?match|case_?paths|csh_?null_?glob|equals|extended_?glob|force_?float|glob|glob_?assign|glob_?dots|glob_?star_?short|glob_?subst|hist_?subst_?pattern|ignore_?braces|ignore_?close_?braces|ksh_?glob|magic_?equal_?subst|mark_?dirs|multibyte|nomatch|null_?glob|numeric_?glob_?sort|rc_?expand_?param|rematch_?pcre|sh_?glob|unset|warn_?create_?global|warn_?nested_?var|warnnestedvar|append_?history|bang_?hist|extended_?history|hist_?allow_?clobber|hist_?beep|hist_?expire_?dups_?first|hist_?fcntl_?lock|hist_?find_?no_?dups|hist_?ignore_?all_?dups|hist_?ignore_?dups|hist_?ignore_?space|hist_?lex_?words|hist_?no_?functions|hist_?no_?store|hist_?reduce_?blanks|hist_?save_?by_?copy|hist_?save_?no_?dups|hist_?verify|inc_?append_?history|inc_?append_?history_?time|share_?history|all_?export|global_?export|global_?rcs|rcs|aliases|clobber|clobber_?empty|correct|correct_?all|dvorak|flow_?control|ignore_?eof|interactive_?comments|hash_?cmds|hash_?dirs|hash_?executables_?only|mail_?warning|path_?dirs|path_?script|print_?eight_?bit|print_?exit_?value|rc_?quotes|rm_?star_?silent|rm_?star_?wait|short_?loops|short_?repeat|sun_?keyboard_?hack|auto_?continue|auto_?resume|bg_?nice|check_?jobs|check_?running_?jobs|hup|long_?list_?jobs|monitor|notify|posix_?jobs|prompt_?bang|prompt_?cr|prompt_?sp|prompt_?percent|prompt_?subst|transient_?rprompt|alias_?func_?def|c_?bases|c_?precedences|debug_?before_?cmd|err_?exit|err_?return|eval_?lineno|exec|function_?argzero|local_?loops|local_?options|local_?patterns|local_?traps|multi_?func_?def|multios|octal_?zeroes|pipe_?fail|source_?trace|typeset_?silent|typeset_?to_?unset|verbose|xtrace|append_?create|bash_?rematch|bsd_?echo|continue_?on_?error|csh_?junkie_?history|csh_?junkie_?loops|csh_?junkie_?quotes|csh_?nullcmd|ksh_?arrays|ksh_?autoload|ksh_?option_?print|ksh_?typeset|ksh_?zero_?subscript|posix_?aliases|posix_?argzero|posix_?builtins|posix_?identifiers|posix_?strings|posix_?traps|sh_?file_?expansion|sh_?nullcmd|sh_?option_?letters|sh_?word_?split|traps_?async|interactive|login|privileged|restricted|shin_?stdin|single_?command|beep|combining_?chars|emacs|overstrike|single_?line_?zle|vi|zle|brace_?expand|dot_?glob|hash_?all|hist_?append|hist_?expand|log|mail_?warn|one_?cmd|physical|prompt_?vars|stdin|track_?all|no_?match |
| 145 | \)>/ |
Bram Moolenaar | 23515b4 | 2020-11-29 14:36:24 +0100 | [diff] [blame] | 146 | syn case match |
| 147 | |
Bram Moolenaar | 2f05849 | 2017-11-30 20:27:52 +0100 | [diff] [blame] | 148 | syn keyword zshTypes float integer local typeset declare private readonly |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 149 | |
| 150 | " XXX: this may be too much |
| 151 | " syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' |
| 152 | |
| 153 | syn match zshNumber '[+-]\=\<\d\+\>' |
| 154 | syn match zshNumber '[+-]\=\<0x\x\+\>' |
| 155 | syn match zshNumber '[+-]\=\<0\o\+\>' |
| 156 | syn match zshNumber '[+-]\=\d\+#[-+]\=\w\+\>' |
| 157 | syn match zshNumber '[+-]\=\d\+\.\d\+\>' |
| 158 | |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 159 | " TODO: $[...] is the same as $((...)), so add that as well. |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 160 | syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst |
Bram Moolenaar | b17893a | 2020-03-14 08:19:51 +0100 | [diff] [blame] | 161 | exe 'syn region zshSubst matchgroup=zshSubstDelim transparent start=/\$(/ skip=/\\)/ end=/)/ contains='.s:contained. ' fold' |
Bram Moolenaar | 681baaf | 2016-02-04 20:57:07 +0100 | [diff] [blame] | 162 | syn region zshParentheses transparent start='(' skip='\\)' end=')' fold |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 163 | syn region zshGlob start='(#' end=')' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 164 | syn region zshMathSubst matchgroup=zshSubstDelim transparent |
Bram Moolenaar | 23515b4 | 2020-11-29 14:36:24 +0100 | [diff] [blame] | 165 | \ start='\%(\$\?\)[<=>]\@<!((' skip='\\)' end='))' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 166 | \ contains=zshParentheses,@zshSubst,zshNumber, |
Bram Moolenaar | fa3b723 | 2021-12-24 13:18:38 +0000 | [diff] [blame] | 167 | \ @zshDerefs,zshString fold |
Bram Moolenaar | b17893a | 2020-03-14 08:19:51 +0100 | [diff] [blame] | 168 | " The ms=s+1 prevents matching zshBrackets several times on opening brackets |
| 169 | " (see https://github.com/chrisbra/vim-zsh/issues/21#issuecomment-576330348) |
| 170 | syn region zshBrackets contained transparent start='{'ms=s+1 skip='\\}' |
Bram Moolenaar | 681baaf | 2016-02-04 20:57:07 +0100 | [diff] [blame] | 171 | \ end='}' fold |
Bram Moolenaar | b17893a | 2020-03-14 08:19:51 +0100 | [diff] [blame] | 172 | exe 'syn region zshBrackets transparent start=/{/ms=s+1 skip=/\\}/ end=/}/ contains='.s:contained. ' fold' |
| 173 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 174 | syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}' |
Bram Moolenaar | 681baaf | 2016-02-04 20:57:07 +0100 | [diff] [blame] | 175 | \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString fold |
Bram Moolenaar | b17893a | 2020-03-14 08:19:51 +0100 | [diff] [blame] | 176 | exe 'syn region zshOldSubst matchgroup=zshSubstDelim start=/`/ skip=/\\[\\`]/ end=/`/ contains='.s:contained. ',zshOldSubst fold' |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 177 | |
Bram Moolenaar | f2571c6 | 2015-06-09 19:44:55 +0200 | [diff] [blame] | 178 | syn sync minlines=50 maxlines=90 |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 179 | syn sync match zshHereDocSync grouphere NONE '<<-\=\s*\%(\\\=\S\+\|\(["']\)\S\+\1\)' |
| 180 | syn sync match zshHereDocEndSync groupthere NONE '^\s*EO\a\+\>' |
| 181 | |
Bram Moolenaar | 23515b4 | 2020-11-29 14:36:24 +0100 | [diff] [blame] | 182 | syn keyword zshTodo contained TODO FIXME XXX NOTE |
| 183 | |
| 184 | syn region zshComment oneline start='\%(^\|\s\+\)#' end='$' |
| 185 | \ contains=zshTodo,@Spell fold |
| 186 | |
| 187 | syn region zshComment start='^\s*#' end='^\%(\s*#\)\@!' |
| 188 | \ contains=zshTodo,@Spell fold |
| 189 | |
| 190 | syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$' |
| 191 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 192 | hi def link zshTodo Todo |
| 193 | hi def link zshComment Comment |
| 194 | hi def link zshPreProc PreProc |
| 195 | hi def link zshQuoted SpecialChar |
Bram Moolenaar | b17893a | 2020-03-14 08:19:51 +0100 | [diff] [blame] | 196 | hi def link zshPOSIXQuoted SpecialChar |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 197 | hi def link zshString String |
| 198 | hi def link zshStringDelimiter zshString |
| 199 | hi def link zshPOSIXString zshString |
| 200 | hi def link zshJobSpec Special |
| 201 | hi def link zshPrecommand Special |
| 202 | hi def link zshDelimiter Keyword |
| 203 | hi def link zshConditional Conditional |
| 204 | hi def link zshException Exception |
| 205 | hi def link zshRepeat Repeat |
| 206 | hi def link zshKeyword Keyword |
| 207 | hi def link zshFunction None |
| 208 | hi def link zshKSHFunction zshFunction |
| 209 | hi def link zshHereDoc String |
Bram Moolenaar | f2571c6 | 2015-06-09 19:44:55 +0200 | [diff] [blame] | 210 | hi def link zshOperator None |
| 211 | hi def link zshRedir Operator |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 212 | hi def link zshVariable None |
Bram Moolenaar | e37d50a | 2008-08-06 17:06:04 +0000 | [diff] [blame] | 213 | hi def link zshVariableDef zshVariable |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 214 | hi def link zshDereferencing PreProc |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 215 | hi def link zshShortDeref zshDereferencing |
| 216 | hi def link zshLongDeref zshDereferencing |
| 217 | hi def link zshDeref zshDereferencing |
| 218 | hi def link zshDollarVar zshDereferencing |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 219 | hi def link zshCommands Keyword |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 220 | hi def link zshOptStart Keyword |
| 221 | hi def link zshOption Constant |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 222 | hi def link zshTypes Type |
| 223 | hi def link zshSwitches Special |
| 224 | hi def link zshNumber Number |
| 225 | hi def link zshSubst PreProc |
| 226 | hi def link zshMathSubst zshSubst |
| 227 | hi def link zshOldSubst zshSubst |
| 228 | hi def link zshSubstDelim zshSubst |
Bram Moolenaar | 9423749 | 2017-04-23 18:40:21 +0200 | [diff] [blame] | 229 | hi def link zshGlob zshSubst |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 230 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 231 | let b:current_syntax = "zsh" |
| 232 | |
Bram Moolenaar | c81e5e7 | 2007-05-05 18:24:42 +0000 | [diff] [blame] | 233 | let &cpo = s:cpo_save |
| 234 | unlet s:cpo_save |