blob: e16e74e0c2650cdcb7801b0bb92d01513b1a8e51 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaarf2571c62015-06-09 19:44:55 +02002" Language: Zsh shell script
3" Maintainer: Christian Brabandt <cb@256bit.org>
4" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
Bram Moolenaarf55e4c82017-08-01 20:44:53 +02005" Latest Revision: 2017-07-11
Bram Moolenaarf2571c62015-06-09 19:44:55 +02006" License: Vim (see :h license)
Bram Moolenaar94237492017-04-23 18:40:21 +02007" Repository: https://github.com/chrisbra/vim-zsh
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
Bram Moolenaarc81e5e72007-05-05 18:24:42 +00009if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000010 finish
11endif
12
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000013let s:cpo_save = &cpo
14set cpo&vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000015
Bram Moolenaarf3913272016-02-25 00:00:01 +010016if v:version > 704 || (v:version == 704 && has("patch1142"))
17 syn iskeyword @,48-57,_,192-255,#,-
18else
19 setlocal iskeyword+=-
20endif
21if get(g:, 'zsh_fold_enable', 0)
22 setlocal foldmethod=syntax
23endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000025syn keyword zshTodo contained TODO FIXME XXX NOTE
Bram Moolenaar071d4272004-06-13 20:20:40 +000026
Bram Moolenaar94237492017-04-23 18:40:21 +020027syn region zshComment oneline start='\%(^\|\s\+\)#' end='$'
Bram Moolenaarf3913272016-02-25 00:00:01 +010028 \ contains=zshTodo,@Spell fold
29
30syn region zshComment start='^\s*#' end='^\%(\s*#\)\@!'
31 \ contains=zshTodo,@Spell fold
Bram Moolenaar071d4272004-06-13 20:20:40 +000032
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000033syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$'
Bram Moolenaar071d4272004-06-13 20:20:40 +000034
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000035syn match zshQuoted '\\.'
36syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+
Bram Moolenaarf3913272016-02-25 00:00:01 +010037 \ contains=zshQuoted,@zshDerefs,@zshSubst fold
38syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ fold
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000039" XXX: This should probably be more precise, but Zsh seems a bit confused about it itself
40syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+
41 \ end=+'+ contains=zshQuoted
42syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)'
Bram Moolenaar071d4272004-06-13 20:20:40 +000043
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000044syn keyword zshPrecommand noglob nocorrect exec command builtin - time
Bram Moolenaar071d4272004-06-13 20:20:40 +000045
Bram Moolenaarf2571c62015-06-09 19:44:55 +020046syn keyword zshDelimiter do done end
Bram Moolenaar071d4272004-06-13 20:20:40 +000047
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000048syn keyword zshConditional if then elif else fi case in esac select
Bram Moolenaar071d4272004-06-13 20:20:40 +000049
Bram Moolenaare37d50a2008-08-06 17:06:04 +000050syn keyword zshRepeat while until repeat
51
52syn keyword zshRepeat for foreach nextgroup=zshVariable skipwhite
Bram Moolenaar071d4272004-06-13 20:20:40 +000053
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000054syn keyword zshException always
Bram Moolenaar071d4272004-06-13 20:20:40 +000055
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000056syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite
Bram Moolenaar071d4272004-06-13 20:20:40 +000057
Bram Moolenaarf3913272016-02-25 00:00:01 +010058syn match zshKSHFunction contained '\w\S\+'
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000059syn match zshFunction '^\s*\k\+\ze\s*()'
60
61syn match zshOperator '||\|&&\|;\|&!\='
62
63syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)'
64syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\='
65syn match zshRedir '|&\='
66
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000067syn region zshHereDoc matchgroup=zshRedir
Bram Moolenaare37d50a2008-08-06 17:06:04 +000068 \ start='<\@<!<<\s*\z([^<]\S*\)'
69 \ end='^\z1\>'
70 \ contains=@zshSubst
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000071syn region zshHereDoc matchgroup=zshRedir
Bram Moolenaare37d50a2008-08-06 17:06:04 +000072 \ start='<\@<!<<\s*\\\z(\S\+\)'
73 \ end='^\z1\>'
74 \ contains=@zshSubst
75syn region zshHereDoc matchgroup=zshRedir
76 \ start='<\@<!<<-\s*\\\=\z(\S\+\)'
77 \ end='^\s*\z1\>'
78 \ contains=@zshSubst
79syn region zshHereDoc matchgroup=zshRedir
Bram Moolenaarf2571c62015-06-09 19:44:55 +020080 \ start=+<\@<!<<\s*\(["']\)\z(\S\+\)\1+
Bram Moolenaare37d50a2008-08-06 17:06:04 +000081 \ end='^\z1\>'
82syn region zshHereDoc matchgroup=zshRedir
83 \ start=+<\@<!<<-\s*\(["']\)\z(\S\+\)\1+
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000084 \ end='^\s*\z1\>'
85
Bram Moolenaare37d50a2008-08-06 17:06:04 +000086syn match zshVariable '\<\h\w*' contained
87
88syn match zshVariableDef '\<\h\w*\ze+\=='
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000089" XXX: how safe is this?
Bram Moolenaare37d50a2008-08-06 17:06:04 +000090syn region zshVariableDef oneline
Bram Moolenaar94237492017-04-23 18:40:21 +020091 \ start='\$\@<!\<\h\w*\[' end='\]\ze+\?=\?'
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000092 \ contains=@zshSubst
93
Bram Moolenaar94237492017-04-23 18:40:21 +020094syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref,zshDollarVar
Bram Moolenaarc81e5e72007-05-05 18:24:42 +000095
Bram Moolenaar94237492017-04-23 18:40:21 +020096syn match zshShortDeref '\$[!#$*@?_-]\w\@!'
97syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>'
Bram Moolenaar071d4272004-06-13 20:20:40 +000098
Bram Moolenaar94237492017-04-23 18:40:21 +020099syn match zshLongDeref '\$\%(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)'
100syn match zshLongDeref '\$\%(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)'
101syn match zshLongDeref '\$\%(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)'
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000102
Bram Moolenaar94237492017-04-23 18:40:21 +0200103syn match zshDollarVar '\$\h\w*'
104syn match zshDeref '\$[=^~]*[#+]*\h\w*\>'
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000105
106syn match zshCommands '\%(^\|\s\)[.:]\ze\s'
107syn keyword zshCommands alias autoload bg bindkey break bye cap cd
108 \ chdir clone comparguments compcall compctl
109 \ compdescribe compfiles compgroups compquote
110 \ comptags comptry compvalues continue dirs
111 \ disable disown echo echotc echoti emulate
112 \ enable eval exec exit export false fc fg
113 \ functions getcap getln getopts hash history
114 \ jobs kill let limit log logout popd print
115 \ printf pushd pushln pwd r read readonly
Bram Moolenaar94237492017-04-23 18:40:21 +0200116 \ rehash return sched set setcap shift
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000117 \ source stat suspend test times trap true
118 \ ttyctl type ulimit umask unalias unfunction
Bram Moolenaar94237492017-04-23 18:40:21 +0200119 \ unhash unlimit unset vared wait
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000120 \ whence where which zcompile zformat zftp zle
121 \ zmodload zparseopts zprof zpty zregexparse
122 \ zsocket zstyle ztcp
123
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200124" Options, generated by: echo ${(j:\n:)options[(I)*]} | sort
Bram Moolenaarfa735342016-01-03 22:14:44 +0100125" Create a list of option names from zsh source dir:
126" #!/bin/zsh
127" topdir=/path/to/zsh-xxx
128" grep '^pindex([A-Za-z_]*)$' $topdir/Src/Doc/Zsh/optionsyo |
129" while read opt
130" do
131" echo ${${(L)opt#pindex\(}%\)}
132" done
133
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200134syn case ignore
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200135
Bram Moolenaar94237492017-04-23 18:40:21 +0200136syn match zshOptStart /^\s*\%(\%(\%(un\)\?setopt\)\|set\s+[-+]o\)/ nextgroup=zshOption skipwhite
Bram Moolenaarf55e4c82017-08-01 20:44:53 +0200137syn match zshOption /
138 \ \%(\%(\<no_\?\)\?aliases\>\)\|
139 \ \%(\%(\<no_\?\)\?allexport\>\)\|\%(\%(no_\?\)\?all_export\>\)\|
140 \ \%(\%(\<no_\?\)\?alwayslastprompt\>\)\|\%(\%(no_\?\)\?always_last_prompt\>\)\|\%(\%(no_\?\)\?always_lastprompt\>\)\|
141 \ \%(\%(\<no_\?\)\?alwaystoend\>\)\|\%(\%(no_\?\)\?always_to_end\>\)\|
142 \ \%(\%(\<no_\?\)\?appendcreate\>\)\|\%(\%(no_\?\)\?append_create\>\)\|
143 \ \%(\%(\<no_\?\)\?appendhistory\>\)\|\%(\%(no_\?\)\?append_history\>\)\|
144 \ \%(\%(\<no_\?\)\?autocd\>\)\|\%(\%(no_\?\)\?auto_cd\>\)\|
145 \ \%(\%(\<no_\?\)\?autocontinue\>\)\|\%(\%(no_\?\)\?auto_continue\>\)\|
146 \ \%(\%(\<no_\?\)\?autolist\>\)\|\%(\%(no_\?\)\?auto_list\>\)\|
147 \ \%(\%(\<no_\?\)\?automenu\>\)\|\%(\%(no_\?\)\?auto_menu\>\)\|
148 \ \%(\%(\<no_\?\)\?autonamedirs\>\)\|\%(\%(no_\?\)\?auto_name_dirs\>\)\|
149 \ \%(\%(\<no_\?\)\?autoparamkeys\>\)\|\%(\%(no_\?\)\?auto_param_keys\>\)\|
150 \ \%(\%(\<no_\?\)\?autoparamslash\>\)\|\%(\%(no_\?\)\?auto_param_slash\>\)\|
151 \ \%(\%(\<no_\?\)\?autopushd\>\)\|\%(\%(no_\?\)\?auto_pushd\>\)\|
152 \ \%(\%(\<no_\?\)\?autoremoveslash\>\)\|\%(\%(no_\?\)\?auto_remove_slash\>\)\|
153 \ \%(\%(\<no_\?\)\?autoresume\>\)\|\%(\%(no_\?\)\?auto_resume\>\)\|
154 \ \%(\%(\<no_\?\)\?badpattern\>\)\|\%(\%(no_\?\)\?bad_pattern\>\)\|
155 \ \%(\%(\<no_\?\)\?banghist\>\)\|\%(\%(no_\?\)\?bang_hist\>\)\|
156 \ \%(\%(\<no_\?\)\?bareglobqual\>\)\|\%(\%(no_\?\)\?bare_glob_qual\>\)\|
157 \ \%(\%(\<no_\?\)\?bashautolist\>\)\|\%(\%(no_\?\)\?bash_auto_list\>\)\|
158 \ \%(\%(\<no_\?\)\?bashrematch\>\)\|\%(\%(no_\?\)\?bash_rematch\>\)\|
159 \ \%(\%(\<no_\?\)\?beep\>\)\|
160 \ \%(\%(\<no_\?\)\?bgnice\>\)\|\%(\%(no_\?\)\?bg_nice\>\)\|
161 \ \%(\%(\<no_\?\)\?braceccl\>\)\|\%(\%(no_\?\)\?brace_ccl\>\)\|
162 \ \%(\%(\<no_\?\)\?braceexpand\>\)\|\%(\%(no_\?\)\?brace_expand\>\)\|
163 \ \%(\%(\<no_\?\)\?bsdecho\>\)\|\%(\%(no_\?\)\?bsd_echo\>\)\|
164 \ \%(\%(\<no_\?\)\?caseglob\>\)\|\%(\%(no_\?\)\?case_glob\>\)\|
165 \ \%(\%(\<no_\?\)\?casematch\>\)\|\%(\%(no_\?\)\?case_match\>\)\|
166 \ \%(\%(\<no_\?\)\?cbases\>\)\|\%(\%(no_\?\)\?c_bases\>\)\|
167 \ \%(\%(\<no_\?\)\?cdablevars\>\)\|\%(\%(no_\?\)\?cdable_vars\>\)\|\%(\%(no_\?\)\?cd_able_vars\>\)\|
168 \ \%(\%(\<no_\?\)\?chasedots\>\)\|\%(\%(no_\?\)\?chase_dots\>\)\|
169 \ \%(\%(\<no_\?\)\?chaselinks\>\)\|\%(\%(no_\?\)\?chase_links\>\)\|
170 \ \%(\%(\<no_\?\)\?checkjobs\>\)\|\%(\%(no_\?\)\?check_jobs\>\)\|
171 \ \%(\%(\<no_\?\)\?clobber\>\)\|
172 \ \%(\%(\<no_\?\)\?combiningchars\>\)\|\%(\%(no_\?\)\?combining_chars\>\)\|
173 \ \%(\%(\<no_\?\)\?completealiases\>\)\|\%(\%(no_\?\)\?complete_aliases\>\)\|
174 \ \%(\%(\<no_\?\)\?completeinword\>\)\|\%(\%(no_\?\)\?complete_in_word\>\)\|
175 \ \%(\%(\<no_\?\)\?continueonerror\>\)\|\%(\%(no_\?\)\?continue_on_error\>\)\|
176 \ \%(\%(\<no_\?\)\?correct\>\)\|
177 \ \%(\%(\<no_\?\)\?correctall\>\)\|\%(\%(no_\?\)\?correct_all\>\)\|
178 \ \%(\%(\<no_\?\)\?cprecedences\>\)\|\%(\%(no_\?\)\?c_precedences\>\)\|
179 \ \%(\%(\<no_\?\)\?cshjunkiehistory\>\)\|\%(\%(no_\?\)\?csh_junkie_history\>\)\|
180 \ \%(\%(\<no_\?\)\?cshjunkieloops\>\)\|\%(\%(no_\?\)\?csh_junkie_loops\>\)\|
181 \ \%(\%(\<no_\?\)\?cshjunkiequotes\>\)\|\%(\%(no_\?\)\?csh_junkie_quotes\>\)\|
182 \ \%(\%(\<no_\?\)\?csh_nullcmd\>\)\|\%(\%(no_\?\)\?csh_null_cmd\>\)\|\%(\%(no_\?\)\?cshnullcmd\>\)\|\%(\%(no_\?\)\?csh_null_cmd\>\)\|
183 \ \%(\%(\<no_\?\)\?cshnullglob\>\)\|\%(\%(no_\?\)\?csh_null_glob\>\)\|
184 \ \%(\%(\<no_\?\)\?debugbeforecmd\>\)\|\%(\%(no_\?\)\?debug_before_cmd\>\)\|
185 \ \%(\%(\<no_\?\)\?dotglob\>\)\|\%(\%(no_\?\)\?dot_glob\>\)\|
186 \ \%(\%(\<no_\?\)\?dvorak\>\)\|
187 \ \%(\%(\<no_\?\)\?emacs\>\)\|
188 \ \%(\%(\<no_\?\)\?equals\>\)\|
189 \ \%(\%(\<no_\?\)\?errexit\>\)\|\%(\%(no_\?\)\?err_exit\>\)\|
190 \ \%(\%(\<no_\?\)\?errreturn\>\)\|\%(\%(no_\?\)\?err_return\>\)\|
191 \ \%(\%(\<no_\?\)\?evallineno_\?\)\|\%(\%(no_\?\)\?eval_lineno_\?\)\|
192 \ \%(\%(\<no_\?\)\?exec\>\)\|
193 \ \%(\%(\<no_\?\)\?extendedglob\>\)\|\%(\%(no_\?\)\?extended_glob\>\)\|
194 \ \%(\%(\<no_\?\)\?extendedhistory\>\)\|\%(\%(no_\?\)\?extended_history\>\)\|
195 \ \%(\%(\<no_\?\)\?flowcontrol\>\)\|\%(\%(no_\?\)\?flow_control\>\)\|
196 \ \%(\%(\<no_\?\)\?forcefloat\>\)\|\%(\%(no_\?\)\?force_float\>\)\|
197 \ \%(\%(\<no_\?\)\?functionargzero\>\)\|\%(\%(no_\?\)\?function_argzero\>\)\|\%(\%(no_\?\)\?function_arg_zero\>\)\|
198 \ \%(\%(\<no_\?\)\?glob\>\)\|
199 \ \%(\%(\<no_\?\)\?globalexport\>\)\|\%(\%(no_\?\)\?global_export\>\)\|
200 \ \%(\%(\<no_\?\)\?globalrcs\>\)\|\%(\%(no_\?\)\?global_rcs\>\)\|
201 \ \%(\%(\<no_\?\)\?globassign\>\)\|\%(\%(no_\?\)\?glob_assign\>\)\|
202 \ \%(\%(\<no_\?\)\?globcomplete\>\)\|\%(\%(no_\?\)\?glob_complete\>\)\|
203 \ \%(\%(\<no_\?\)\?globdots\>\)\|\%(\%(no_\?\)\?glob_dots\>\)\|
204 \ \%(\%(\<no_\?\)\?glob_subst\>\)\|\%(\%(no_\?\)\?globsubst\>\)\|
205 \ \%(\%(\<no_\?\)\?globstarshort\>\)\|\%(\%(no_\?\)\?glob_star_short\>\)\|
206 \ \%(\%(\<no_\?\)\?hashall\>\)\|\%(\%(no_\?\)\?hash_all\>\)\|
207 \ \%(\%(\<no_\?\)\?hashcmds\>\)\|\%(\%(no_\?\)\?hash_cmds\>\)\|
208 \ \%(\%(\<no_\?\)\?hashdirs\>\)\|\%(\%(no_\?\)\?hash_dirs\>\)\|
209 \ \%(\%(\<no_\?\)\?hashexecutablesonly\>\)\|\%(\%(no_\?\)\?hash_executables_only\>\)\|
210 \ \%(\%(\<no_\?\)\?hashlistall\>\)\|\%(\%(no_\?\)\?hash_list_all\>\)\|
211 \ \%(\%(\<no_\?\)\?histallowclobber\>\)\|\%(\%(no_\?\)\?hist_allow_clobber\>\)\|
212 \ \%(\%(\<no_\?\)\?histappend\>\)\|\%(\%(no_\?\)\?hist_append\>\)\|
213 \ \%(\%(\<no_\?\)\?histbeep\>\)\|\%(\%(no_\?\)\?hist_beep\>\)\|
214 \ \%(\%(\<no_\?\)\?hist_expand\>\)\|\%(\%(no_\?\)\?histexpand\>\)\|
215 \ \%(\%(\<no_\?\)\?hist_expire_dups_first\>\)\|\%(\%(no_\?\)\?histexpiredupsfirst\>\)\|
216 \ \%(\%(\<no_\?\)\?histfcntllock\>\)\|\%(\%(no_\?\)\?hist_fcntl_lock\>\)\|
217 \ \%(\%(\<no_\?\)\?histfindnodups\>\)\|\%(\%(no_\?\)\?hist_find_no_dups\>\)\|
218 \ \%(\%(\<no_\?\)\?histignorealldups\>\)\|\%(\%(no_\?\)\?hist_ignore_all_dups\>\)\|
219 \ \%(\%(\<no_\?\)\?histignoredups\>\)\|\%(\%(no_\?\)\?hist_ignore_dups\>\)\|
220 \ \%(\%(\<no_\?\)\?histignorespace\>\)\|\%(\%(no_\?\)\?hist_ignore_space\>\)\|
221 \ \%(\%(\<no_\?\)\?histlexwords\>\)\|\%(\%(no_\?\)\?hist_lex_words\>\)\|
222 \ \%(\%(\<no_\?\)\?histnofunctions\>\)\|\%(\%(no_\?\)\?hist_no_functions\>\)\|
223 \ \%(\%(\<no_\?\)\?histnostore\>\)\|\%(\%(no_\?\)\?hist_no_store\>\)\|
224 \ \%(\%(\<no_\?\)\?histreduceblanks\>\)\|\%(\%(no_\?\)\?hist_reduce_blanks\>\)\|
225 \ \%(\%(\<no_\?\)\?histsavebycopy\>\)\|\%(\%(no_\?\)\?hist_save_by_copy\>\)\|
226 \ \%(\%(\<no_\?\)\?histsavenodups\>\)\|\%(\%(no_\?\)\?hist_save_no_dups\>\)\|
227 \ \%(\%(\<no_\?\)\?histsubstpattern\>\)\|\%(\%(no_\?\)\?hist_subst_pattern\>\)\|
228 \ \%(\%(\<no_\?\)\?histverify\>\)\|\%(\%(no_\?\)\?hist_verify\>\)\|
229 \ \%(\%(\<no_\?\)\?hup\>\)\|
230 \ \%(\%(\<no_\?\)\?ignorebraces\>\)\|\%(\%(no_\?\)\?ignore_braces\>\)\|
231 \ \%(\%(\<no_\?\)\?ignoreclosebraces\>\)\|\%(\%(no_\?\)\?ignore_close_braces\>\)\|
232 \ \%(\%(\<no_\?\)\?ignoreeof\>\)\|\%(\%(no_\?\)\?ignore_eof\>\)\|
233 \ \%(\%(\<no_\?\)\?incappendhistory\>\)\|\%(\%(no_\?\)\?inc_append_history\>\)\|
234 \ \%(\%(\<no_\?\)\?incappendhistorytime\>\)\|\%(\%(no_\?\)\?inc_append_history_time\>\)\|
235 \ \%(\%(\<no_\?\)\?interactive\>\)\|
236 \ \%(\%(\<no_\?\)\?interactivecomments\>\)\|\%(\%(no_\?\)\?interactive_comments\>\)\|
237 \ \%(\%(\<no_\?\)\?ksharrays\>\)\|\%(\%(no_\?\)\?ksh_arrays\>\)\|
238 \ \%(\%(\<no_\?\)\?kshautoload\>\)\|\%(\%(no_\?\)\?ksh_autoload\>\)\|
239 \ \%(\%(\<no_\?\)\?kshglob\>\)\|\%(\%(no_\?\)\?ksh_glob\>\)\|
240 \ \%(\%(\<no_\?\)\?kshoptionprint\>\)\|\%(\%(no_\?\)\?ksh_option_print\>\)\|
241 \ \%(\%(\<no_\?\)\?kshtypeset\>\)\|\%(\%(no_\?\)\?ksh_typeset\>\)\|
242 \ \%(\%(\<no_\?\)\?kshzerosubscript\>\)\|\%(\%(no_\?\)\?ksh_zero_subscript\>\)\|
243 \ \%(\%(\<no_\?\)\?listambiguous\>\)\|\%(\%(no_\?\)\?list_ambiguous\>\)\|
244 \ \%(\%(\<no_\?\)\?listbeep\>\)\|\%(\%(no_\?\)\?list_beep\>\)\|
245 \ \%(\%(\<no_\?\)\?listpacked\>\)\|\%(\%(no_\?\)\?list_packed\>\)\|
246 \ \%(\%(\<no_\?\)\?listrowsfirst\>\)\|\%(\%(no_\?\)\?list_rows_first\>\)\|
247 \ \%(\%(\<no_\?\)\?listtypes\>\)\|\%(\%(no_\?\)\?list_types\>\)\|
248 \ \%(\%(\<no_\?\)\?localloops\>\)\|\%(\%(no_\?\)\?local_loops\>\)\|
249 \ \%(\%(\<no_\?\)\?localoptions\>\)\|\%(\%(no_\?\)\?local_options\>\)\|
250 \ \%(\%(\<no_\?\)\?localpatterns\>\)\|\%(\%(no_\?\)\?local_patterns\>\)\|
251 \ \%(\%(\<no_\?\)\?localtraps\>\)\|\%(\%(no_\?\)\?local_traps\>\)\|
252 \ \%(\%(\<no_\?\)\?log\>\)\|
253 \ \%(\%(\<no_\?\)\?login\>\)\|
254 \ \%(\%(\<no_\?\)\?longlistjobs\>\)\|\%(\%(no_\?\)\?long_list_jobs\>\)\|
255 \ \%(\%(\<no_\?\)\?magicequalsubst\>\)\|\%(\%(no_\?\)\?magic_equal_subst\>\)\|
256 \ \%(\%(\<no_\?\)\?mark_dirs\>\)\|
257 \ \%(\%(\<no_\?\)\?mailwarn\>\)\|\%(\%(no_\?\)\?mail_warn\>\)\|
258 \ \%(\%(\<no_\?\)\?mailwarning\>\)\|\%(\%(no_\?\)\?mail_warning\>\)\|
259 \ \%(\%(\<no_\?\)\?markdirs\>\)\|
260 \ \%(\%(\<no_\?\)\?menucomplete\>\)\|\%(\%(no_\?\)\?menu_complete\>\)\|
261 \ \%(\%(\<no_\?\)\?monitor\>\)\|
262 \ \%(\%(\<no_\?\)\?multibyte\>\)\|\%(\%(no_\?\)\?multi_byte\>\)\|
263 \ \%(\%(\<no_\?\)\?multifuncdef\>\)\|\%(\%(no_\?\)\?multi_func_def\>\)\|
264 \ \%(\%(\<no_\?\)\?multios\>\)\|\%(\%(no_\?\)\?multi_os\>\)\|
265 \ \%(\%(\<no_\?\)\?nomatch\>\)\|\%(\%(no_\?\)\?no_match\>\)\|
266 \ \%(\%(\<no_\?\)\?notify\>\)\|
267 \ \%(\%(\<no_\?\)\?nullglob\>\)\|\%(\%(no_\?\)\?null_glob\>\)\|
268 \ \%(\%(\<no_\?\)\?numericglobsort\>\)\|\%(\%(no_\?\)\?numeric_glob_sort\>\)\|
269 \ \%(\%(\<no_\?\)\?octalzeroes\>\)\|\%(\%(no_\?\)\?octal_zeroes\>\)\|
270 \ \%(\%(\<no_\?\)\?onecmd\>\)\|\%(\%(no_\?\)\?one_cmd\>\)\|
271 \ \%(\%(\<no_\?\)\?overstrike\>\)\|\%(\%(no_\?\)\?over_strike\>\)\|
272 \ \%(\%(\<no_\?\)\?pathdirs\>\)\|\%(\%(no_\?\)\?path_dirs\>\)\|
273 \ \%(\%(\<no_\?\)\?pathscript\>\)\|\%(\%(no_\?\)\?path_script\>\)\|
274 \ \%(\%(\<no_\?\)\?physical\>\)\|
275 \ \%(\%(\<no_\?\)\?pipefail\>\)\|\%(\%(no_\?\)\?pipe_fail\>\)\|
276 \ \%(\%(\<no_\?\)\?posixaliases\>\)\|\%(\%(no_\?\)\?posix_aliases\>\)\|
277 \ \%(\%(\<no_\?\)\?posixargzero\>\)\|\%(\%(no_\?\)\?posix_arg_zero\>\)\|\%(\%(no_\?\)\?posix_argzero\>\)\|
278 \ \%(\%(\<no_\?\)\?posixbuiltins\>\)\|\%(\%(no_\?\)\?posix_builtins\>\)\|
279 \ \%(\%(\<no_\?\)\?posixcd\>\)\|\%(\%(no_\?\)\?posix_cd\>\)\|
280 \ \%(\%(\<no_\?\)\?posixidentifiers\>\)\|\%(\%(no_\?\)\?posix_identifiers\>\)\|
281 \ \%(\%(\<no_\?\)\?posixjobs\>\)\|\%(\%(no_\?\)\?posix_jobs\>\)\|
282 \ \%(\%(\<no_\?\)\?posixstrings\>\)\|\%(\%(no_\?\)\?posix_strings\>\)\|
283 \ \%(\%(\<no_\?\)\?posixtraps\>\)\|\%(\%(no_\?\)\?posix_traps\>\)\|
284 \ \%(\%(\<no_\?\)\?printeightbit\>\)\|\%(\%(no_\?\)\?print_eight_bit\>\)\|
285 \ \%(\%(\<no_\?\)\?printexitvalue\>\)\|\%(\%(no_\?\)\?print_exit_value\>\)\|
286 \ \%(\%(\<no_\?\)\?privileged\>\)\|
287 \ \%(\%(\<no_\?\)\?promptbang\>\)\|\%(\%(no_\?\)\?prompt_bang\>\)\|
288 \ \%(\%(\<no_\?\)\?promptcr\>\)\|\%(\%(no_\?\)\?prompt_cr\>\)\|
289 \ \%(\%(\<no_\?\)\?promptpercent\>\)\|\%(\%(no_\?\)\?prompt_percent\>\)\|
290 \ \%(\%(\<no_\?\)\?promptsp\>\)\|\%(\%(no_\?\)\?prompt_sp\>\)\|
291 \ \%(\%(\<no_\?\)\?promptsubst\>\)\|\%(\%(no_\?\)\?prompt_subst\>\)\|
292 \ \%(\%(\<no_\?\)\?promptvars\>\)\|\%(\%(no_\?\)\?prompt_vars\>\)\|
293 \ \%(\%(\<no_\?\)\?pushdignoredups\>\)\|\%(\%(no_\?\)\?pushd_ignore_dups\>\)\|
294 \ \%(\%(\<no_\?\)\?pushdminus\>\)\|\%(\%(no_\?\)\?pushd_minus\>\)\|
295 \ \%(\%(\<no_\?\)\?pushdsilent\>\)\|\%(\%(no_\?\)\?pushd_silent\>\)\|
296 \ \%(\%(\<no_\?\)\?pushdtohome\>\)\|\%(\%(no_\?\)\?pushd_to_home\>\)\|
297 \ \%(\%(\<no_\?\)\?rcexpandparam\>\)\|\%(\%(no_\?\)\?rc_expandparam\>\)\|\%(\%(no_\?\)\?rc_expand_param\>\)\|
298 \ \%(\%(\<no_\?\)\?rcquotes\>\)\|\%(\%(no_\?\)\?rc_quotes\>\)\|
299 \ \%(\%(\<no_\?\)\?rcs\>\)\|
300 \ \%(\%(\<no_\?\)\?recexact\>\)\|\%(\%(no_\?\)\?rec_exact\>\)\|
301 \ \%(\%(\<no_\?\)\?rematchpcre\>\)\|\%(\%(no_\?\)\?re_match_pcre\>\)\|\%(\%(no_\?\)\?rematch_pcre\>\)\|
302 \ \%(\%(\<no_\?\)\?restricted\>\)\|
303 \ \%(\%(\<no_\?\)\?rmstarsilent\>\)\|\%(\%(no_\?\)\?rm_star_silent\>\)\|
304 \ \%(\%(\<no_\?\)\?rmstarwait\>\)\|\%(\%(no_\?\)\?rm_star_wait\>\)\|
305 \ \%(\%(\<no_\?\)\?sharehistory\>\)\|\%(\%(no_\?\)\?share_history\>\)\|
306 \ \%(\%(\<no_\?\)\?shfileexpansion\>\)\|\%(\%(no_\?\)\?sh_file_expansion\>\)\|
307 \ \%(\%(\<no_\?\)\?shglob\>\)\|\%(\%(no_\?\)\?sh_glob\>\)\|
308 \ \%(\%(\<no_\?\)\?shinstdin\>\)\|\%(\%(no_\?\)\?shin_stdin\>\)\|
309 \ \%(\%(\<no_\?\)\?shnullcmd\>\)\|\%(\%(no_\?\)\?sh_nullcmd\>\)\|
310 \ \%(\%(\<no_\?\)\?shoptionletters\>\)\|\%(\%(no_\?\)\?sh_option_letters\>\)\|
311 \ \%(\%(\<no_\?\)\?shortloops\>\)\|\%(\%(no_\?\)\?short_loops\>\)\|
312 \ \%(\%(\<no_\?\)\?shwordsplit\>\)\|\%(\%(no_\?\)\?sh_word_split\>\)\|
313 \ \%(\%(\<no_\?\)\?singlecommand\>\)\|\%(\%(no_\?\)\?single_command\>\)\|
314 \ \%(\%(\<no_\?\)\?singlelinezle\>\)\|\%(\%(no_\?\)\?single_line_zle\>\)\|
315 \ \%(\%(\<no_\?\)\?sourcetrace\>\)\|\%(\%(no_\?\)\?source_trace\>\)\|
316 \ \%(\%(\<no_\?\)\?stdin\>\)\|
317 \ \%(\%(\<no_\?\)\?sunkeyboardhack\>\)\|\%(\%(no_\?\)\?sun_keyboard_hack\>\)\|
318 \ \%(\%(\<no_\?\)\?trackall\>\)\|\%(\%(no_\?\)\?track_all\>\)\|
319 \ \%(\%(\<no_\?\)\?transientrprompt\>\)\|\%(\%(no_\?\)\?transient_rprompt\>\)\|
320 \ \%(\%(\<no_\?\)\?trapsasync\>\)\|\%(\%(no_\?\)\?traps_async\>\)\|
321 \ \%(\%(\<no_\?\)\?typesetsilent\>\)\|\%(\%(no_\?\)\?type_set_silent\>\)\|\%(\%(no_\?\)\?typeset_silent\>\)\|
322 \ \%(\%(\<no_\?\)\?unset\>\)\|
323 \ \%(\%(\<no_\?\)\?verbose\>\)\|
324 \ \%(\%(\<no_\?\)\?vi\>\)\|
325 \ \%(\%(\<no_\?\)\?warncreateglobal\>\)\|\%(\%(no_\?\)\?warn_create_global\>\)\|
326 \ \%(\%(\<no_\?\)\?xtrace\>\)\|
327 \ \%(\%(\<no_\?\)\?zle\>\)/ nextgroup=zshOption skipwhite contained
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200328
Bram Moolenaarfa735342016-01-03 22:14:44 +0100329syn keyword zshTypes float integer local typeset declare private
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000330
331" XXX: this may be too much
332" syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+'
333
334syn match zshNumber '[+-]\=\<\d\+\>'
335syn match zshNumber '[+-]\=\<0x\x\+\>'
336syn match zshNumber '[+-]\=\<0\o\+\>'
337syn match zshNumber '[+-]\=\d\+#[-+]\=\w\+\>'
338syn match zshNumber '[+-]\=\d\+\.\d\+\>'
339
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000340" TODO: $[...] is the same as $((...)), so add that as well.
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000341syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst
342syn region zshSubst matchgroup=zshSubstDelim transparent
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100343 \ start='\$(' skip='\\)' end=')' contains=TOP fold
344syn region zshParentheses transparent start='(' skip='\\)' end=')' fold
Bram Moolenaar94237492017-04-23 18:40:21 +0200345syn region zshGlob start='(#' end=')'
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000346syn region zshMathSubst matchgroup=zshSubstDelim transparent
Bram Moolenaar94237492017-04-23 18:40:21 +0200347 \ start='\$((' skip='\\)' end='))'
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000348 \ contains=zshParentheses,@zshSubst,zshNumber,
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100349 \ @zshDerefs,zshString keepend fold
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000350syn region zshBrackets contained transparent start='{' skip='\\}'
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100351 \ end='}' fold
Bram Moolenaarf3913272016-02-25 00:00:01 +0100352syn region zshBrackets transparent start='{' skip='\\}'
353 \ end='}' contains=TOP fold
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000354syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}'
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100355 \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString fold
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000356syn region zshOldSubst matchgroup=zshSubstDelim start=+`+ skip=+\\`+
Bram Moolenaar681baaf2016-02-04 20:57:07 +0100357 \ end=+`+ contains=TOP,zshOldSubst fold
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000358
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200359syn sync minlines=50 maxlines=90
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000360syn sync match zshHereDocSync grouphere NONE '<<-\=\s*\%(\\\=\S\+\|\(["']\)\S\+\1\)'
361syn sync match zshHereDocEndSync groupthere NONE '^\s*EO\a\+\>'
362
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000363hi def link zshTodo Todo
364hi def link zshComment Comment
365hi def link zshPreProc PreProc
366hi def link zshQuoted SpecialChar
367hi def link zshString String
368hi def link zshStringDelimiter zshString
369hi def link zshPOSIXString zshString
370hi def link zshJobSpec Special
371hi def link zshPrecommand Special
372hi def link zshDelimiter Keyword
373hi def link zshConditional Conditional
374hi def link zshException Exception
375hi def link zshRepeat Repeat
376hi def link zshKeyword Keyword
377hi def link zshFunction None
378hi def link zshKSHFunction zshFunction
379hi def link zshHereDoc String
Bram Moolenaarf2571c62015-06-09 19:44:55 +0200380hi def link zshOperator None
381hi def link zshRedir Operator
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000382hi def link zshVariable None
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000383hi def link zshVariableDef zshVariable
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000384hi def link zshDereferencing PreProc
Bram Moolenaar94237492017-04-23 18:40:21 +0200385hi def link zshShortDeref zshDereferencing
386hi def link zshLongDeref zshDereferencing
387hi def link zshDeref zshDereferencing
388hi def link zshDollarVar zshDereferencing
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000389hi def link zshCommands Keyword
Bram Moolenaar94237492017-04-23 18:40:21 +0200390hi def link zshOptStart Keyword
391hi def link zshOption Constant
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000392hi def link zshTypes Type
393hi def link zshSwitches Special
394hi def link zshNumber Number
395hi def link zshSubst PreProc
396hi def link zshMathSubst zshSubst
397hi def link zshOldSubst zshSubst
398hi def link zshSubstDelim zshSubst
Bram Moolenaar94237492017-04-23 18:40:21 +0200399hi def link zshGlob zshSubst
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000400
Bram Moolenaar071d4272004-06-13 20:20:40 +0000401let b:current_syntax = "zsh"
402
Bram Moolenaarc81e5e72007-05-05 18:24:42 +0000403let &cpo = s:cpo_save
404unlet s:cpo_save