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