xref: /vim-8.2.3635/runtime/syntax/sh.vim (revision 91c4937b)
1" Vim syntax file
2" Language:		shell (sh) Korn shell (ksh) bash (sh)
3" Maintainer:		Charles E. Campbell  <[email protected]>
4" Previous Maintainer:	Lennart Schultz <[email protected]>
5" Last Change:		May 02, 2016
6" Version:		151
7" URL:		http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
8" For options and settings, please use:      :help ft-sh-syntax
9" This file includes many ideas from Eric Brunet ([email protected])
10
11" For version 5.x: Clear all syntax items {{{1
12" For version 6.x: Quit when a syntax file was already loaded
13if version < 600
14  syntax clear
15elseif exists("b:current_syntax")
16  finish
17endif
18
19" trying to answer the question: which shell is /bin/sh, really?
20" If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess.
21if getline(1) =~ '\<ksh$'
22 let b:is_kornshell = 1
23elseif getline(1) =~ '\<bash$'
24 let b:is_bash      = 1
25elseif getline(1) =~ '\<dash$'
26 let b:is_posix     = 1
27elseif !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh")
28 let s:shell = ""
29 if executable("/bin/sh")
30  let s:shell = resolve("/bin/sh")
31 elseif executable("/usr/bin/sh")
32  let s:shell = resolve("/usr/bin/sh")
33 endif
34 if     s:shell =~ 'ksh$'
35  let b:is_kornshell= 1
36 elseif s:shell =~ 'bash$'
37  let b:is_bash = 1
38 elseif s:shell =~ 'dash$'
39  let b:is_posix = 1
40 endif
41 unlet s:shell
42endif
43
44" handling /bin/sh with is_kornshell/is_sh {{{1
45" b:is_sh is set when "#! /bin/sh" is found;
46" However, it often is just a masquerade by bash (typically Linux)
47" or kornshell (typically workstations with Posix "sh").
48" So, when the user sets "g:is_bash", "g:is_kornshell",
49" or "g:is_posix", a b:is_sh is converted into b:is_bash/b:is_kornshell,
50" respectively.
51if !exists("b:is_kornshell") && !exists("b:is_bash")
52  if exists("g:is_posix") && !exists("g:is_kornshell")
53   let g:is_kornshell= g:is_posix
54  endif
55  if exists("g:is_kornshell")
56    let b:is_kornshell= 1
57    if exists("b:is_sh")
58      unlet b:is_sh
59    endif
60  elseif exists("g:is_bash")
61    let b:is_bash= 1
62    if exists("b:is_sh")
63      unlet b:is_sh
64    endif
65  else
66    let b:is_sh= 1
67  endif
68endif
69
70" set up default g:sh_fold_enabled {{{1
71" ================================
72if !exists("g:sh_fold_enabled")
73 let g:sh_fold_enabled= 0
74elseif g:sh_fold_enabled != 0 && !has("folding")
75 let g:sh_fold_enabled= 0
76 echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support"
77endif
78if !exists("s:sh_fold_functions")
79 let s:sh_fold_functions= and(g:sh_fold_enabled,1)
80endif
81if !exists("s:sh_fold_heredoc")
82 let s:sh_fold_heredoc  = and(g:sh_fold_enabled,2)
83endif
84if !exists("s:sh_fold_ifdofor")
85 let s:sh_fold_ifdofor  = and(g:sh_fold_enabled,4)
86endif
87if g:sh_fold_enabled && &fdm == "manual"
88 " Given that	the	user provided g:sh_fold_enabled
89 " 	AND	g:sh_fold_enabled is manual (usual default)
90 " 	implies	a desire for syntax-based folding
91 setl fdm=syntax
92endif
93
94" set up the syntax-highlighting iskeyword
95if has("patch-7.4.1142")
96 if exists("b:is_bash")
97  exe "syn iskeyword ".&iskeyword.",-,:"
98 else
99  exe "syn iskeyword ".&iskeyword.",-"
100 endif
101endif
102
103" Set up folding commands for shell {{{1
104" =================================
105if s:sh_fold_functions
106 com! -nargs=* ShFoldFunctions <args> fold
107else
108 com! -nargs=* ShFoldFunctions <args>
109endif
110if s:sh_fold_heredoc
111 com! -nargs=* ShFoldHereDoc <args> fold
112else
113 com! -nargs=* ShFoldHereDoc <args>
114endif
115if s:sh_fold_ifdofor
116 com! -nargs=* ShFoldIfDoFor <args> fold
117else
118 com! -nargs=* ShFoldIfDoFor <args>
119endif
120
121" sh syntax is case sensitive {{{1
122syn case match
123
124" Clusters: contains=@... clusters {{{1
125"==================================
126syn cluster shErrorList	contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError,shOK
127if exists("b:is_kornshell")
128 syn cluster ErrorList add=shDTestError
129endif
130syn cluster shArithParenList	contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor
131syn cluster shArithList	contains=@shArithParenList,shParenError
132syn cluster shCaseEsacList	contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
133syn cluster shCaseList	contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
134syn cluster shCommandSubList	contains=shAlias,shArithmetic,shComment,shCmdParenRegion,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shOption,shPosnParm,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
135syn cluster shCurlyList	contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
136syn cluster shDblQuoteList	contains=shCommandSub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial
137syn cluster shDerefList	contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS
138syn cluster shDerefVarList	contains=shDerefOp,shDerefVarArray,shDerefOpError
139syn cluster shEchoList	contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shEscape,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
140syn cluster shExprList1	contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq
141syn cluster shExprList2	contains=@shExprList1,@shCaseList,shTest
142syn cluster shFunctionList	contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
143if exists("b:is_kornshell") || exists("b:is_bash")
144 syn cluster shFunctionList	add=shRepeat
145 syn cluster shFunctionList	add=shDblBrace,shDblParen
146endif
147syn cluster shHereBeginList	contains=@shCommandSubList
148syn cluster shHereList	contains=shBeginHere,shHerePayload
149syn cluster shHereListDQ	contains=shBeginHere,@shDblQuoteList,shHerePayload
150syn cluster shIdList	contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
151syn cluster shIfList	contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
152syn cluster shLoopList	contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch
153syn cluster shPPSRightList	contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm
154syn cluster shSubShList	contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
155syn cluster shTestList	contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
156
157" Echo: {{{1
158" ====
159" This one is needed INSIDE a CommandSub, so that `echo bla` be correct
160syn 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
161syn 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
162syn match  shEchoQuote contained	'\%(\\\\\)*\\["`'()]'
163
164" This must be after the strings, so that ... \" will be correct
165syn region shEmbeddedEcho contained 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=shNumber,shExSingleQuote,shSingleQuote,shDeref,shDerefSimple,shSpecialVar,shOperator,shExDoubleQuote,shDoubleQuote,shCharClass,shCtrlSeq
166
167" Alias: {{{1
168" =====
169if exists("b:is_kornshell") || exists("b:is_bash")
170 syn match shStatement "\<alias\>"
171 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+\)\@="  skip="\\$" end="\>\|`"
172 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+=\)\@=" skip="\\$" end="="
173
174 " Touch: {{{1
175 " =====
176 syn match shTouch	'\<touch\>[^;#]*'	skipwhite nextgroup=shTouchList contains=shTouchCmd
177 syn match shTouchCmd	'\<touch\>'		contained
178endif
179
180" Error Codes: {{{1
181" ============
182if !exists("g:sh_no_error")
183 syn match   shDoError "\<done\>"
184 syn match   shIfError "\<fi\>"
185 syn match   shInError "\<in\>"
186 syn match   shCaseError ";;"
187 syn match   shEsacError "\<esac\>"
188 syn match   shCurlyError "}"
189 syn match   shParenError ")"
190 syn match   shOK	'\.\(done\|fi\|in\|esac\)'
191 if exists("b:is_kornshell")
192  syn match     shDTestError "]]"
193 endif
194 syn match     shTestError "]"
195endif
196
197" Options: {{{1
198" ====================
199syn match   shOption	"\s\zs[-+][-_a-zA-Z#@]\+"
200syn match   shOption	"\s\zs--[^ \t$`'"|);]\+"
201
202" File Redirection Highlighted As Operators: {{{1
203"===========================================
204syn match      shRedir	"\d\=>\(&[-0-9]\)\="
205syn match      shRedir	"\d\=>>-\="
206syn match      shRedir	"\d\=<\(&[-0-9]\)\="
207syn match      shRedir	"\d<<-\="
208
209" Operators: {{{1
210" ==========
211syn match   shOperator	"<<\|>>"		contained
212syn match   shOperator	"[!&;|]"		contained
213syn match   shOperator	"\[[[^:]\|\]]"		contained
214syn match   shOperator	"[-=/*+%]\=="		skipwhite nextgroup=shPattern
215syn match   shPattern	"\<\S\+\())\)\@="	contained contains=shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shDeref
216
217" Subshells: {{{1
218" ==========
219syn region shExpr  transparent matchgroup=shExprRegion  start="{" end="}"		contains=@shExprList2 nextgroup=shMoreSpecial
220syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")"	contains=@shSubShList nextgroup=shMoreSpecial
221
222" Tests: {{{1
223"=======
224syn region shExpr	matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial
225syn region shTest	transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1
226syn region shNoQuote	start='\S'	skip='\%(\\\\\)*\\.'	end='\ze\s'	contained
227syn match  shAstQuote	contained	'\*\ze"'	nextgroup=shString
228syn match  shTestOpr	contained	'[^-+/%]\zs=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern
229syn match  shTestOpr	contained	"<=\|>=\|!=\|==\|=\~\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]"
230syn match  shTestPattern	contained	'\w\+'
231syn region shTestDoubleQuote	contained	start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"'	contains=shDeref,shDerefSimple,shDerefSpecial
232syn match  shTestSingleQuote	contained	'\\.'
233syn match  shTestSingleQuote	contained	"'[^']*'"
234if exists("b:is_kornshell") || exists("b:is_bash")
235 syn region  shDblBrace matchgroup=Delimiter start="\[\["	skip=+\%(\\\\\)*\\$+ end="\]\]"	contains=@shTestList,shAstQuote,shNoQuote,shComment
236 syn region  shDblParen matchgroup=Delimiter start="(("	skip=+\%(\\\\\)*\\$+ end="))"	contains=@shTestList,shComment
237endif
238
239" Character Class In Range: {{{1
240" =========================
241syn match   shCharClass	contained	"\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]"
242
243" Loops: do, if, while, until {{{1
244" ======
245ShFoldIfDoFor syn region shDo	transparent	matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>"			contains=@shLoopList
246ShFoldIfDoFor syn region shIf	transparent	matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>"	contains=@shIfList
247ShFoldIfDoFor syn region shFor		matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2			contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
248ShFoldIfDoFor syn region shForPP	matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr
249
250if exists("b:is_kornshell") || exists("b:is_bash")
251 syn cluster shCaseList	add=shRepeat
252 syn cluster shFunctionList	add=shRepeat
253 syn region shRepeat   matchgroup=shLoop   start="\<while\_s" end="\<in\_s" end="\<do\>"me=e-2	contains=@shLoopList,shDblParen,shDblBrace
254 syn region shRepeat   matchgroup=shLoop   start="\<until\_s" end="\<in\_s" end="\<do\>"me=e-2	contains=@shLoopList,shDblParen,shDblBrace
255 syn region shCaseEsac matchgroup=shConditional start="\<select\s" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList
256else
257 syn region shRepeat   matchgroup=shLoop   start="\<while\_s" end="\<do\>"me=e-2		contains=@shLoopList
258 syn region shRepeat   matchgroup=shLoop   start="\<until\_s" end="\<do\>"me=e-2		contains=@shLoopList
259endif
260syn region shCurlyIn   contained	matchgroup=Delimiter start="{" end="}" contains=@shCurlyList
261syn match  shComma     contained	","
262
263" Case: case...esac {{{1
264" ====
265syn match   shCaseBar	contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|"		nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
266syn match   shCaseStart	contained skipwhite skipnl "("			nextgroup=shCase,shCaseBar
267ShFoldIfDoFor syn region  shCase	contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)"  end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
268ShFoldIfDoFor syn region  shCaseEsac	matchgroup=shConditional start="\<case\>" end="\<esac\>"	contains=@shCaseEsacList
269
270syn keyword shCaseIn	contained skipwhite skipnl in			nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
271if exists("b:is_bash")
272 syn region  shCaseExSingleQuote	matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+	contains=shStringSpecial,shSpecial	skipwhite skipnl nextgroup=shCaseBar	contained
273elseif !exists("g:sh_no_error")
274 syn region  shCaseExSingleQuote	matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+	contains=shStringSpecial	skipwhite skipnl nextgroup=shCaseBar	contained
275endif
276syn region  shCaseSingleQuote	matchgroup=shQuote start=+'+ end=+'+		contains=shStringSpecial		skipwhite skipnl nextgroup=shCaseBar	contained
277syn region  shCaseDoubleQuote	matchgroup=shQuote start=+"+ skip=+\\\\\|\\.+ end=+"+	contains=@shDblQuoteList,shStringSpecial	skipwhite skipnl nextgroup=shCaseBar	contained
278syn region  shCaseCommandSub	start=+`+ skip=+\\\\\|\\.+ end=+`+		contains=@shCommandSubList		skipwhite skipnl nextgroup=shCaseBar	contained
279if exists("b:is_bash")
280 syn region  shCaseRange	matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+	contained	contains=shCharClass
281 syn match   shCharClass	'\[:\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|word\|or\|xdigit\):\]'			contained
282else
283 syn region  shCaseRange	matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+	contained
284endif
285" Misc: {{{1
286"======
287syn match   shWrapLineOperator "\\$"
288syn region  shCommandSub   start="`" skip="\\\\\|\\." end="`"	contains=@shCommandSubList
289syn match   shEscape	contained	'\%(^\)\@!\%(\\\\\)*\\.'
290
291" $() and $(()): {{{1
292" $(..) is not supported by sh (Bourne shell).  However, apparently
293" some systems (HP?) have as their /bin/sh a (link to) Korn shell
294" (ie. Posix compliant shell).  /bin/ksh should work for those
295" systems too, however, so the following syntax will flag $(..) as
296" an Error under /bin/sh.  By consensus of vimdev'ers!
297if exists("b:is_kornshell") || exists("b:is_bash")
298 syn region shCommandSub matchgroup=shCmdSubRegion start="\$("  skip='\\\\\|\\.' end=")"  contains=@shCommandSubList
299 syn region shArithmetic matchgroup=shArithRegion  start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
300 syn region shArithmetic matchgroup=shArithRegion  start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList
301 syn match  shSkipInitWS contained	"^\s\+"
302elseif !exists("g:sh_no_error")
303 syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
304endif
305syn region shCmdParenRegion matchgroup=shCmdSubRegion start="(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
306
307if exists("b:is_bash")
308 syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
309 syn cluster shCaseList add=bashAdminStatement,bashStatement
310 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
311 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
312 syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
313 syn keyword bashStatement	command compgen
314endif
315
316if exists("b:is_kornshell")
317 syn cluster shCommandSubList add=kshSpecialVariables,kshStatement
318 syn cluster shCaseList add=kshStatement
319 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
320 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
321 syn keyword kshStatement command setgroups setsenv
322endif
323
324syn match   shSource	"^\.\s"
325syn match   shSource	"\s\.\s"
326"syn region  shColon	start="^\s*:" end="$" end="\s#"me=e-2 contains=@shColonList
327"syn region  shColon	start="^\s*\zs:" end="$" end="\s#"me=e-2
328if exists("b:is_kornshell")
329 syn match   shColon	'^\s*\zs:'
330endif
331
332" String And Character Constants: {{{1
333"================================
334syn match   shNumber	"\<\d\+\>#\="
335syn match   shNumber	"-\=\.\=\d\+\>#\="
336syn match   shCtrlSeq	"\\\d\d\d\|\\[abcfnrtv0]"		contained
337if exists("b:is_bash")
338 syn match   shSpecial	"\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]"	contained
339endif
340if exists("b:is_bash")
341 syn region  shExSingleQuote	matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+	contains=shStringSpecial,shSpecial
342 syn region  shExDoubleQuote	matchgroup=shQuote start=+\$"+ skip=+\\\\\|\\.\|\\"+ end=+"+	contains=@shDblQuoteList,shStringSpecial,shSpecial
343elseif !exists("g:sh_no_error")
344 syn region  shExSingleQuote	matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+	contains=shStringSpecial
345 syn region  shExDoubleQuote	matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+	contains=shStringSpecial
346endif
347syn region  shSingleQuote	matchgroup=shQuote start=+'+ end=+'+		contains=@Spell
348syn region  shDoubleQuote	matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+	contains=@shDblQuoteList,shStringSpecial,@Spell
349syn match   shStringSpecial	"[^[:print:] \t]"		contained
350syn match   shStringSpecial	"\%(\\\\\)*\\[\\"'`$()#]"
351syn match   shSpecial	"[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]"
352syn match   shSpecial	"^\%(\\\\\)*\\[\\"'`$()#]"
353syn match   shMoreSpecial	"\%(\\\\\)*\\[\\"'`$()#]"		nextgroup=shMoreSpecial contained
354
355" Comments: {{{1
356"==========
357syn cluster	shCommentGroup	contains=shTodo,@Spell
358syn keyword	shTodo	contained		COMBAK FIXME TODO XXX
359syn match	shComment		"^\s*\zs#.*$"	contains=@shCommentGroup
360syn match	shComment		"\s\zs#.*$"	contains=@shCommentGroup
361syn match	shComment	contained	"#.*$"	contains=@shCommentGroup
362syn match	shQuickComment	contained	"#.*$"
363
364" Here Documents: {{{1
365" =========================================
366if version < 600
367 syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\**END[a-zA-Z_0-9]*\**" 	matchgroup=shHereDoc01 end="^END[a-zA-Z_0-9]*$"	contains=@shDblQuoteList
368 syn region shHereDoc matchgroup=shHereDoc02 start="<<-\s*\**END[a-zA-Z_0-9]*\**"	matchgroup=shHereDoc02 end="^\s*END[a-zA-Z_0-9]*$"	contains=@shDblQuoteList
369 syn region shHereDoc matchgroup=shHereDoc03 start="<<\s*\**EOF\**"		matchgroup=shHereDoc03 end="^EOF$"	contains=@shDblQuoteList
370 syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*\**EOF\**"		matchgroup=shHereDoc04 end="^\s*EOF$"	contains=@shDblQuoteList
371 syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*\**\.\**"		matchgroup=shHereDoc05 end="^\.$"	contains=@shDblQuoteList
372 syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\**\.\**"		matchgroup=shHereDoc06 end="^\s*\.$"	contains=@shDblQuoteList
373
374else
375 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\=\z([^ \t|]\+\)"		matchgroup=shHereDoc07 end="^\z1\s*$"	contains=@shDblQuoteList
376 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\"\z([^ \t|]\+\)\""		matchgroup=shHereDoc08 end="^\z1\s*$"
377 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<-\s*\z([^ \t|]\+\)"		matchgroup=shHereDoc09 end="^\s*\z1\s*$"	contains=@shDblQuoteList
378 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*'\z([^ \t|]\+\)'"		matchgroup=shHereDoc10 end="^\s*\z1\s*$"
379 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<\s*'\z([^ \t|]\+\)'"		matchgroup=shHereDoc11 end="^\z1\s*$"
380 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\"\z([^ \t|]\+\)\""		matchgroup=shHereDoc12 end="^\s*\z1\s*$"
381 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<\s*\\\_$\_s*\z([^ \t|]\+\)"		matchgroup=shHereDoc13 end="^\z1\s*$"           contains=@shDblQuoteList
382 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\s*\\\_$\_s*'\z([^ \t|]\+\)'"	matchgroup=shHereDoc14 end="^\z1\s*$"
383 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<\s*\\\_$\_s*\"\z([^ \t|]\+\)\""	matchgroup=shHereDoc15 end="^\z1\s*$"
384 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\_$\_s*\z([^ \t|]\+\)"	matchgroup=shHereDoc16 end="^\s*\z1\s*$"
385 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc17 start="<<-\s*\\\_$\_s*\\\z([^ \t|]\+\)"	matchgroup=shHereDoc17 end="^\s*\z1\s*$"
386 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc18 start="<<-\s*\\\_$\_s*'\z([^ \t|]\+\)'"	matchgroup=shHereDoc18 end="^\s*\z1\s*$"
387 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc19 start="<<-\s*\\\_$\_s*\"\z([^ \t|]\+\)\""	matchgroup=shHereDoc19 end="^\s*\z1\s*$"
388 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc20 start="<<\\\z([^ \t|]\+\)"		matchgroup=shHereDoc20 end="^\z1\s*$"
389 ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc21 start="<<-\s*\\\z([^ \t|]\+\)"		matchgroup=shHereDoc21 end="^\s*\z1\s*$"
390endif
391
392" Here Strings: {{{1
393" =============
394" available for: bash; ksh (really should be ksh93 only) but not if its a posix
395if exists("b:is_bash") || (exists("b:is_kornshell") && !exists("g:is_posix"))
396 syn match shRedir "<<<"	skipwhite	nextgroup=shCmdParenRegion
397endif
398
399" Identifiers: {{{1
400"=============
401syn match  shSetOption	"\s\zs[-+][a-zA-Z0-9]\+\>"	contained
402syn match  shVariable	"\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze="	nextgroup=shVarAssign
403syn match  shVarAssign	"="		contained	nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote
404syn region shAtExpr	contained	start="@(" end=")" contains=@shIdList
405if exists("b:is_bash")
406 syn region shSetList oneline matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$"	matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|="	contains=@shIdList
407 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|)]\|$"			matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+="	contains=@shIdList
408elseif exists("b:is_kornshell")
409 syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$"		matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]"	contains=@shIdList
410 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="$"				matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]"	contains=@shIdList
411else
412 syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$"		matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]"	contains=@shIdList
413endif
414
415" Functions: {{{1
416if !exists("g:is_posix")
417 syn keyword shFunctionKey function	skipwhite skipnl nextgroup=shFunctionTwo
418endif
419
420if exists("b:is_bash")
421 ShFoldFunctions syn region shFunctionOne	matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*{"		end="}"	contains=@shFunctionList		 skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
422 ShFoldFunctions syn region shFunctionTwo	matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*{"	end="}"	contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
423 ShFoldFunctions syn region shFunctionThree	matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*("		end=")"	contains=@shFunctionList		 skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
424 ShFoldFunctions syn region shFunctionFour	matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*)"	end=")"	contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
425else
426 ShFoldFunctions syn region shFunctionOne	matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{"			end="}"	contains=@shFunctionList		 skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
427 ShFoldFunctions syn region shFunctionTwo	matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*{"		end="}"	contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
428 ShFoldFunctions syn region shFunctionThree	matchgroup=shFunction start="^\s*\h\w*\s*()\_s*("			end=")"	contains=@shFunctionList		 skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
429 ShFoldFunctions syn region shFunctionFour	matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*("		end=")"	contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
430endif
431
432" Parameter Dereferencing: {{{1
433" ========================
434if !exists("g:sh_no_error")
435 syn match  shDerefWordError	"[^}$[~]"	contained
436endif
437syn match  shDerefSimple	"\$\%(\k\+\|\d\)"
438syn region shDeref	matchgroup=PreProc start="\${" end="}"	contains=@shDerefList,shDerefVarArray
439syn match  shDerefSimple	"\$[-#*@!?]"
440syn match  shDerefSimple	"\$\$"
441if exists("b:is_bash") || exists("b:is_kornshell")
442 syn region shDeref	matchgroup=PreProc start="\${##\=" end="}"	contains=@shDerefList
443 syn region shDeref	matchgroup=PreProc start="\${\$\$" end="}"	contains=@shDerefList
444endif
445
446" ksh: ${!var[*]} array index list syntax: {{{1
447" ========================================
448if exists("b:is_kornshell")
449 syn region shDeref	matchgroup=PreProc start="\${!" end="}"	contains=@shDerefVarArray
450endif
451
452" bash: ${!prefix*} and ${#parameter}: {{{1
453" ====================================
454if exists("b:is_bash")
455 syn region shDeref	matchgroup=PreProc start="\${!" end="\*\=}"	contains=@shDerefList,shDerefOp
456 syn match  shDerefVar	contained	"{\@<=!\k\+"		nextgroup=@shDerefVarList
457endif
458if exists("b:is_kornshell")
459 syn match  shDerefVar	contained	"{\@<=!\k[[:alnum:]_.]*"	nextgroup=@shDerefVarList
460endif
461
462syn match  shDerefSpecial	contained	"{\@<=[-*@?0]"		nextgroup=shDerefOp,shDerefOpError
463syn match  shDerefSpecial	contained	"\({[#!]\)\@<=[[:alnum:]*@_]\+"	nextgroup=@shDerefVarList,shDerefOp
464syn match  shDerefVar	contained	"{\@<=\k\+"		nextgroup=@shDerefVarList
465if exists("b:is_kornshell")
466  syn match  shDerefVar	contained	"{\@<=\k[[:alnum:]_.]*"	nextgroup=@shDerefVarList
467endif
468
469" sh ksh bash : ${var[... ]...}  array reference: {{{1
470syn region  shDerefVarArray   contained	matchgroup=shDeref start="\[" end="]"	contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError
471
472" Special ${parameter OPERATOR word} handling: {{{1
473" sh ksh bash : ${parameter:-word}    word is default value
474" sh ksh bash : ${parameter:=word}    assign word as default value
475" sh ksh bash : ${parameter:?word}    display word if parameter is null
476" sh ksh bash : ${parameter:+word}    use word if parameter is not null, otherwise nothing
477"    ksh bash : ${parameter#pattern}  remove small left  pattern
478"    ksh bash : ${parameter##pattern} remove large left  pattern
479"    ksh bash : ${parameter%pattern}  remove small right pattern
480"    ksh bash : ${parameter%%pattern} remove large right pattern
481"        bash : ${parameter^pattern}  Case modification
482"        bash : ${parameter^^pattern} Case modification
483"        bash : ${parameter,pattern}  Case modification
484"        bash : ${parameter,,pattern} Case modification
485syn cluster shDerefPatternList	contains=shDerefPattern,shDerefString
486if !exists("g:sh_no_error")
487 syn match shDerefOpError	contained	":[[:punct:]]"
488endif
489syn match  shDerefOp	contained	":\=[-=?]"	nextgroup=@shDerefPatternList
490syn match  shDerefOp	contained	":\=+"	nextgroup=@shDerefPatternList
491if exists("b:is_bash") || exists("b:is_kornshell")
492 syn match  shDerefOp	contained	"#\{1,2}"	nextgroup=@shDerefPatternList
493 syn match  shDerefOp	contained	"%\{1,2}"	nextgroup=@shDerefPatternList
494 syn match  shDerefPattern	contained	"[^{}]\+"	contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern
495 syn region shDerefPattern	contained	start="{" end="}"	contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern
496 syn match  shDerefEscape	contained	'\%(\\\\\)*\\.'
497endif
498if exists("b:is_bash")
499 syn match  shDerefOp	contained	"[,^]\{1,2}"	nextgroup=@shDerefPatternList
500endif
501syn region shDerefString	contained	matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+		contains=shStringSpecial
502syn region shDerefString	contained	matchgroup=shDerefDelim start=+\%(\\\)\@<!"+ skip=+\\"+ end=+"+	contains=@shDblQuoteList,shStringSpecial
503syn match  shDerefString	contained	"\\["']"	nextgroup=shDerefPattern
504
505if exists("b:is_bash")
506 " bash : ${parameter:offset}
507 " bash : ${parameter:offset:length}
508 syn region shDerefOp	contained	start=":[$[:alnum:]_]"me=e-1 end=":"me=e-1 end="}"me=e-1 contains=@shCommandSubList nextgroup=shDerefPOL
509 syn match  shDerefPOL	contained	":[^}]\+"	contains=@shCommandSubList
510
511 " bash : ${parameter//pattern/string}
512 " bash : ${parameter//pattern}
513 syn match  shDerefPPS	contained	'/\{1,2}'	nextgroup=shDerefPPSleft
514 syn region shDerefPPSleft	contained	start='.'	skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp	end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList
515 syn region shDerefPPSright	contained	start='.'	skip=@\%(\\\\\)\+@		end='\ze}'	contains=@shPPSRightList
516
517 " bash : ${parameter/#substring/replacement}
518 syn match  shDerefPSR	contained	'/#'	nextgroup=shDerefPSRleft
519 syn region shDerefPSRleft	contained	start='.'	skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp	end='/' end='\ze}' nextgroup=shDerefPSRright
520 syn region shDerefPSRright	contained	start='.'	skip=@\%(\\\\\)\+@		end='\ze}'
521endif
522
523" Arithmetic Parenthesized Expressions: {{{1
524"syn region shParen matchgroup=shArithRegion start='[^$]\zs(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList
525syn region shParen matchgroup=shArithRegion start='\$\@!(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList
526
527" Useful sh Keywords: {{{1
528" ===================
529syn keyword shStatement break cd chdir continue eval exec exit kill newgrp pwd read readonly return shift test trap ulimit umask wait
530syn keyword shConditional contained elif else then
531if !exists("g:sh_no_error")
532 syn keyword shCondError elif else then
533endif
534
535" Useful ksh Keywords: {{{1
536" ====================
537if exists("b:is_kornshell") || exists("b:is_bash")
538 syn keyword shStatement autoload bg false fc fg functions getopts hash history integer jobs let nohup printf r stop suspend times true type unalias whence
539 if exists("g:is_posix")
540  syn keyword shStatement command
541 else
542  syn keyword shStatement time
543 endif
544
545" Useful bash Keywords: {{{1
546" =====================
547 if exists("b:is_bash")
548  syn keyword shStatement bind builtin dirs disown enable help local logout popd pushd shopt source
549 else
550  syn keyword shStatement login newgrp
551 endif
552endif
553
554" Synchronization: {{{1
555" ================
556if !exists("g:sh_minlines")
557 let s:sh_minlines = 200
558else
559 let s:sh_minlines= g:sh_minlines
560endif
561if !exists("g:sh_maxlines")
562 let s:sh_maxlines = 2*s:sh_minlines
563 if s:sh_maxlines < 25
564  let s:sh_maxlines= 25
565 endif
566else
567 let s:sh_maxlines= g:sh_maxlines
568endif
569exec "syn sync minlines=" . s:sh_minlines . " maxlines=" . s:sh_maxlines
570syn sync match shCaseEsacSync	grouphere	shCaseEsac	"\<case\>"
571syn sync match shCaseEsacSync	groupthere	shCaseEsac	"\<esac\>"
572syn sync match shDoSync	grouphere	shDo	"\<do\>"
573syn sync match shDoSync	groupthere	shDo	"\<done\>"
574syn sync match shForSync	grouphere	shFor	"\<for\>"
575syn sync match shForSync	groupthere	shFor	"\<in\>"
576syn sync match shIfSync	grouphere	shIf	"\<if\>"
577syn sync match shIfSync	groupthere	shIf	"\<fi\>"
578syn sync match shUntilSync	grouphere	shRepeat	"\<until\>"
579syn sync match shWhileSync	grouphere	shRepeat	"\<while\>"
580
581" Default Highlighting: {{{1
582" =====================
583hi def link shArithRegion	shShellVariables
584hi def link shAstQuote	shDoubleQuote
585hi def link shAtExpr	shSetList
586hi def link shBeginHere	shRedir
587hi def link shCaseBar	shConditional
588hi def link shCaseCommandSub	shCommandSub
589hi def link shCaseDoubleQuote	shDoubleQuote
590hi def link shCaseIn	shConditional
591hi def link shQuote	shOperator
592hi def link shCaseSingleQuote	shSingleQuote
593hi def link shCaseStart	shConditional
594hi def link shCmdSubRegion	shShellVariables
595hi def link shColon	shComment
596hi def link shDerefOp	shOperator
597hi def link shDerefPOL	shDerefOp
598hi def link shDerefPPS	shDerefOp
599hi def link shDerefPSR	shDerefOp
600hi def link shDeref	shShellVariables
601hi def link shDerefDelim	shOperator
602hi def link shDerefSimple	shDeref
603hi def link shDerefSpecial	shDeref
604hi def link shDerefString	shDoubleQuote
605hi def link shDerefVar	shDeref
606hi def link shDoubleQuote	shString
607hi def link shEcho	shString
608hi def link shEchoDelim	shOperator
609hi def link shEchoQuote	shString
610hi def link shForPP	shLoop
611hi def link shEmbeddedEcho	shString
612hi def link shEscape	shCommandSub
613hi def link shExDoubleQuote	shDoubleQuote
614hi def link shExSingleQuote	shSingleQuote
615hi def link shHereDoc	shString
616hi def link shHerePayload	shHereDoc
617hi def link shLoop	shStatement
618hi def link shMoreSpecial	shSpecial
619hi def link shNoQuote	shDoubleQuote
620hi def link shOption	shCommandSub
621hi def link shPattern	shString
622hi def link shParen	shArithmetic
623hi def link shPosnParm	shShellVariables
624hi def link shQuickComment	shComment
625hi def link shRange	shOperator
626hi def link shRedir	shOperator
627hi def link shSetListDelim	shOperator
628hi def link shSetOption	shOption
629hi def link shSingleQuote	shString
630hi def link shSource	shOperator
631hi def link shStringSpecial	shSpecial
632hi def link shSubShRegion	shOperator
633hi def link shTestOpr	shConditional
634hi def link shTestPattern	shString
635hi def link shTestDoubleQuote	shString
636hi def link shTestSingleQuote	shString
637hi def link shTouchCmd	shStatement
638hi def link shVariable	shSetList
639hi def link shWrapLineOperator	shOperator
640
641if exists("b:is_bash")
642  hi def link bashAdminStatement	shStatement
643  hi def link bashSpecialVariables	shShellVariables
644  hi def link bashStatement		shStatement
645  hi def link shCharClass		shSpecial
646endif
647if exists("b:is_kornshell")
648  hi def link kshSpecialVariables	shShellVariables
649  hi def link kshStatement		shStatement
650endif
651
652if !exists("g:sh_no_error")
653 hi def link shCaseError		Error
654 hi def link shCondError		Error
655 hi def link shCurlyError		Error
656 hi def link shDerefOpError		Error
657 hi def link shDerefWordError		Error
658 hi def link shDoError		Error
659 hi def link shEsacError		Error
660 hi def link shIfError		Error
661 hi def link shInError		Error
662 hi def link shParenError		Error
663 hi def link shTestError		Error
664 if exists("b:is_kornshell")
665   hi def link shDTestError		Error
666 endif
667endif
668
669hi def link shArithmetic		Special
670hi def link shCharClass		Identifier
671hi def link shSnglCase		Statement
672hi def link shCommandSub		Special
673hi def link shComment		Comment
674hi def link shConditional		Conditional
675hi def link shCtrlSeq		Special
676hi def link shExprRegion		Delimiter
677hi def link shFunctionKey		Function
678hi def link shFunctionName		Function
679hi def link shNumber		Number
680hi def link shOperator		Operator
681hi def link shRepeat		Repeat
682hi def link shSet		Statement
683hi def link shSetList		Identifier
684hi def link shShellVariables		PreProc
685hi def link shSpecial		Special
686hi def link shStatement		Statement
687hi def link shString		String
688hi def link shTodo		Todo
689hi def link shAlias		Identifier
690hi def link shHereDoc01		shRedir
691hi def link shHereDoc02		shRedir
692hi def link shHereDoc03		shRedir
693hi def link shHereDoc04		shRedir
694hi def link shHereDoc05		shRedir
695hi def link shHereDoc06		shRedir
696hi def link shHereDoc07		shRedir
697hi def link shHereDoc08		shRedir
698hi def link shHereDoc09		shRedir
699hi def link shHereDoc10		shRedir
700hi def link shHereDoc11		shRedir
701hi def link shHereDoc12		shRedir
702hi def link shHereDoc13		shRedir
703hi def link shHereDoc14		shRedir
704hi def link shHereDoc15		shRedir
705hi def link shHereDoc16		shRedir
706hi def link shHereDoc17		shRedir
707hi def link shHereDoc18		shRedir
708hi def link shHereDoc19		shRedir
709hi def link shHereDoc20		shRedir
710hi def link shHereDoc21		shRedir
711
712" Delete shell folding commands {{{1
713" =============================
714delc ShFoldFunctions
715delc ShFoldHereDoc
716delc ShFoldIfDoFor
717
718" Set Current Syntax: {{{1
719" ===================
720if exists("b:is_bash")
721 let b:current_syntax = "bash"
722elseif exists("b:is_kornshell")
723 let b:current_syntax = "ksh"
724else
725 let b:current_syntax = "sh"
726endif
727
728" vim: ts=16 fdm=marker
729