blob: bddfe1c7e49226c455ed76ba81f8a64d8ddad605 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: shell (sh) Korn shell (ksh) bash (sh)
3" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
4" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00005" Last Change: Apr 24, 2008
6" Version: 90
Bram Moolenaarcafda4f2005-09-06 19:25:11 +00007" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
Bram Moolenaar071d4272004-06-13 20:20:40 +00008"
Bram Moolenaard4755bb2004-09-02 19:12:26 +00009" Using the following VIM variables: {{{1
Bram Moolenaara5792f52005-11-23 21:25:05 +000010" g:is_bash if none of the previous three variables are
11" defined, then if g:is_bash is set enhance with
12" bash syntax highlighting
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000013" g:is_kornshell if neither b:is_kornshell or b:is_bash is
14" defined, then if g:is_kornshell is set
15" enhance with kornshell/POSIX syntax highlighting
16" g:is_posix this variable is the same as g:is_kornshell
Bram Moolenaar071d4272004-06-13 20:20:40 +000017" g:sh_fold_enabled if non-zero, syntax folding is enabled
Bram Moolenaara5792f52005-11-23 21:25:05 +000018" g:sh_minlines sets up syn sync minlines (dflt: 200)
19" g:sh_maxlines sets up syn sync maxlines (dflt: 2x sh_minlines)
Bram Moolenaar071d4272004-06-13 20:20:40 +000020"
21" This file includes many ideas from Éric Brunet (eric.brunet@ens.fr)
22
Bram Moolenaard4755bb2004-09-02 19:12:26 +000023" For version 5.x: Clear all syntax items {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000024" For version 6.x: Quit when a syntax file was already loaded
25if version < 600
26 syntax clear
27elseif exists("b:current_syntax")
28 finish
29endif
30
Bram Moolenaard4755bb2004-09-02 19:12:26 +000031" handling /bin/sh with is_kornshell/is_sh {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000032" b:is_sh is set when "#! /bin/sh" is found;
33" However, it often is just a masquerade by bash (typically Linux)
34" or kornshell (typically workstations with Posix "sh").
35" So, when the user sets "is_bash" or "is_kornshell",
36" a b:is_sh is converted into b:is_bash/b:is_kornshell,
37" respectively.
38if !exists("b:is_kornshell") && !exists("b:is_bash")
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000039 if exists("g:is_posix") && !exists("g:is_kornshell")
40 let g:is_kornshell= g:is_posix
41 endif
42 if exists("g:is_kornshell")
Bram Moolenaar071d4272004-06-13 20:20:40 +000043 let b:is_kornshell= 1
44 if exists("b:is_sh")
45 unlet b:is_sh
46 endif
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000047 elseif exists("g:is_bash")
Bram Moolenaar071d4272004-06-13 20:20:40 +000048 let b:is_bash= 1
49 if exists("b:is_sh")
50 unlet b:is_sh
51 endif
52 else
53 let b:is_sh= 1
54 endif
55endif
56
Bram Moolenaarcd71fa32005-03-11 22:46:48 +000057" set up default g:sh_fold_enabled {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000058if !exists("g:sh_fold_enabled")
59 let g:sh_fold_enabled= 0
Bram Moolenaar293ee4d2004-12-09 21:34:53 +000060elseif g:sh_fold_enabled != 0 && !has("folding")
61 let g:sh_fold_enabled= 0
Bram Moolenaarcd71fa32005-03-11 22:46:48 +000062 echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support"
63endif
64if g:sh_fold_enabled && &fdm == "manual"
65 set fdm=syntax
Bram Moolenaar071d4272004-06-13 20:20:40 +000066endif
67
Bram Moolenaarcd71fa32005-03-11 22:46:48 +000068" sh syntax is case sensitive {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000069syn case match
70
Bram Moolenaard4755bb2004-09-02 19:12:26 +000071" Clusters: contains=@... clusters {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000072"==================================
Bram Moolenaar9964e462007-05-05 17:54:07 +000073syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq
74syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
Bram Moolenaar071d4272004-06-13 20:20:40 +000075syn cluster shColonList contains=@shCaseList
Bram Moolenaar9964e462007-05-05 17:54:07 +000076syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq
Bram Moolenaar572cb562005-08-05 21:35:02 +000077syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
Bram Moolenaar7263a772007-05-10 17:35:54 +000078syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq,shSpecial
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000079syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS
Bram Moolenaar071d4272004-06-13 20:20:40 +000080syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError
Bram Moolenaar9964e462007-05-05 17:54:07 +000081syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq
82syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq
Bram Moolenaar383f9bc2005-01-19 22:18:32 +000083syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest
Bram Moolenaar9964e462007-05-05 17:54:07 +000084syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shFunctionStart,shCtrlSeq
Bram Moolenaar7263a772007-05-10 17:35:54 +000085if exists("b:is_kornshell") || exists("b:is_bash")
86 syn cluster shFunctionList add=shDblBrace,shDblParen
87endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000088syn cluster shHereBeginList contains=@shCommandSubList
89syn cluster shHereList contains=shBeginHere,shHerePayload
90syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
Bram Moolenaar9964e462007-05-05 17:54:07 +000091syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shIdWhiteSpace,shDeref,shDerefSimple,shRedir,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq
Bram Moolenaar383f9bc2005-01-19 22:18:32 +000092syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest
Bram Moolenaar7263a772007-05-10 17:35:54 +000093syn cluster shSubShList contains=@shCaseList,shOperator
Bram Moolenaar9964e462007-05-05 17:54:07 +000094syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shDoubleQuote,shExpr,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq
Bram Moolenaar071d4272004-06-13 20:20:40 +000095
96
Bram Moolenaard4755bb2004-09-02 19:12:26 +000097" Echo: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000098" ====
99" This one is needed INSIDE a CommandSub, so that `echo bla` be correct
100syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shOperator end="$" matchgroup=NONE end="[<>;&|()]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList
101syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shOperator end="$" matchgroup=NONE end="[<>;&|()]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList
102
103" This must be after the strings, so that bla \" be correct
Bram Moolenaar9964e462007-05-05 17:54:07 +0000104syn region shEmbeddedEcho contained matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shOperator end="$" matchgroup=NONE end="[<>;&|`)]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=shNumber,shExSingleQuote,shSingleQuote,shDeref,shDerefSimple,shSpecialVar,shOperator,shDoubleQuote,shCharClass,shCtrlSeq
Bram Moolenaar071d4272004-06-13 20:20:40 +0000105
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000106" Alias: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000107" =====
108if exists("b:is_kornshell") || exists("b:is_bash")
109 syn match shStatement "\<alias\>"
110 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\w\+\)\@=" skip="\\$" end="\>\|`"
111 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\w\+=\)\@=" skip="\\$" end="="
112endif
113
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000114" Error Codes: {{{1
115" ============
Bram Moolenaar071d4272004-06-13 20:20:40 +0000116syn match shDoError "\<done\>"
117syn match shIfError "\<fi\>"
118syn match shInError "\<in\>"
119syn match shCaseError ";;"
120syn match shEsacError "\<esac\>"
121syn match shCurlyError "}"
122syn match shParenError ")"
123if exists("b:is_kornshell")
124 syn match shDTestError "]]"
125endif
126syn match shTestError "]"
127
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000128" Options Interceptor: {{{1
129" ====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000130syn match shOption "\s[\-+][a-zA-Z0-9]\+\>"ms=s+1
Bram Moolenaare1438bb2006-03-01 22:01:55 +0000131syn match shOption "\s--[^ \t$`'"|]\+"ms=s+1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132
Bram Moolenaar7263a772007-05-10 17:35:54 +0000133" File Redirection Highlighted As Operators: {{{1
134"===========================================
135syn match shRedir "\d\=>\(&[-0-9]\)\="
136syn match shRedir "\d\=>>-\="
137syn match shRedir "\d\=<\(&[-0-9]\)\="
138syn match shRedir "\d<<-\="
139
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000140" Operators: {{{1
141" ==========
Bram Moolenaar7263a772007-05-10 17:35:54 +0000142syn match shOperator "<<\|>>" contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000143syn match shOperator "[!&;|]"
144syn match shOperator "\[[[^:]\|\]]"
145syn match shOperator "!\==" skipwhite nextgroup=shPattern
Bram Moolenaardf177f62005-02-22 08:39:57 +0000146syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shDoubleQuote,shDeref
Bram Moolenaar071d4272004-06-13 20:20:40 +0000147
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000148" Subshells: {{{1
149" ==========
Bram Moolenaar071d4272004-06-13 20:20:40 +0000150syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2
151syn region shSubSh transparent matchgroup=shSubShRegion start="(" end=")" contains=@shSubShList
152
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000153" Tests: {{{1
154"=======
Bram Moolenaar071d4272004-06-13 20:20:40 +0000155"syn region shExpr transparent matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList
Bram Moolenaar9964e462007-05-05 17:54:07 +0000156syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList
157syn region shTest transparent matchgroup=shStatement start="\<test\>" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1
158syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]"
159syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern
160syn match shTestPattern contained '\w\+'
161syn match shTestDoubleQuote contained '"[^"]*"'
162syn match shTestSingleQuote contained '\\.'
163syn match shTestSingleQuote contained "'[^']*'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000164if exists("b:is_kornshell") || exists("b:is_bash")
165 syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList
166 syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList
167endif
168
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000169" Character Class In Range: {{{1
170" =========================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000171syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]"
172
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000173" Loops: do, if, while, until {{{1
174" ======
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000175if g:sh_fold_enabled
176 syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
177 syn region shIf fold transparent matchgroup=shConditional start="\<if\>" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>" contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey
178 syn region shFor fold matchgroup=shLoop start="\<for\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
179else
180 syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
181 syn region shIf transparent matchgroup=shConditional start="\<if\>" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>" contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey
182 syn region shFor matchgroup=shLoop start="\<for\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
183endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000184if exists("b:is_kornshell") || exists("b:is_bash")
185 syn cluster shCaseList add=shRepeat
186 syn region shRepeat matchgroup=shLoop start="\<while\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace
187 syn region shRepeat matchgroup=shLoop start="\<until\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace
188 syn region shCaseEsac matchgroup=shConditional start="\<select\>" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList
189else
190 syn region shRepeat matchgroup=shLoop start="\<while\>" end="\<do\>"me=e-2 contains=@shLoopList
191 syn region shRepeat matchgroup=shLoop start="\<until\>" end="\<do\>"me=e-2 contains=@shLoopList
192endif
Bram Moolenaar572cb562005-08-05 21:35:02 +0000193syn region shCurlyIn contained matchgroup=Delimiter start="{" end="}" contains=@shCurlyList
194syn match shComma contained ","
Bram Moolenaar071d4272004-06-13 20:20:40 +0000195
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000196" Case: case...esac {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000197" ====
Bram Moolenaardf177f62005-02-22 08:39:57 +0000198syn match shCaseBar contained skipwhite "[^|"`'()]\{-}|"hs=e nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
Bram Moolenaar071d4272004-06-13 20:20:40 +0000199syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar
Bram Moolenaar7263a772007-05-10 17:35:54 +0000200syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\([^#$()'" \t]\|\\.\)\{-})"ms=s,hs=e end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000201if g:sh_fold_enabled
202 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
203else
204 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
205endif
Bram Moolenaardf177f62005-02-22 08:39:57 +0000206syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
207if exists("b:is_bash")
208 syn region shCaseExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000209 syn region shCaseExDoubleQuote matchgroup=shOperator start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial,shSpecial,shCommandSub,shDeref skipwhite skipnl nextgroup=shCaseBar contained
Bram Moolenaardf177f62005-02-22 08:39:57 +0000210else
211 syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
212endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000213syn region shCaseSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000214syn region shCaseDoubleQuote matchgroup=shOperator start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
215syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained
216
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000217" Misc: {{{1
218"======
Bram Moolenaar071d4272004-06-13 20:20:40 +0000219syn match shWrapLineOperator "\\$"
220syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList
221
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000222" $() and $(()): {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000223" $(..) is not supported by sh (Bourne shell). However, apparently
224" some systems (HP?) have as their /bin/sh a (link to) Korn shell
225" (ie. Posix compliant shell). /bin/ksh should work for those
226" systems too, however, so the following syntax will flag $(..) as
227" an Error under /bin/sh. By consensus of vimdev'ers!
228if exists("b:is_kornshell") || exists("b:is_bash")
229 syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
230 syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shCommandSubList
231 syn match shSkipInitWS contained "^\s\+"
232else
Bram Moolenaardf177f62005-02-22 08:39:57 +0000233 syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000234endif
235
236if exists("b:is_bash")
237 syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
238 syn cluster shCaseList add=bashAdminStatement,bashStatement
239 syn keyword bashSpecialVariables contained BASH BASH_ENV BASH_VERSINFO BASH_VERSION CDPATH DIRSTACK EUID FCEDIT FIGNORE GLOBIGNORE GROUPS HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_MESSAGES LINENO MACHTYPE MAIL MAILCHECK MAILPATH OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS PPID PROMPT_COMMAND PS1 PS2 PS3 PS4 PWD RANDOM REPLY SECONDS SHELLOPTS SHLVL TIMEFORMAT TIMEOUT UID auto_resume histchars
240 syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep install less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch
241 syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
242endif
243
244if exists("b:is_kornshell")
245 syn cluster shCommandSubList add=kshSpecialVariables,kshStatement
246 syn cluster shCaseList add=kshStatement
247 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
248 syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep install killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail touch tput
249endif
250
251syn match shSource "^\.\s"
252syn match shSource "\s\.\s"
253syn region shColon start="^\s*:" end="$\|" end="#"me=e-1 contains=@shColonList
254
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000255" String And Character Constants: {{{1
256"================================
Bram Moolenaar9964e462007-05-05 17:54:07 +0000257syn match shNumber "-\=\<\d\+\>#\="
258syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained
Bram Moolenaardf177f62005-02-22 08:39:57 +0000259if exists("b:is_bash")
260 syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c.\|\\[abefnrtv]" contained
Bram Moolenaardf177f62005-02-22 08:39:57 +0000261endif
262if exists("b:is_bash")
263 syn region shExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000264 syn region shExDoubleQuote matchgroup=shOperator start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial,shSpecial,shCommandSub,shDeref
Bram Moolenaardf177f62005-02-22 08:39:57 +0000265else
Bram Moolenaar9964e462007-05-05 17:54:07 +0000266 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial
Bram Moolenaardf177f62005-02-22 08:39:57 +0000267endif
Bram Moolenaar9964e462007-05-05 17:54:07 +0000268syn region shSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial,@Spell
269syn region shDoubleQuote matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000270syn match shStringSpecial "[^[:print:]]" contained
Bram Moolenaar7263a772007-05-10 17:35:54 +0000271syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]"
272syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]"
273syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000274
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000275" Comments: {{{1
276"==========
Bram Moolenaar071d4272004-06-13 20:20:40 +0000277syn cluster shCommentGroup contains=shTodo,@Spell
Bram Moolenaar18144c82006-04-12 21:52:12 +0000278syn keyword shTodo contained COMBAK FIXME TODO XXX
Bram Moolenaar7263a772007-05-10 17:35:54 +0000279syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup
280syn match shComment "#.*$" contains=@shCommentGroup
Bram Moolenaar071d4272004-06-13 20:20:40 +0000281
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000282" Here Documents: {{{1
283" =========================================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000284if version < 600
285 syn region shHereDoc matchgroup=shRedir start="<<\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList
286 syn region shHereDoc matchgroup=shRedir start="<<-\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir end="^\s*END[a-zA-Z_0-9]*$" contains=@shDblQuoteList
287 syn region shHereDoc matchgroup=shRedir start="<<\s*\**EOF\**" matchgroup=shRedir end="^EOF$" contains=@shDblQuoteList
288 syn region shHereDoc matchgroup=shRedir start="<<-\s*\**EOF\**" matchgroup=shRedir end="^\s*EOF$" contains=@shDblQuoteList
289 syn region shHereDoc matchgroup=shRedir start="<<\s*\**\.\**" matchgroup=shRedir end="^\.$" contains=@shDblQuoteList
290 syn region shHereDoc matchgroup=shRedir start="<<-\s*\**\.\**" matchgroup=shRedir end="^\s*\.$" contains=@shDblQuoteList
291
292elseif g:sh_fold_enabled
Bram Moolenaar9964e462007-05-05 17:54:07 +0000293 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000294 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
295 syn region shHereDoc matchgroup=shRedir fold start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
296 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList
297 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
298 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
299 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
300 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
301 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
302 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$"
303 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
304 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000305 syn region shHereDoc matchgroup=shRedir fold start="<<\\\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000306
Bram Moolenaar071d4272004-06-13 20:20:40 +0000307else
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000308 syn region shHereDoc matchgroup=shRedir start="<<\s*\\\=\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList
309 syn region shHereDoc matchgroup=shRedir start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
310 syn region shHereDoc matchgroup=shRedir start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList
311 syn region shHereDoc matchgroup=shRedir start="<<-\s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
312 syn region shHereDoc matchgroup=shRedir start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
313 syn region shHereDoc matchgroup=shRedir start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
314 syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
315 syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$"
316 syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
317 syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
318 syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
319 syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000320 syn region shHereDoc matchgroup=shRedir start="<<\\\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000321endif
322
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000323" Here Strings: {{{1
324" =============
325if exists("b:is_bash")
326 syn match shRedir "<<<"
327endif
328
329" Identifiers: {{{1
330"=============
Bram Moolenaar071d4272004-06-13 20:20:40 +0000331syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier
332syn match shIdWhiteSpace contained "\s"
Bram Moolenaardf177f62005-02-22 08:39:57 +0000333syn match shSetIdentifier contained "=" nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shSingleQuote,shExSingleQuote
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334if exists("b:is_bash")
Bram Moolenaar9964e462007-05-05 17:54:07 +0000335 syn region shSetList matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[|);&]"me=e-1 matchgroup=NONE end="#\|="me=e-1 contains=@shIdList
336 syn region shSetList matchgroup=shSet start="\<set\>[^/]"me=e-1 end="$" end="\\ze[|)]" matchgroup=shOperator end="\ze[|);&]"me=e-1 matchgroup=NONE end="[#=]"me=e-1 contains=@shIdList
337 syn match shSet "\<\(declare\|typeset\|local\|export\|set\|unset\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000338elseif exists("b:is_kornshell")
Bram Moolenaar9964e462007-05-05 17:54:07 +0000339 syn region shSetList matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[|);&]"me=e-1 matchgroup=NONE end="[#=]"me=e-1 contains=@shIdList
340 syn region shSetList matchgroup=shSet start="\<set\>\ze[^/]" end="$\|\ze[})]" matchgroup=shOperator end="\ze[|);&]"me=e-1 matchgroup=NONE end="[#=]"me=e-1 contains=@shIdList
341 syn match shSet "\<\(typeset\|set\|export\|unset\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000342else
Bram Moolenaar9964e462007-05-05 17:54:07 +0000343 syn region shSetList matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$\|\ze[|)]" matchgroup=shOperator end="\ze[|);&]" matchgroup=NONE end="[#=]"me=e-1 contains=@shIdList
344 syn match shStatement "\<\(set\|export\|unset\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000345endif
346
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000347" Functions: {{{1
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000348syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo
Bram Moolenaar7263a772007-05-10 17:35:54 +0000349" COMBAK -- look at bash09. function foo() (line#35) is folding 38 lines. Not being terminated properly
350"syn match shFunctionStart "{" contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000351if g:sh_fold_enabled
Bram Moolenaar7263a772007-05-10 17:35:54 +0000352 syn region shFunctionOne transparent fold start="^\s*\h\w*\s*()\_s*\ze{" matchgroup=shFunctionStart end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart
353 syn region shFunctionTwo transparent fold start="\h\w*\s*\%(()\)\=\_s*\ze{" matchgroup=shFunctionStart end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart
Bram Moolenaar071d4272004-06-13 20:20:40 +0000354else
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000355 syn region shFunctionOne transparent start="^\s*\h\w*\s*()\_s*\ze{" matchgroup=shFunctionStart end="}" contains=@shFunctionList
356 syn region shFunctionTwo transparent start="\h\w*\s*\%(()\)\=\_s*\ze{" matchgroup=shFunctionStart end="}" contains=shFunctionKey,@shFunctionList contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000357endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000358
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000359" Parameter Dereferencing: {{{1
360" ========================
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000361syn match shDerefSimple "\$\%(\h\w*\|\d\)"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000362syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray
363syn match shDerefWordError "[^}$[]" contained
364syn match shDerefSimple "\$[-#*@!?]"
365syn match shDerefSimple "\$\$"
366if exists("b:is_bash") || exists("b:is_kornshell")
367 syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList
368endif
369
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000370" bash: ${!prefix*} and ${#parameter}: {{{1
371" ====================================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000372if exists("b:is_bash")
373 syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp
374 syn match shDerefVar contained "{\@<=!\w\+" nextgroup=@shDerefVarList
375endif
376
377syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError
378syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp
379syn match shDerefVar contained "{\@<=\w\+" nextgroup=@shDerefVarList
380
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000381" sh ksh bash : ${var[... ]...} array reference: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000382syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError
383
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000384" Special ${parameter OPERATOR word} handling: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000385" sh ksh bash : ${parameter:-word} word is default value
386" sh ksh bash : ${parameter:=word} assign word as default value
387" sh ksh bash : ${parameter:?word} display word if parameter is null
388" sh ksh bash : ${parameter:+word} use word if parameter is not null, otherwise nothing
389" ksh bash : ${parameter#pattern} remove small left pattern
390" ksh bash : ${parameter##pattern} remove large left pattern
391" ksh bash : ${parameter%pattern} remove small right pattern
392" ksh bash : ${parameter%%pattern} remove large right pattern
393syn cluster shDerefPatternList contains=shDerefPattern,shDerefString
394syn match shDerefOpError contained ":[[:punct:]]"
395syn match shDerefOp contained ":\=[-=?]" nextgroup=@shDerefPatternList
396syn match shDerefOp contained ":\=+" nextgroup=@shDerefPatternList
397if exists("b:is_bash") || exists("b:is_kornshell")
398 syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList
399 syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000400 syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern
Bram Moolenaar071d4272004-06-13 20:20:40 +0000401 syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000402 syn match shDerefEscape contained '\%(\\\\\)*\\.'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000403endif
404syn region shDerefString contained matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial
405syn region shDerefString contained matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial
406syn match shDerefString contained "\\["']"
407
Bram Moolenaar071d4272004-06-13 20:20:40 +0000408if exists("b:is_bash")
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000409 " bash : ${parameter:offset}
410 " bash : ${parameter:offset:length}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000411 syn region shDerefOp contained start=":[$[:alnum:]_]"me=e-1 end=":"me=e-1 end="}"me=e-1 contains=@shCommandSubList nextgroup=shDerefPOL
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000412 syn match shDerefPOL contained ":[^}]\+" contains=@shCommandSubList
413
414 " bash : ${parameter//pattern/string}
415 " bash : ${parameter//pattern}
416 syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft
Bram Moolenaara5792f52005-11-23 21:25:05 +0000417 syn region shDerefPPSleft contained start='.' skip=@\%(\\\)\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000418 syn region shDerefPPSright contained start='.' end='\ze}' contains=@shCommandSubList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000419endif
420
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000421" Useful sh Keywords: {{{1
422" ===================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000423syn keyword shStatement break cd chdir continue eval exec exit kill newgrp pwd read readonly return shift test trap ulimit umask wait
424syn keyword shConditional contained elif else then
425syn keyword shCondError elif else then
426
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000427" Useful ksh Keywords: {{{1
428" ====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000429if exists("b:is_kornshell") || exists("b:is_bash")
Bram Moolenaar071d4272004-06-13 20:20:40 +0000430 syn keyword shStatement autoload bg false fc fg functions getopts hash history integer jobs let nohup print printf r stop suspend time times true type unalias whence
431
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000432" Useful bash Keywords: {{{1
433" =====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000434 if exists("b:is_bash")
435 syn keyword shStatement bind builtin dirs disown enable help local logout popd pushd shopt source
436 else
437 syn keyword shStatement login newgrp
438 endif
439endif
440
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000441" Synchronization: {{{1
442" ================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000443if !exists("sh_minlines")
444 let sh_minlines = 200
445endif
446if !exists("sh_maxlines")
447 let sh_maxlines = 2 * sh_minlines
448endif
449exec "syn sync minlines=" . sh_minlines . " maxlines=" . sh_maxlines
450syn sync match shCaseEsacSync grouphere shCaseEsac "\<case\>"
451syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>"
452syn sync match shDoSync grouphere shDo "\<do\>"
453syn sync match shDoSync groupthere shDo "\<done\>"
454syn sync match shForSync grouphere shFor "\<for\>"
455syn sync match shForSync groupthere shFor "\<in\>"
456syn sync match shIfSync grouphere shIf "\<if\>"
457syn sync match shIfSync groupthere shIf "\<fi\>"
458syn sync match shUntilSync grouphere shRepeat "\<until\>"
459syn sync match shWhileSync grouphere shRepeat "\<while\>"
460
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000461" Default Highlighting: {{{1
462" =====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000463hi def link shArithRegion shShellVariables
Bram Moolenaardf177f62005-02-22 08:39:57 +0000464hi def link shBeginHere shRedir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000465hi def link shCaseBar shConditional
Bram Moolenaar071d4272004-06-13 20:20:40 +0000466hi def link shCaseCommandSub shCommandSub
467hi def link shCaseDoubleQuote shDoubleQuote
Bram Moolenaardf177f62005-02-22 08:39:57 +0000468hi def link shCaseIn shConditional
Bram Moolenaar071d4272004-06-13 20:20:40 +0000469hi def link shCaseSingleQuote shSingleQuote
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000470hi def link shCaseDoubleQuote shSingleQuote
Bram Moolenaar071d4272004-06-13 20:20:40 +0000471hi def link shCaseStart shConditional
472hi def link shCmdSubRegion shShellVariables
473hi def link shColon shStatement
Bram Moolenaar071d4272004-06-13 20:20:40 +0000474hi def link shDerefOp shOperator
Bram Moolenaardf177f62005-02-22 08:39:57 +0000475hi def link shDerefPOL shDerefOp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000476hi def link shDerefPPS shDerefOp
Bram Moolenaardf177f62005-02-22 08:39:57 +0000477hi def link shDeref shShellVariables
Bram Moolenaar071d4272004-06-13 20:20:40 +0000478hi def link shDerefSimple shDeref
479hi def link shDerefSpecial shDeref
480hi def link shDerefString shDoubleQuote
Bram Moolenaardf177f62005-02-22 08:39:57 +0000481hi def link shDerefVar shDeref
Bram Moolenaar071d4272004-06-13 20:20:40 +0000482hi def link shDoubleQuote shString
483hi def link shEcho shString
484hi def link shEmbeddedEcho shString
Bram Moolenaardf177f62005-02-22 08:39:57 +0000485hi def link shExSingleQuote shSingleQuote
Bram Moolenaar3577c6f2008-06-24 21:16:56 +0000486hi def link shExDoubleQuote shSingleQuote
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000487hi def link shFunctionStart Delimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000488hi def link shHereDoc shString
Bram Moolenaardf177f62005-02-22 08:39:57 +0000489hi def link shHerePayload shHereDoc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000490hi def link shLoop shStatement
491hi def link shOption shCommandSub
492hi def link shPattern shString
493hi def link shPosnParm shShellVariables
494hi def link shRange shOperator
495hi def link shRedir shOperator
496hi def link shSingleQuote shString
497hi def link shSource shOperator
498hi def link shStringSpecial shSpecial
499hi def link shSubShRegion shOperator
500hi def link shTestOpr shConditional
Bram Moolenaar9964e462007-05-05 17:54:07 +0000501hi def link shTestPattern shString
502hi def link shTestDoubleQuote shString
503hi def link shTestSingleQuote shString
Bram Moolenaar071d4272004-06-13 20:20:40 +0000504hi def link shVariable shSetList
505hi def link shWrapLineOperator shOperator
506
507if exists("b:is_bash")
508 hi def link bashAdminStatement shStatement
509 hi def link bashSpecialVariables shShellVariables
510 hi def link bashStatement shStatement
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000511 hi def link shFunctionParen Delimiter
512 hi def link shFunctionDelim Delimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000513endif
514if exists("b:is_kornshell")
515 hi def link kshSpecialVariables shShellVariables
516 hi def link kshStatement shStatement
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000517 hi def link shFunctionParen Delimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000518endif
519
520hi def link shCaseError Error
521hi def link shCondError Error
522hi def link shCurlyError Error
523hi def link shDerefError Error
524hi def link shDerefOpError Error
525hi def link shDerefWordError Error
526hi def link shDoError Error
527hi def link shEsacError Error
528hi def link shIfError Error
529hi def link shInError Error
530hi def link shParenError Error
531hi def link shTestError Error
532if exists("b:is_kornshell")
533 hi def link shDTestError Error
534endif
535
536hi def link shArithmetic Special
537hi def link shCharClass Identifier
538hi def link shSnglCase Statement
539hi def link shCommandSub Special
540hi def link shComment Comment
541hi def link shConditional Conditional
Bram Moolenaar9964e462007-05-05 17:54:07 +0000542hi def link shCtrlSeq Special
Bram Moolenaar071d4272004-06-13 20:20:40 +0000543hi def link shExprRegion Delimiter
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000544hi def link shFunctionKey Function
Bram Moolenaar071d4272004-06-13 20:20:40 +0000545hi def link shFunctionName Function
546hi def link shNumber Number
547hi def link shOperator Operator
548hi def link shRepeat Repeat
549hi def link shSet Statement
550hi def link shSetList Identifier
551hi def link shShellVariables PreProc
552hi def link shSpecial Special
553hi def link shStatement Statement
554hi def link shString String
555hi def link shTodo Todo
556hi def link shAlias Identifier
557
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000558" Set Current Syntax: {{{1
559" ===================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000560if exists("b:is_bash")
561 let b:current_syntax = "bash"
562elseif exists("b:is_kornshell")
563 let b:current_syntax = "ksh"
564else
565 let b:current_syntax = "sh"
566endif
567
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000568" vim: ts=16 fdm=marker