Mercurial > vim
comparison runtime/syntax/sh.vim @ 7228:873eae260c97
commit https://github.com/vim/vim/commit/b4ff518d95aa57c2f8c0568c915035bef849581b
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 10 21:15:48 2015 +0100
Updated runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 10 Nov 2015 21:30:05 +0100 |
parents | 30042ddff503 |
children | 8896150aba23 |
comparison
equal
deleted
inserted
replaced
7227:28f3b34d076f | 7228:873eae260c97 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: shell (sh) Korn shell (ksh) bash (sh) | 2 " Language: shell (sh) Korn shell (ksh) bash (sh) |
3 " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> | 3 " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> |
4 " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> | 4 " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> |
5 " Last Change: Oct 09, 2015 | 5 " Last Change: Oct 21, 2015 |
6 " Version: 139 | 6 " Version: 141 |
7 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH | 7 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH |
8 " For options and settings, please use: :help ft-sh-syntax | 8 " For options and settings, please use: :help ft-sh-syntax |
9 " This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr) | 9 " This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) |
10 | 10 |
11 " For version 5.x: Clear all syntax items {{{1 | 11 " For version 5.x: Clear all syntax items {{{1 |
12 " For version 6.x: Quit when a syntax file was already loaded | 12 " For version 6.x: Quit when a syntax file was already loaded |
13 if version < 600 | 13 if version < 600 |
14 syntax clear | 14 syntax clear |
15 elseif exists("b:current_syntax") | 15 elseif exists("b:current_syntax") |
16 finish | 16 finish |
17 endif | |
18 | |
19 " AFAICT "." should be considered part of the iskeyword for ksh. Using iskeywords | |
20 " in syntax is dicey, so the following code permits the user to prevent/override | |
21 " g:sh_isk set to a string : specify iskeyword. | |
22 " g:sh_noisk exists : don't change iskeyword | |
23 " g:sh_noisk does not exist : (default) append "." to iskeyword for kornshell | |
24 if exists("g:sh_isk") && type(g:sh_isk) == 1 " user specifying iskeyword | |
25 exe "setl isk=".g:sh_isk | |
26 elseif !exists("g:sh_noisk") && exists("b:is_kornshell") " append '.' to iskeyword | |
27 setl isk+=. | |
28 endif | 17 endif |
29 | 18 |
30 " trying to answer the question: which shell is /bin/sh, really? | 19 " trying to answer the question: which shell is /bin/sh, really? |
31 " If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess. | 20 " If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess. |
32 if !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh") | 21 if !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh") |
71 let b:is_sh= 1 | 60 let b:is_sh= 1 |
72 endif | 61 endif |
73 endif | 62 endif |
74 | 63 |
75 " set up default g:sh_fold_enabled {{{1 | 64 " set up default g:sh_fold_enabled {{{1 |
65 " ================================ | |
76 if !exists("g:sh_fold_enabled") | 66 if !exists("g:sh_fold_enabled") |
77 let g:sh_fold_enabled= 0 | 67 let g:sh_fold_enabled= 0 |
78 elseif g:sh_fold_enabled != 0 && !has("folding") | 68 elseif g:sh_fold_enabled != 0 && !has("folding") |
79 let g:sh_fold_enabled= 0 | 69 let g:sh_fold_enabled= 0 |
80 echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support" | 70 echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support" |
91 if g:sh_fold_enabled && &fdm == "manual" | 81 if g:sh_fold_enabled && &fdm == "manual" |
92 " Given that the user provided g:sh_fold_enabled | 82 " Given that the user provided g:sh_fold_enabled |
93 " AND g:sh_fold_enabled is manual (usual default) | 83 " AND g:sh_fold_enabled is manual (usual default) |
94 " implies a desire for syntax-based folding | 84 " implies a desire for syntax-based folding |
95 setl fdm=syntax | 85 setl fdm=syntax |
86 endif | |
87 | |
88 " Set up folding commands for shell {{{1 | |
89 " ================================= | |
90 if s:sh_fold_functions | |
91 com! -nargs=* ShFoldFunctions <args> fold | |
92 else | |
93 com! -nargs=* ShFoldFunctions <args> | |
94 endif | |
95 if s:sh_fold_heredoc | |
96 com! -nargs=* ShFoldHereDoc <args> fold | |
97 else | |
98 com! -nargs=* ShFoldHereDoc <args> | |
99 endif | |
100 if s:sh_fold_ifdofor | |
101 com! -nargs=* ShFoldIfDoFor <args> fold | |
102 else | |
103 com! -nargs=* ShFoldIfDoFor <args> | |
96 endif | 104 endif |
97 | 105 |
98 " sh syntax is case sensitive {{{1 | 106 " sh syntax is case sensitive {{{1 |
99 syn case match | 107 syn case match |
100 | 108 |
124 syn cluster shHereBeginList contains=@shCommandSubList | 132 syn cluster shHereBeginList contains=@shCommandSubList |
125 syn cluster shHereList contains=shBeginHere,shHerePayload | 133 syn cluster shHereList contains=shBeginHere,shHerePayload |
126 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload | 134 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload |
127 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr | 135 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr |
128 syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo | 136 syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo |
129 syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr | 137 syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch |
130 syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator | 138 syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator |
131 syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr | 139 syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr |
140 | |
132 " Echo: {{{1 | 141 " Echo: {{{1 |
133 " ==== | 142 " ==== |
134 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct | 143 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct |
135 syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment | 144 syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment |
136 syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment | 145 syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment |
143 " ===== | 152 " ===== |
144 if exists("b:is_kornshell") || exists("b:is_bash") | 153 if exists("b:is_kornshell") || exists("b:is_bash") |
145 syn match shStatement "\<alias\>" | 154 syn match shStatement "\<alias\>" |
146 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+\)\@=" skip="\\$" end="\>\|`" | 155 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+\)\@=" skip="\\$" end="\>\|`" |
147 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+=\)\@=" skip="\\$" end="=" | 156 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+=\)\@=" skip="\\$" end="=" |
157 | |
158 " Touch: {{{1 | |
159 " ===== | |
160 syn match shTouch '\<touch\>[^;#]*' skipwhite nextgroup=shTouchList contains=shTouchCmd | |
161 syn match shTouchCmd '\<touch\>' contained | |
148 endif | 162 endif |
149 | 163 |
150 " Error Codes: {{{1 | 164 " Error Codes: {{{1 |
151 " ============ | 165 " ============ |
152 if !exists("g:sh_no_error") | 166 if !exists("g:sh_no_error") |
191 | 205 |
192 " Tests: {{{1 | 206 " Tests: {{{1 |
193 "======= | 207 "======= |
194 syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial | 208 syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial |
195 syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1 | 209 syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1 |
210 syn region shNoQuote start='\S' skip='\%(\\\\\)*\\.' end='\ze\s' contained | |
196 syn match shTestOpr contained '[^-+/%]\zs=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern | 211 syn match shTestOpr contained '[^-+/%]\zs=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern |
197 syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" | 212 syn match shTestOpr contained "<=\|>=\|!=\|==\|=\~\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" |
198 syn match shTestPattern contained '\w\+' | 213 syn match shTestPattern contained '\w\+' |
199 syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' | 214 syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' |
200 syn match shTestSingleQuote contained '\\.' | 215 syn match shTestSingleQuote contained '\\.' |
201 syn match shTestSingleQuote contained "'[^']*'" | 216 syn match shTestSingleQuote contained "'[^']*'" |
202 if exists("b:is_kornshell") || exists("b:is_bash") | 217 if exists("b:is_kornshell") || exists("b:is_bash") |
203 syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList,shComment | 218 syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\%(\\\\\)*\\$+ end="\]\]" contains=@shTestList,shNoQuote,shComment |
204 syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList,shComment | 219 syn region shDblParen matchgroup=Delimiter start="((" skip=+\%(\\\\\)*\\$+ end="))" contains=@shTestList,shComment |
205 endif | 220 endif |
206 | 221 |
207 " Character Class In Range: {{{1 | 222 " Character Class In Range: {{{1 |
208 " ========================= | 223 " ========================= |
209 syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]" | 224 syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]" |
210 | 225 |
211 " Loops: do, if, while, until {{{1 | 226 " Loops: do, if, while, until {{{1 |
212 " ====== | 227 " ====== |
213 if s:sh_fold_ifdofor | 228 ShFoldIfDoFor syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList |
214 syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList | 229 ShFoldIfDoFor syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList |
215 syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList | 230 ShFoldIfDoFor syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn |
216 syn region shFor fold matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn | 231 ShFoldIfDoFor syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr |
217 syn region shForPP fold matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr | 232 |
218 else | |
219 syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList | |
220 syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList | |
221 syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn | |
222 syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr | |
223 endif | |
224 if exists("b:is_kornshell") || exists("b:is_bash") | 233 if exists("b:is_kornshell") || exists("b:is_bash") |
225 syn cluster shCaseList add=shRepeat | 234 syn cluster shCaseList add=shRepeat |
226 syn cluster shFunctionList add=shRepeat | 235 syn cluster shFunctionList add=shRepeat |
227 syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace | 236 syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace |
228 syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace | 237 syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace |
236 | 245 |
237 " Case: case...esac {{{1 | 246 " Case: case...esac {{{1 |
238 " ==== | 247 " ==== |
239 syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote | 248 syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote |
240 syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar | 249 syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar |
241 if s:sh_fold_ifdofor | 250 ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment |
242 syn region shCase fold contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment | 251 ShFoldIfDoFor syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList |
243 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList | 252 |
244 else | |
245 syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment | |
246 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList | |
247 endif | |
248 syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote | 253 syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote |
249 if exists("b:is_bash") | 254 if exists("b:is_bash") |
250 syn region shCaseExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained | 255 syn region shCaseExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained |
251 elseif !exists("g:sh_no_error") | 256 elseif !exists("g:sh_no_error") |
252 syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained | 257 syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained |
284 | 289 |
285 if exists("b:is_bash") | 290 if exists("b:is_bash") |
286 syn cluster shCommandSubList add=bashSpecialVariables,bashStatement | 291 syn cluster shCommandSubList add=bashSpecialVariables,bashStatement |
287 syn cluster shCaseList add=bashAdminStatement,bashStatement | 292 syn cluster shCaseList add=bashAdminStatement,bashStatement |
288 syn keyword bashSpecialVariables contained auto_resume BASH BASH_ALIASES BASH_ALIASES BASH_ARGC BASH_ARGC BASH_ARGV BASH_ARGV BASH_CMDS BASH_CMDS BASH_COMMAND BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING BASH_EXECUTION_STRING BASH_LINENO BASH_LINENO BASHOPTS BASHOPTS BASHPID BASHPID BASH_REMATCH BASH_REMATCH BASH_SOURCE BASH_SOURCE BASH_SUBSHELL BASH_SUBSHELL BASH_VERSINFO BASH_VERSION BASH_XTRACEFD BASH_XTRACEFD CDPATH COLUMNS COLUMNS COMP_CWORD COMP_CWORD COMP_KEY COMP_KEY COMP_LINE COMP_LINE COMP_POINT COMP_POINT COMPREPLY COMPREPLY COMP_TYPE COMP_TYPE COMP_WORDBREAKS COMP_WORDBREAKS COMP_WORDS COMP_WORDS COPROC COPROC DIRSTACK EMACS EMACS ENV ENV EUID FCEDIT FIGNORE FUNCNAME FUNCNAME FUNCNEST FUNCNEST GLOBIGNORE GROUPS histchars HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFORMAT HISTTIMEFORMAT HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_CTYPE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_NUMERIC LINENO LINES LINES MACHTYPE MAIL MAILCHECK MAILPATH MAPFILE MAPFILE OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS POSIXLY_CORRECT POSIXLY_CORRECT PPID PROMPT_COMMAND PS1 PS2 PS3 PS4 PWD RANDOM READLINE_LINE READLINE_LINE READLINE_POINT READLINE_POINT REPLY SECONDS SHELL SHELL SHELLOPTS SHLVL TIMEFORMAT TIMEOUT TMPDIR TMPDIR UID | 293 syn keyword bashSpecialVariables contained auto_resume BASH BASH_ALIASES BASH_ALIASES BASH_ARGC BASH_ARGC BASH_ARGV BASH_ARGV BASH_CMDS BASH_CMDS BASH_COMMAND BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING BASH_EXECUTION_STRING BASH_LINENO BASH_LINENO BASHOPTS BASHOPTS BASHPID BASHPID BASH_REMATCH BASH_REMATCH BASH_SOURCE BASH_SOURCE BASH_SUBSHELL BASH_SUBSHELL BASH_VERSINFO BASH_VERSION BASH_XTRACEFD BASH_XTRACEFD CDPATH COLUMNS COLUMNS COMP_CWORD COMP_CWORD COMP_KEY COMP_KEY COMP_LINE COMP_LINE COMP_POINT COMP_POINT COMPREPLY COMPREPLY COMP_TYPE COMP_TYPE COMP_WORDBREAKS COMP_WORDBREAKS COMP_WORDS COMP_WORDS COPROC COPROC DIRSTACK EMACS EMACS ENV ENV EUID FCEDIT FIGNORE FUNCNAME FUNCNAME FUNCNEST FUNCNEST GLOBIGNORE GROUPS histchars HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFORMAT HISTTIMEFORMAT HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_CTYPE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_NUMERIC LINENO LINES LINES MACHTYPE MAIL MAILCHECK MAILPATH MAPFILE MAPFILE OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS POSIXLY_CORRECT POSIXLY_CORRECT PPID PROMPT_COMMAND PS1 PS2 PS3 PS4 PWD RANDOM READLINE_LINE READLINE_LINE READLINE_POINT READLINE_POINT REPLY SECONDS SHELL SHELL SHELLOPTS SHLVL TIMEFORMAT TIMEOUT TMPDIR TMPDIR UID |
289 syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch | 294 syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail |
290 syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop | 295 syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop |
291 syn keyword bashStatement command compgen | 296 syn keyword bashStatement command compgen |
292 endif | 297 endif |
293 | 298 |
294 if exists("b:is_kornshell") | 299 if exists("b:is_kornshell") |
295 syn cluster shCommandSubList add=kshSpecialVariables,kshStatement | 300 syn cluster shCommandSubList add=kshSpecialVariables,kshStatement |
296 syn cluster shCaseList add=kshStatement | 301 syn cluster shCaseList add=kshStatement |
297 syn keyword kshSpecialVariables contained CDPATH COLUMNS EDITOR ENV ERRNO FCEDIT FPATH HISTFILE HISTSIZE HOME IFS LINENO LINES MAIL MAILCHECK MAILPATH OLDPWD OPTARG OPTIND PATH PPID PS1 PS2 PS3 PS4 PWD RANDOM REPLY SECONDS SHELL TMOUT VISUAL | 302 syn keyword kshSpecialVariables contained CDPATH COLUMNS EDITOR ENV ERRNO FCEDIT FPATH HISTFILE HISTSIZE HOME IFS LINENO LINES MAIL MAILCHECK MAILPATH OLDPWD OPTARG OPTIND PATH PPID PS1 PS2 PS3 PS4 PWD RANDOM REPLY SECONDS SHELL TMOUT VISUAL |
298 syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail touch tput | 303 syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail tput |
299 syn keyword kshStatement command setgroups setsenv | 304 syn keyword kshStatement command setgroups setsenv |
300 endif | 305 endif |
301 | 306 |
302 syn match shSource "^\.\s" | 307 syn match shSource "^\.\s" |
303 syn match shSource "\s\.\s" | 308 syn match shSource "\s\.\s" |
321 endif | 326 endif |
322 syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell | 327 syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell |
323 syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell | 328 syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell |
324 syn match shStringSpecial "[^[:print:] \t]" contained | 329 syn match shStringSpecial "[^[:print:] \t]" contained |
325 syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" | 330 syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" |
326 " COMBAK: why is ,shComment on next line??? | |
327 syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" | 331 syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" |
328 syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" | 332 syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" |
329 syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained | 333 syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained |
330 | 334 |
331 " Comments: {{{1 | 335 " Comments: {{{1 |
345 syn region shHereDoc matchgroup=shHereDoc03 start="<<\s*\**EOF\**" matchgroup=shHereDoc03 end="^EOF$" contains=@shDblQuoteList | 349 syn region shHereDoc matchgroup=shHereDoc03 start="<<\s*\**EOF\**" matchgroup=shHereDoc03 end="^EOF$" contains=@shDblQuoteList |
346 syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*\**EOF\**" matchgroup=shHereDoc04 end="^\s*EOF$" contains=@shDblQuoteList | 350 syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*\**EOF\**" matchgroup=shHereDoc04 end="^\s*EOF$" contains=@shDblQuoteList |
347 syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*\**\.\**" matchgroup=shHereDoc05 end="^\.$" contains=@shDblQuoteList | 351 syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*\**\.\**" matchgroup=shHereDoc05 end="^\.$" contains=@shDblQuoteList |
348 syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\**\.\**" matchgroup=shHereDoc06 end="^\s*\.$" contains=@shDblQuoteList | 352 syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\**\.\**" matchgroup=shHereDoc06 end="^\s*\.$" contains=@shDblQuoteList |
349 | 353 |
350 elseif s:sh_fold_heredoc | 354 else |
351 syn region shHereDoc matchgroup=shHereDoc07 fold start="<<\s*\z([^ \t|]*\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList | 355 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\=\z([^ \t|]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList |
352 syn region shHereDoc matchgroup=shHereDoc08 fold start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc08 end="^\z1\s*$" | 356 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc08 end="^\z1\s*$" |
353 syn region shHereDoc matchgroup=shHereDoc09 fold start="<<\s*'\z([^ \t|]*\)'" matchgroup=shHereDoc09 end="^\z1\s*$" | 357 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<-\s*\z([^ \t|]\+\)" matchgroup=shHereDoc09 end="^\s*\z1\s*$" contains=@shDblQuoteList |
354 syn region shHereDoc matchgroup=shHereDoc10 fold start="<<-\s*\z([^ \t|]*\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" contains=@shDblQuoteList | 358 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc10 end="^\s*\z1\s*$" |
355 syn region shHereDoc matchgroup=shHereDoc11 fold start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc11 end="^\s*\z1\s*$" | 359 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<\s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc11 end="^\z1\s*$" |
356 syn region shHereDoc matchgroup=shHereDoc12 fold start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" | 360 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc12 end="^\s*\z1\s*$" |
357 syn region shHereDoc matchgroup=shHereDoc13 fold start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shHereDoc13 end="^\z1\s*$" | 361 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<\s*\\\_$\_s*\z([^ \t|]\+\)" matchgroup=shHereDoc13 end="^\z1\s*$" contains=@shDblQuoteList |
358 syn region shHereDoc matchgroup=shHereDoc14 fold start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc14 end="^\z1\s*$" | 362 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\s*\\\_$\_s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc14 end="^\z1\s*$" |
359 syn region shHereDoc matchgroup=shHereDoc15 fold start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shHereDoc15 end="^\s*\z1\s*$" | 363 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<\s*\\\_$\_s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc15 end="^\z1\s*$" |
360 syn region shHereDoc matchgroup=shHereDoc16 fold start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shHereDoc16 end="^\s*\z1\s*$" | 364 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\_$\_s*\z([^ \t|]\+\)" matchgroup=shHereDoc16 end="^\s*\z1\s*$" |
361 syn region shHereDoc matchgroup=shHereDoc17 fold start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc17 end="^\s*\z1\s*$" | 365 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc17 start="<<-\s*\\\_$\_s*\\\z([^ \t|]\+\)" matchgroup=shHereDoc17 end="^\s*\z1\s*$" |
362 syn region shHereDoc matchgroup=shHereDoc18 fold start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shHereDoc18 end="^\z1\s*$" | 366 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc18 start="<<-\s*\\\_$\_s*'\z([^ \t|]\+\)'" matchgroup=shHereDoc18 end="^\s*\z1\s*$" |
363 syn region shHereDoc matchgroup=shHereDoc19 fold start="<<\\\z([^ \t|]*\)" matchgroup=shHereDoc19 end="^\z1\s*$" | 367 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc19 start="<<-\s*\\\_$\_s*\"\z([^ \t|]\+\)\"" matchgroup=shHereDoc19 end="^\s*\z1\s*$" |
364 | 368 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc20 start="<<\\\z([^ \t|]\+\)" matchgroup=shHereDoc20 end="^\z1\s*$" |
365 else | 369 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc21 start="<<-\s*\\\z([^ \t|]\+\)" matchgroup=shHereDoc21 end="^\s*\z1\s*$" |
366 syn region shHereDoc matchgroup=shHereDoc20 start="<<\s*\\\=\z([^ \t|]*\)" matchgroup=shHereDoc20 end="^\z1\s*$" contains=@shDblQuoteList | |
367 syn region shHereDoc matchgroup=shHereDoc21 start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc21 end="^\z1\s*$" | |
368 syn region shHereDoc matchgroup=shHereDoc22 start="<<-\s*\z([^ \t|]*\)" matchgroup=shHereDoc22 end="^\s*\z1\s*$" contains=@shDblQuoteList | |
369 syn region shHereDoc matchgroup=shHereDoc23 start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shHereDoc23 end="^\s*\z1\s*$" | |
370 syn region shHereDoc matchgroup=shHereDoc24 start="<<\s*'\z([^ \t|]*\)'" matchgroup=shHereDoc24 end="^\z1\s*$" | |
371 syn region shHereDoc matchgroup=shHereDoc25 start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc25 end="^\s*\z1\s*$" | |
372 syn region shHereDoc matchgroup=shHereDoc26 start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shHereDoc26 end="^\z1\s*$" | |
373 syn region shHereDoc matchgroup=shHereDoc27 start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shHereDoc27 end="^\s*\z1\s*$" | |
374 syn region shHereDoc matchgroup=shHereDoc28 start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shHereDoc28 end="^\s*\z1\s*$" | |
375 syn region shHereDoc matchgroup=shHereDoc29 start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shHereDoc29 end="^\z1\s*$" | |
376 syn region shHereDoc matchgroup=shHereDoc30 start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc30 end="^\z1\s*$" | |
377 syn region shHereDoc matchgroup=shHereDoc31 start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shHereDoc31 end="^\s*\z1\s*$" | |
378 syn region shHereDoc matchgroup=shHereDoc32 start="<<\\\z([^ \t|]*\)" matchgroup=shHereDoc32 end="^\z1\s*$" | |
379 endif | 370 endif |
380 | 371 |
381 " Here Strings: {{{1 | 372 " Here Strings: {{{1 |
382 " ============= | 373 " ============= |
383 " available for: bash; ksh (really should be ksh93 only) but not if its a posix | 374 " available for: bash; ksh (really should be ksh93 only) but not if its a posix |
405 if !exists("g:is_posix") | 396 if !exists("g:is_posix") |
406 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo | 397 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo |
407 endif | 398 endif |
408 | 399 |
409 if exists("b:is_bash") | 400 if exists("b:is_bash") |
410 if s:sh_fold_functions | 401 ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
411 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 402 ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
412 syn region shFunctionTwo fold matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 403 ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
413 syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 404 ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
414 syn region shFunctionFour fold matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 405 else |
415 else | 406 ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
416 syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList | 407 ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
417 syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained | 408 ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
418 syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList | 409 ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
419 syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained | |
420 endif | |
421 else | |
422 if s:sh_fold_functions | |
423 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | |
424 syn region shFunctionTwo fold matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | |
425 syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | |
426 syn region shFunctionFour fold matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | |
427 else | |
428 syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList | |
429 syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained | |
430 syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList | |
431 syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained | |
432 endif | |
433 endif | 410 endif |
434 | 411 |
435 " Parameter Dereferencing: {{{1 | 412 " Parameter Dereferencing: {{{1 |
436 " ======================== | 413 " ======================== |
437 syn match shDerefSimple "\$\%(\k\+\|\d\)" | |
438 syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray | |
439 if !exists("g:sh_no_error") | 414 if !exists("g:sh_no_error") |
440 syn match shDerefWordError "[^}$[]" contained | 415 syn match shDerefWordError "[^}$[]" contained |
441 endif | 416 endif |
417 syn match shDerefSimple "\$\k\+\|\d" | |
418 syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray | |
442 syn match shDerefSimple "\$[-#*@!?]" | 419 syn match shDerefSimple "\$[-#*@!?]" |
443 syn match shDerefSimple "\$\$" | 420 syn match shDerefSimple "\$\$" |
444 if exists("b:is_bash") || exists("b:is_kornshell") | 421 if exists("b:is_bash") || exists("b:is_kornshell") |
445 syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList | 422 syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList |
446 syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList | 423 syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList |
447 endif | 424 endif |
448 | 425 |
426 " ksh: ${!var[*]} array index list syntax: {{{1 | |
427 " ======================================== | |
428 if exists("b:is_kornshell") | |
429 syn region shDeref matchgroup=PreProc start="\${!" end="}" contains=@shDerefVarArray | |
430 endif | |
431 | |
449 " bash: ${!prefix*} and ${#parameter}: {{{1 | 432 " bash: ${!prefix*} and ${#parameter}: {{{1 |
450 " ==================================== | 433 " ==================================== |
451 if exists("b:is_bash") | 434 if exists("b:is_bash") |
452 syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp | 435 syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp |
453 syn match shDerefVar contained "{\@<=!\k\+" nextgroup=@shDerefVarList | 436 syn match shDerefVar contained "{\@<=!\k\+" nextgroup=@shDerefVarList |
437 endif | |
438 if exists("b:is_kornshell") | |
439 syn match shDerefVar contained "{\@<=!\k[[:alnum:]_.]*" nextgroup=@shDerefVarList | |
454 endif | 440 endif |
455 | 441 |
456 syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError | 442 syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError |
457 syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp | 443 syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp |
458 syn match shDerefVar contained "{\@<=\k\+" nextgroup=@shDerefVarList | 444 syn match shDerefVar contained "{\@<=\k\+" nextgroup=@shDerefVarList |
445 if exists("b:is_kornshell") | |
446 syn match shDerefVar contained "{\@<=\k[[:alnum:]_.]*" nextgroup=@shDerefVarList | |
447 endif | |
459 | 448 |
460 " sh ksh bash : ${var[... ]...} array reference: {{{1 | 449 " sh ksh bash : ${var[... ]...} array reference: {{{1 |
461 syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError | 450 syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError |
462 | 451 |
463 " Special ${parameter OPERATOR word} handling: {{{1 | 452 " Special ${parameter OPERATOR word} handling: {{{1 |
592 hi def link shFunction Function | 581 hi def link shFunction Function |
593 hi def link shHereDoc shString | 582 hi def link shHereDoc shString |
594 hi def link shHerePayload shHereDoc | 583 hi def link shHerePayload shHereDoc |
595 hi def link shLoop shStatement | 584 hi def link shLoop shStatement |
596 hi def link shMoreSpecial shSpecial | 585 hi def link shMoreSpecial shSpecial |
586 hi def link shNoQuote shDoubleQuote | |
597 hi def link shOption shCommandSub | 587 hi def link shOption shCommandSub |
598 hi def link shPattern shString | 588 hi def link shPattern shString |
599 hi def link shParen shArithmetic | 589 hi def link shParen shArithmetic |
600 hi def link shPosnParm shShellVariables | 590 hi def link shPosnParm shShellVariables |
601 hi def link shQuickComment shComment | 591 hi def link shQuickComment shComment |
609 hi def link shSubShRegion shOperator | 599 hi def link shSubShRegion shOperator |
610 hi def link shTestOpr shConditional | 600 hi def link shTestOpr shConditional |
611 hi def link shTestPattern shString | 601 hi def link shTestPattern shString |
612 hi def link shTestDoubleQuote shString | 602 hi def link shTestDoubleQuote shString |
613 hi def link shTestSingleQuote shString | 603 hi def link shTestSingleQuote shString |
604 hi def link shTouchCmd shStatement | |
614 hi def link shVariable shSetList | 605 hi def link shVariable shSetList |
615 hi def link shWrapLineOperator shOperator | 606 hi def link shWrapLineOperator shOperator |
616 | 607 |
617 if exists("b:is_bash") | 608 if exists("b:is_bash") |
618 hi def link bashAdminStatement shStatement | 609 hi def link bashAdminStatement shStatement |
686 hi def link shHereDoc17 shRedir | 677 hi def link shHereDoc17 shRedir |
687 hi def link shHereDoc18 shRedir | 678 hi def link shHereDoc18 shRedir |
688 hi def link shHereDoc19 shRedir | 679 hi def link shHereDoc19 shRedir |
689 hi def link shHereDoc20 shRedir | 680 hi def link shHereDoc20 shRedir |
690 hi def link shHereDoc21 shRedir | 681 hi def link shHereDoc21 shRedir |
691 hi def link shHereDoc22 shRedir | 682 |
692 hi def link shHereDoc23 shRedir | 683 " Delete shell folding commands {{{1 |
693 hi def link shHereDoc24 shRedir | 684 " ============================= |
694 hi def link shHereDoc25 shRedir | 685 delc ShFoldFunctions |
695 hi def link shHereDoc26 shRedir | 686 delc ShFoldHereDoc |
696 hi def link shHereDoc27 shRedir | 687 delc ShFoldIfDoFor |
697 hi def link shHereDoc28 shRedir | |
698 hi def link shHereDoc29 shRedir | |
699 hi def link shHereDoc30 shRedir | |
700 hi def link shHereDoc31 shRedir | |
701 hi def link shHereDoc32 shRedir | |
702 | 688 |
703 " Set Current Syntax: {{{1 | 689 " Set Current Syntax: {{{1 |
704 " =================== | 690 " =================== |
705 if exists("b:is_bash") | 691 if exists("b:is_bash") |
706 let b:current_syntax = "bash" | 692 let b:current_syntax = "bash" |