blob: f3218ffcb25e11169d6787583e922a9800842b86 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: shell (sh) Korn shell (ksh) bash (sh)
Bram Moolenaar97d62492012-11-15 21:28:22 +01003" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
Bram Moolenaar071d4272004-06-13 20:20:40 +00004" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
Bram Moolenaare2719092015-01-10 15:09:25 +01005" Last Change: Jan 08, 2015
6" Version: 134
7" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
8" For options and settings, please use: :help ft-sh-syntax
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +02009" This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr)
Bram Moolenaar071d4272004-06-13 20:20:40 +000010
Bram Moolenaard4755bb2004-09-02 19:12:26 +000011" For version 5.x: Clear all syntax items {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000012" 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
Bram Moolenaard960d762011-09-21 19:22:10 +020019" AFAICT "." should be considered part of the iskeyword. Using iskeywords in
Bram Moolenaare2719092015-01-10 15:09:25 +010020" syntax is dicey, so the following code permits the user to prevent/override
Bram Moolenaar97d62492012-11-15 21:28:22 +010021" 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
24if exists("g:sh_isk") && type(g:sh_isk) == 1 " user specifying iskeyword
25 exe "setl isk=".g:sh_isk
26elseif !exists("g:sh_noisk") " optionally prevent appending '.' to iskeyword
27 setl isk+=.
Bram Moolenaard960d762011-09-21 19:22:10 +020028endif
29
30" trying to answer the question: which shell is /bin/sh, really?
Bram Moolenaar97d62492012-11-15 21:28:22 +010031" If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess.
Bram Moolenaard960d762011-09-21 19:22:10 +020032if !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh")
Bram Moolenaarbc488a72013-07-05 21:01:22 +020033 let s:shell = ""
Bram Moolenaard960d762011-09-21 19:22:10 +020034 if executable("/bin/sh")
Bram Moolenaarbc488a72013-07-05 21:01:22 +020035 let s:shell = resolve("/bin/sh")
Bram Moolenaard960d762011-09-21 19:22:10 +020036 elseif executable("/usr/bin/sh")
Bram Moolenaarbc488a72013-07-05 21:01:22 +020037 let s:shell = resolve("/usr/bin/sh")
Bram Moolenaard960d762011-09-21 19:22:10 +020038 endif
Bram Moolenaarbc488a72013-07-05 21:01:22 +020039 if s:shell =~ 'bash$'
40 let g:is_bash= 1
41 elseif s:shell =~ 'ksh$'
42 let g:is_kornshell = 1
43 elseif s:shell =~ 'dash$'
44 let g:is_posix = 1
45 endif
46 unlet s:shell
Bram Moolenaard960d762011-09-21 19:22:10 +020047endif
48
Bram Moolenaard4755bb2004-09-02 19:12:26 +000049" handling /bin/sh with is_kornshell/is_sh {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000050" b:is_sh is set when "#! /bin/sh" is found;
51" However, it often is just a masquerade by bash (typically Linux)
52" or kornshell (typically workstations with Posix "sh").
Bram Moolenaard960d762011-09-21 19:22:10 +020053" So, when the user sets "g:is_bash", "g:is_kornshell",
54" or "g:is_posix", a b:is_sh is converted into b:is_bash/b:is_kornshell,
Bram Moolenaar071d4272004-06-13 20:20:40 +000055" respectively.
56if !exists("b:is_kornshell") && !exists("b:is_bash")
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000057 if exists("g:is_posix") && !exists("g:is_kornshell")
58 let g:is_kornshell= g:is_posix
59 endif
60 if exists("g:is_kornshell")
Bram Moolenaar071d4272004-06-13 20:20:40 +000061 let b:is_kornshell= 1
62 if exists("b:is_sh")
63 unlet b:is_sh
64 endif
Bram Moolenaar7fc904b2006-04-13 20:37:35 +000065 elseif exists("g:is_bash")
Bram Moolenaar071d4272004-06-13 20:20:40 +000066 let b:is_bash= 1
67 if exists("b:is_sh")
68 unlet b:is_sh
69 endif
70 else
71 let b:is_sh= 1
72 endif
73endif
74
Bram Moolenaarcd71fa32005-03-11 22:46:48 +000075" set up default g:sh_fold_enabled {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000076if !exists("g:sh_fold_enabled")
77 let g:sh_fold_enabled= 0
Bram Moolenaar293ee4d2004-12-09 21:34:53 +000078elseif g:sh_fold_enabled != 0 && !has("folding")
79 let g:sh_fold_enabled= 0
Bram Moolenaarcd71fa32005-03-11 22:46:48 +000080 echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support"
81endif
Bram Moolenaarc236c162008-07-13 17:41:49 +000082if !exists("s:sh_fold_functions")
Bram Moolenaar97d62492012-11-15 21:28:22 +010083 let s:sh_fold_functions= and(g:sh_fold_enabled,1)
Bram Moolenaarc236c162008-07-13 17:41:49 +000084endif
85if !exists("s:sh_fold_heredoc")
Bram Moolenaar97d62492012-11-15 21:28:22 +010086 let s:sh_fold_heredoc = and(g:sh_fold_enabled,2)
Bram Moolenaarc236c162008-07-13 17:41:49 +000087endif
88if !exists("s:sh_fold_ifdofor")
Bram Moolenaar97d62492012-11-15 21:28:22 +010089 let s:sh_fold_ifdofor = and(g:sh_fold_enabled,4)
Bram Moolenaarc236c162008-07-13 17:41:49 +000090endif
Bram Moolenaarcd71fa32005-03-11 22:46:48 +000091if g:sh_fold_enabled && &fdm == "manual"
Bram Moolenaar97d62492012-11-15 21:28:22 +010092 " Given that the user provided g:sh_fold_enabled
93 " AND g:sh_fold_enabled is manual (usual default)
94 " implies a desire for syntax-based folding
95 setl fdm=syntax
Bram Moolenaar071d4272004-06-13 20:20:40 +000096endif
97
Bram Moolenaarcd71fa32005-03-11 22:46:48 +000098" sh syntax is case sensitive {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000099syn case match
100
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000101" Clusters: contains=@... clusters {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000102"==================================
Bram Moolenaar5c736222010-01-06 20:54:52 +0100103syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError,shOK
Bram Moolenaarc236c162008-07-13 17:41:49 +0000104if exists("b:is_kornshell")
105 syn cluster ErrorList add=shDTestError
106endif
Bram Moolenaare2719092015-01-10 15:09:25 +0100107syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDerefSimple,shDo,shEcho,shEscape,shIf,shFor,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement
Bram Moolenaarc236c162008-07-13 17:41:49 +0000108syn cluster shArithList contains=@shArithParenList,shParenError
Bram Moolenaar5c736222010-01-06 20:54:52 +0100109syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
Bram Moolenaard960d762011-09-21 19:22:10 +0200110syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100111"syn cluster shColonList contains=@shCaseList
Bram Moolenaarac7bd632013-03-19 11:35:58 +0100112syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEcho,shEscape,shNumber,shOption,shPosnParm,shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial,shCmdParenRegion
Bram Moolenaar572cb562005-08-05 21:35:02 +0000113syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
Bram Moolenaar97d62492012-11-15 21:28:22 +0100114syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000115syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000116syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError
Bram Moolenaar97d62492012-11-15 21:28:22 +0100117syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shEscape,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
Bram Moolenaare90ee312010-08-05 22:08:47 +0200118syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq
Bram Moolenaar383f9bc2005-01-19 22:18:32 +0000119syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest
Bram Moolenaard960d762011-09-21 19:22:10 +0200120syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
Bram Moolenaar7263a772007-05-10 17:35:54 +0000121if exists("b:is_kornshell") || exists("b:is_bash")
Bram Moolenaarc236c162008-07-13 17:41:49 +0000122 syn cluster shFunctionList add=shRepeat
Bram Moolenaar7263a772007-05-10 17:35:54 +0000123 syn cluster shFunctionList add=shDblBrace,shDblParen
124endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000125syn cluster shHereBeginList contains=@shCommandSubList
126syn cluster shHereList contains=shBeginHere,shHerePayload
127syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200128syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100129syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
Bram Moolenaare2719092015-01-10 15:09:25 +0100130syn cluster shLoopList contains=@shCaseList,shIf,shFor,shForPP,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest,@shErrorList,shSet,shOption
Bram Moolenaard960d762011-09-21 19:22:10 +0200131syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
132syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shExDoubleQuote,shDoubleQuote,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000133" Echo: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000134" ====
135" This one is needed INSIDE a CommandSub, so that `echo bla` be correct
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200136syn 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
137syn 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
Bram Moolenaar5c736222010-01-06 20:54:52 +0100138syn match shEchoQuote contained '\%(\\\\\)*\\["`'()]'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000139
Bram Moolenaarc236c162008-07-13 17:41:49 +0000140" This must be after the strings, so that ... \" will be correct
Bram Moolenaare90ee312010-08-05 22:08:47 +0200141syn 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000142
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000143" Alias: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000144" =====
145if exists("b:is_kornshell") || exists("b:is_bash")
146 syn match shStatement "\<alias\>"
Bram Moolenaard960d762011-09-21 19:22:10 +0200147 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+\)\@=" skip="\\$" end="\>\|`"
148 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+=\)\@=" skip="\\$" end="="
Bram Moolenaar071d4272004-06-13 20:20:40 +0000149endif
150
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000151" Error Codes: {{{1
152" ============
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100153if !exists("g:sh_no_error")
Bram Moolenaare2719092015-01-10 15:09:25 +0100154 syn match shDoError "\<done\>"
155 syn match shIfError "\<fi\>"
156 syn match shInError "\<in\>"
157 syn match shCaseError ";;"
158 syn match shEsacError "\<esac\>"
159 syn match shCurlyError "}"
160 syn match shParenError ")"
161 syn match shOK '\.\(done\|fi\|in\|esac\)'
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100162 if exists("b:is_kornshell")
Bram Moolenaare2719092015-01-10 15:09:25 +0100163 syn match shDTestError "]]"
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100164 endif
Bram Moolenaare2719092015-01-10 15:09:25 +0100165 syn match shTestError "]"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000166endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000167
Bram Moolenaarc236c162008-07-13 17:41:49 +0000168" Options: {{{1
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000169" ====================
Bram Moolenaar97d62492012-11-15 21:28:22 +0100170syn match shOption "\s\zs[-+][-_a-zA-Z0-9#]\+"
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200171syn match shOption "\s\zs--[^ \t$`'"|);]\+"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000172
Bram Moolenaar7263a772007-05-10 17:35:54 +0000173" File Redirection Highlighted As Operators: {{{1
174"===========================================
175syn match shRedir "\d\=>\(&[-0-9]\)\="
176syn match shRedir "\d\=>>-\="
177syn match shRedir "\d\=<\(&[-0-9]\)\="
178syn match shRedir "\d<<-\="
179
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000180" Operators: {{{1
181" ==========
Bram Moolenaar7263a772007-05-10 17:35:54 +0000182syn match shOperator "<<\|>>" contained
Bram Moolenaarc236c162008-07-13 17:41:49 +0000183syn match shOperator "[!&;|]" contained
184syn match shOperator "\[[[^:]\|\]]" contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000185syn match shOperator "!\==" skipwhite nextgroup=shPattern
Bram Moolenaare90ee312010-08-05 22:08:47 +0200186syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shDeref
Bram Moolenaar071d4272004-06-13 20:20:40 +0000187
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000188" Subshells: {{{1
189" ==========
Bram Moolenaard960d762011-09-21 19:22:10 +0200190syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2 nextgroup=shMoreSpecial
191syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")" contains=@shSubShList nextgroup=shMoreSpecial
Bram Moolenaar071d4272004-06-13 20:20:40 +0000192
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000193" Tests: {{{1
194"=======
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200195syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial
Bram Moolenaar5c736222010-01-06 20:54:52 +0100196syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1
Bram Moolenaar9964e462007-05-05 17:54:07 +0000197syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]"
198syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern
199syn match shTestPattern contained '\w\+'
Bram Moolenaare2719092015-01-10 15:09:25 +0100200syn region shTestDoubleQuote contained start='"' skip='\\"' end='"' contains=shBQpairs
Bram Moolenaar9964e462007-05-05 17:54:07 +0000201syn match shTestSingleQuote contained '\\.'
202syn match shTestSingleQuote contained "'[^']*'"
Bram Moolenaare2719092015-01-10 15:09:25 +0100203syn match shBQpairs contained '\\\\'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000204if exists("b:is_kornshell") || exists("b:is_bash")
205 syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList
206 syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList
207endif
208
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000209" Character Class In Range: {{{1
210" =========================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]"
212
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000213" Loops: do, if, while, until {{{1
214" ======
Bram Moolenaar97d62492012-11-15 21:28:22 +0100215if s:sh_fold_ifdofor
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000216 syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100217 syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList
Bram Moolenaar97d62492012-11-15 21:28:22 +0100218 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
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000219else
Bram Moolenaare2719092015-01-10 15:09:25 +0100220 syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100221 syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList
Bram Moolenaar97d62492012-11-15 21:28:22 +0100222 syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000223endif
Bram Moolenaare2719092015-01-10 15:09:25 +0100224syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225if exists("b:is_kornshell") || exists("b:is_bash")
Bram Moolenaarc236c162008-07-13 17:41:49 +0000226 syn cluster shCaseList add=shRepeat
227 syn cluster shFunctionList add=shRepeat
228 syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace
229 syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace
230 syn region shCaseEsac matchgroup=shConditional start="\<select\s" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231else
Bram Moolenaarc236c162008-07-13 17:41:49 +0000232 syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<do\>"me=e-2 contains=@shLoopList
233 syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<do\>"me=e-2 contains=@shLoopList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000234endif
Bram Moolenaar572cb562005-08-05 21:35:02 +0000235syn region shCurlyIn contained matchgroup=Delimiter start="{" end="}" contains=@shCurlyList
236syn match shComma contained ","
Bram Moolenaar071d4272004-06-13 20:20:40 +0000237
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000238" Case: case...esac {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000239" ====
Bram Moolenaarc236c162008-07-13 17:41:49 +0000240syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
Bram Moolenaar071d4272004-06-13 20:20:40 +0000241syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar
Bram Moolenaar97d62492012-11-15 21:28:22 +0100242if s:sh_fold_ifdofor
Bram Moolenaar5c736222010-01-06 20:54:52 +0100243 syn region shCase fold contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000244 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
245else
Bram Moolenaar5c736222010-01-06 20:54:52 +0100246 syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000247 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
248endif
Bram Moolenaardf177f62005-02-22 08:39:57 +0000249syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
250if exists("b:is_bash")
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200251 syn region shCaseExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100252elseif !exists("g:sh_no_error")
Bram Moolenaardf177f62005-02-22 08:39:57 +0000253 syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
254endif
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200255syn region shCaseSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
256syn region shCaseDoubleQuote matchgroup=shQuote start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000257syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained
Bram Moolenaar97d62492012-11-15 21:28:22 +0100258if exists("b:is_bash")
259 syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+ contained contains=shCharClass
260 syn match shCharClass '\[:\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|word\|or\|xdigit\):\]' contained
261else
262 syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+ contained
263endif
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000264" Misc: {{{1
265"======
Bram Moolenaar071d4272004-06-13 20:20:40 +0000266syn match shWrapLineOperator "\\$"
Bram Moolenaar97d62492012-11-15 21:28:22 +0100267syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200268syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000269
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000270" $() and $(()): {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000271" $(..) is not supported by sh (Bourne shell). However, apparently
272" some systems (HP?) have as their /bin/sh a (link to) Korn shell
273" (ie. Posix compliant shell). /bin/ksh should work for those
274" systems too, however, so the following syntax will flag $(..) as
275" an Error under /bin/sh. By consensus of vimdev'ers!
276if exists("b:is_kornshell") || exists("b:is_bash")
277 syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
Bram Moolenaarc236c162008-07-13 17:41:49 +0000278 syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
Bram Moolenaar61d35bd2012-03-28 20:51:51 +0200279 syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000280 syn match shSkipInitWS contained "^\s\+"
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100281elseif !exists("g:sh_no_error")
Bram Moolenaardf177f62005-02-22 08:39:57 +0000282 syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000283endif
Bram Moolenaare2719092015-01-10 15:09:25 +0100284syn region shCmdParenRegion matchgroup=shCmdSubRegion start="(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000285
286if exists("b:is_bash")
287 syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
288 syn cluster shCaseList add=bashAdminStatement,bashStatement
Bram Moolenaard960d762011-09-21 19:22:10 +0200289 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
Bram Moolenaar97d62492012-11-15 21:28:22 +0100290 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000291 syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
Bram Moolenaar97d62492012-11-15 21:28:22 +0100292 syn keyword bashStatement command compgen
Bram Moolenaar071d4272004-06-13 20:20:40 +0000293endif
294
295if exists("b:is_kornshell")
296 syn cluster shCommandSubList add=kshSpecialVariables,kshStatement
297 syn cluster shCaseList add=kshStatement
298 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
Bram Moolenaar97d62492012-11-15 21:28:22 +0100299 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
300 syn keyword kshStatement command setgroups setsenv
Bram Moolenaar071d4272004-06-13 20:20:40 +0000301endif
302
303syn match shSource "^\.\s"
304syn match shSource "\s\.\s"
Bram Moolenaar5c736222010-01-06 20:54:52 +0100305"syn region shColon start="^\s*:" end="$" end="\s#"me=e-2 contains=@shColonList
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100306"syn region shColon start="^\s*\zs:" end="$" end="\s#"me=e-2
307syn match shColon '^\s*\zs:'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000308
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000309" String And Character Constants: {{{1
310"================================
Bram Moolenaar9964e462007-05-05 17:54:07 +0000311syn match shNumber "-\=\<\d\+\>#\="
312syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained
Bram Moolenaardf177f62005-02-22 08:39:57 +0000313if exists("b:is_bash")
Bram Moolenaar5c736222010-01-06 20:54:52 +0100314 syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
Bram Moolenaardf177f62005-02-22 08:39:57 +0000315endif
316if exists("b:is_bash")
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200317 syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial
Bram Moolenaare90ee312010-08-05 22:08:47 +0200318 syn region shExDoubleQuote matchgroup=shQuote start=+\$"+ skip=+\\\\\|\\.\|\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,shSpecial
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100319elseif !exists("g:sh_no_error")
Bram Moolenaar9964e462007-05-05 17:54:07 +0000320 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial
Bram Moolenaare90ee312010-08-05 22:08:47 +0200321 syn region shExDoubleQuote matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial
Bram Moolenaardf177f62005-02-22 08:39:57 +0000322endif
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200323syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell
Bram Moolenaard960d762011-09-21 19:22:10 +0200324syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell
Bram Moolenaare2719092015-01-10 15:09:25 +0100325"syn region shDoubleQuote matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000326syn match shStringSpecial "[^[:print:] \t]" contained
Bram Moolenaar7263a772007-05-10 17:35:54 +0000327syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]"
Bram Moolenaare2719092015-01-10 15:09:25 +0100328syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial,shComment
329syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shComment
330syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000331
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000332" Comments: {{{1
333"==========
Bram Moolenaar5c736222010-01-06 20:54:52 +0100334syn cluster shCommentGroup contains=shTodo,@Spell
335syn keyword shTodo contained COMBAK FIXME TODO XXX
336syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup
337syn match shComment "\s\zs#.*$" contains=@shCommentGroup
Bram Moolenaar97d62492012-11-15 21:28:22 +0100338syn match shComment contained "#.*$" contains=@shCommentGroup
Bram Moolenaar5c736222010-01-06 20:54:52 +0100339syn match shQuickComment contained "#.*$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000340
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000341" Here Documents: {{{1
342" =========================================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000343if version < 600
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200344 syn region shHereDoc matchgroup=shRedir01 start="<<\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir01 end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList
345 syn region shHereDoc matchgroup=shRedir02 start="<<-\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir02 end="^\s*END[a-zA-Z_0-9]*$" contains=@shDblQuoteList
346 syn region shHereDoc matchgroup=shRedir03 start="<<\s*\**EOF\**" matchgroup=shRedir03 end="^EOF$" contains=@shDblQuoteList
347 syn region shHereDoc matchgroup=shRedir04 start="<<-\s*\**EOF\**" matchgroup=shRedir04 end="^\s*EOF$" contains=@shDblQuoteList
348 syn region shHereDoc matchgroup=shRedir05 start="<<\s*\**\.\**" matchgroup=shRedir05 end="^\.$" contains=@shDblQuoteList
349 syn region shHereDoc matchgroup=shRedir06 start="<<-\s*\**\.\**" matchgroup=shRedir06 end="^\s*\.$" contains=@shDblQuoteList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000350
Bram Moolenaar97d62492012-11-15 21:28:22 +0100351elseif s:sh_fold_heredoc
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200352 syn region shHereDoc matchgroup=shRedir07 fold start="<<\s*\z([^ \t|]*\)" matchgroup=shRedir07 end="^\z1\s*$" contains=@shDblQuoteList
353 syn region shHereDoc matchgroup=shRedir08 fold start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir08 end="^\z1\s*$"
354 syn region shHereDoc matchgroup=shRedir09 fold start="<<\s*'\z([^ \t|]*\)'" matchgroup=shRedir09 end="^\z1\s*$"
355 syn region shHereDoc matchgroup=shRedir10 fold start="<<-\s*\z([^ \t|]*\)" matchgroup=shRedir10 end="^\s*\z1\s*$" contains=@shDblQuoteList
356 syn region shHereDoc matchgroup=shRedir11 fold start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir11 end="^\s*\z1\s*$"
357 syn region shHereDoc matchgroup=shRedir12 fold start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shRedir12 end="^\s*\z1\s*$"
358 syn region shHereDoc matchgroup=shRedir13 fold start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir13 end="^\z1\s*$"
359 syn region shHereDoc matchgroup=shRedir14 fold start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir14 end="^\z1\s*$"
360 syn region shHereDoc matchgroup=shRedir15 fold start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir15 end="^\s*\z1\s*$"
361 syn region shHereDoc matchgroup=shRedir16 fold start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir16 end="^\s*\z1\s*$"
362 syn region shHereDoc matchgroup=shRedir17 fold start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir17 end="^\s*\z1\s*$"
363 syn region shHereDoc matchgroup=shRedir18 fold start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir18 end="^\z1\s*$"
364 syn region shHereDoc matchgroup=shRedir19 fold start="<<\\\z([^ \t|]*\)" matchgroup=shRedir19 end="^\z1\s*$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000365
Bram Moolenaar071d4272004-06-13 20:20:40 +0000366else
Bram Moolenaare2719092015-01-10 15:09:25 +0100367 syn region shHereDoc matchgroup=shRedir20 start="<<\s*\\\=\z([^ \t|]*\)" matchgroup=shRedir20 end="^\z1\s*$" contains=@shDblQuoteList
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200368 syn region shHereDoc matchgroup=shRedir21 start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir21 end="^\z1\s*$"
Bram Moolenaare2719092015-01-10 15:09:25 +0100369 syn region shHereDoc matchgroup=shRedir22 start="<<-\s*\z([^ \t|]*\)" matchgroup=shRedir22 end="^\s*\z1\s*$" contains=@shDblQuoteList
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200370 syn region shHereDoc matchgroup=shRedir23 start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shRedir23 end="^\s*\z1\s*$"
371 syn region shHereDoc matchgroup=shRedir24 start="<<\s*'\z([^ \t|]*\)'" matchgroup=shRedir24 end="^\z1\s*$"
372 syn region shHereDoc matchgroup=shRedir25 start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir25 end="^\s*\z1\s*$"
373 syn region shHereDoc matchgroup=shRedir26 start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir26 end="^\z1\s*$"
374 syn region shHereDoc matchgroup=shRedir27 start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir27 end="^\s*\z1\s*$"
375 syn region shHereDoc matchgroup=shRedir28 start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir28 end="^\s*\z1\s*$"
376 syn region shHereDoc matchgroup=shRedir29 start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir29 end="^\z1\s*$"
377 syn region shHereDoc matchgroup=shRedir30 start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir30 end="^\z1\s*$"
378 syn region shHereDoc matchgroup=shRedir31 start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir31 end="^\s*\z1\s*$"
379 syn region shHereDoc matchgroup=shRedir32 start="<<\\\z([^ \t|]*\)" matchgroup=shRedir32 end="^\z1\s*$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000380endif
381
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000382" Here Strings: {{{1
383" =============
Bram Moolenaard960d762011-09-21 19:22:10 +0200384" available for: bash; ksh (really should be ksh93 only) but not if its a posix
385if exists("b:is_bash") || (exists("b:is_kornshell") && !exists("g:is_posix"))
Bram Moolenaar97d62492012-11-15 21:28:22 +0100386 syn match shRedir "<<<" skipwhite nextgroup=shCmdParenRegion
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000387endif
388
389" Identifiers: {{{1
390"=============
Bram Moolenaarc236c162008-07-13 17:41:49 +0000391syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained
392syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier
Bram Moolenaar97d62492012-11-15 21:28:22 +0100393syn match shSetIdentifier "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200394syn region shAtExpr contained start="@(" end=")" contains=@shIdList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000395if exists("b:is_bash")
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200396 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
397 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000398elseif exists("b:is_kornshell")
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200399 syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
400 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000401else
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200402 syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000403endif
404
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000405" Functions: {{{1
Bram Moolenaarc236c162008-07-13 17:41:49 +0000406if !exists("g:is_posix")
407 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo
408endif
409
410if exists("b:is_bash")
Bram Moolenaar97d62492012-11-15 21:28:22 +0100411 if s:sh_fold_functions
412 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
Bram Moolenaarc236c162008-07-13 17:41:49 +0000413 syn region shFunctionTwo fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
414 else
415 syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList
416 syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained
417 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000418else
Bram Moolenaar97d62492012-11-15 21:28:22 +0100419 if s:sh_fold_functions
Bram Moolenaarc236c162008-07-13 17:41:49 +0000420 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
421 syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
422 else
423 syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList
424 syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained
425 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000426endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000427
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000428" Parameter Dereferencing: {{{1
429" ========================
Bram Moolenaar97d62492012-11-15 21:28:22 +0100430syn match shDerefSimple "\$\%(\k\+\|\d\)"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000431syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100432if !exists("g:sh_no_error")
433 syn match shDerefWordError "[^}$[]" contained
434endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000435syn match shDerefSimple "\$[-#*@!?]"
436syn match shDerefSimple "\$\$"
437if exists("b:is_bash") || exists("b:is_kornshell")
438 syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList
Bram Moolenaarc236c162008-07-13 17:41:49 +0000439 syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000440endif
441
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000442" bash: ${!prefix*} and ${#parameter}: {{{1
443" ====================================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000444if exists("b:is_bash")
445 syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp
Bram Moolenaar97d62492012-11-15 21:28:22 +0100446 syn match shDerefVar contained "{\@<=!\k\+" nextgroup=@shDerefVarList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000447endif
448
449syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError
450syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp
Bram Moolenaar97d62492012-11-15 21:28:22 +0100451syn match shDerefVar contained "{\@<=\k\+" nextgroup=@shDerefVarList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000452
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000453" sh ksh bash : ${var[... ]...} array reference: {{{1
Bram Moolenaare2719092015-01-10 15:09:25 +0100454syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError
Bram Moolenaar071d4272004-06-13 20:20:40 +0000455
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000456" Special ${parameter OPERATOR word} handling: {{{1
Bram Moolenaare2719092015-01-10 15:09:25 +0100457" sh ksh bash : ${parameter:-word} word is default value
458" sh ksh bash : ${parameter:=word} assign word as default value
459" sh ksh bash : ${parameter:?word} display word if parameter is null
460" sh ksh bash : ${parameter:+word} use word if parameter is not null, otherwise nothing
461" ksh bash : ${parameter#pattern} remove small left pattern
462" ksh bash : ${parameter##pattern} remove large left pattern
463" ksh bash : ${parameter%pattern} remove small right pattern
464" ksh bash : ${parameter%%pattern} remove large right pattern
465" bash : ${parameter^pattern} Case modification
466" bash : ${parameter^^pattern} Case modification
467" bash : ${parameter,pattern} Case modification
468" bash : ${parameter,,pattern} Case modification
Bram Moolenaar071d4272004-06-13 20:20:40 +0000469syn cluster shDerefPatternList contains=shDerefPattern,shDerefString
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100470if !exists("g:sh_no_error")
471 syn match shDerefOpError contained ":[[:punct:]]"
472endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000473syn match shDerefOp contained ":\=[-=?]" nextgroup=@shDerefPatternList
474syn match shDerefOp contained ":\=+" nextgroup=@shDerefPatternList
475if exists("b:is_bash") || exists("b:is_kornshell")
476 syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList
477 syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000478 syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern
Bram Moolenaar071d4272004-06-13 20:20:40 +0000479 syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000480 syn match shDerefEscape contained '\%(\\\\\)*\\.'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000481endif
Bram Moolenaard960d762011-09-21 19:22:10 +0200482if exists("b:is_bash")
483 syn match shDerefOp contained "[,^]\{1,2}" nextgroup=@shDerefPatternList
484endif
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200485syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+ contains=shStringSpecial
486syn region shDerefString contained matchgroup=shDerefDelim start=+\%(\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial
Bram Moolenaarc236c162008-07-13 17:41:49 +0000487syn match shDerefString contained "\\["']" nextgroup=shDerefPattern
Bram Moolenaar071d4272004-06-13 20:20:40 +0000488
Bram Moolenaar071d4272004-06-13 20:20:40 +0000489if exists("b:is_bash")
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000490 " bash : ${parameter:offset}
491 " bash : ${parameter:offset:length}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000492 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 +0000493 syn match shDerefPOL contained ":[^}]\+" contains=@shCommandSubList
494
495 " bash : ${parameter//pattern/string}
496 " bash : ${parameter//pattern}
497 syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft
Bram Moolenaar97d62492012-11-15 21:28:22 +0100498 syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList
499 syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shCommandSubList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000500endif
501
Bram Moolenaarc236c162008-07-13 17:41:49 +0000502" Arithmetic Parenthesized Expressions: {{{1
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200503"syn region shParen matchgroup=shArithRegion start='[^$]\zs(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList
504syn region shParen matchgroup=shArithRegion start='\$\@!(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList
Bram Moolenaarc236c162008-07-13 17:41:49 +0000505
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000506" Useful sh Keywords: {{{1
507" ===================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508syn keyword shStatement break cd chdir continue eval exec exit kill newgrp pwd read readonly return shift test trap ulimit umask wait
509syn keyword shConditional contained elif else then
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100510if !exists("g:sh_no_error")
511 syn keyword shCondError elif else then
512endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000513
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000514" Useful ksh Keywords: {{{1
515" ====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000516if exists("b:is_kornshell") || exists("b:is_bash")
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200517 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
Bram Moolenaarc236c162008-07-13 17:41:49 +0000518 if exists("g:is_posix")
519 syn keyword shStatement command
520 else
521 syn keyword shStatement time
522 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000523
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000524" Useful bash Keywords: {{{1
525" =====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000526 if exists("b:is_bash")
527 syn keyword shStatement bind builtin dirs disown enable help local logout popd pushd shopt source
528 else
529 syn keyword shStatement login newgrp
530 endif
531endif
532
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000533" Synchronization: {{{1
534" ================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000535if !exists("sh_minlines")
536 let sh_minlines = 200
537endif
538if !exists("sh_maxlines")
539 let sh_maxlines = 2 * sh_minlines
540endif
541exec "syn sync minlines=" . sh_minlines . " maxlines=" . sh_maxlines
542syn sync match shCaseEsacSync grouphere shCaseEsac "\<case\>"
543syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>"
544syn sync match shDoSync grouphere shDo "\<do\>"
545syn sync match shDoSync groupthere shDo "\<done\>"
546syn sync match shForSync grouphere shFor "\<for\>"
547syn sync match shForSync groupthere shFor "\<in\>"
548syn sync match shIfSync grouphere shIf "\<if\>"
549syn sync match shIfSync groupthere shIf "\<fi\>"
550syn sync match shUntilSync grouphere shRepeat "\<until\>"
551syn sync match shWhileSync grouphere shRepeat "\<while\>"
552
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000553" Default Highlighting: {{{1
554" =====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000555hi def link shArithRegion shShellVariables
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200556hi def link shAtExpr shSetList
Bram Moolenaardf177f62005-02-22 08:39:57 +0000557hi def link shBeginHere shRedir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000558hi def link shCaseBar shConditional
Bram Moolenaar071d4272004-06-13 20:20:40 +0000559hi def link shCaseCommandSub shCommandSub
560hi def link shCaseDoubleQuote shDoubleQuote
Bram Moolenaardf177f62005-02-22 08:39:57 +0000561hi def link shCaseIn shConditional
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200562hi def link shQuote shOperator
Bram Moolenaar071d4272004-06-13 20:20:40 +0000563hi def link shCaseSingleQuote shSingleQuote
564hi def link shCaseStart shConditional
565hi def link shCmdSubRegion shShellVariables
Bram Moolenaar5c736222010-01-06 20:54:52 +0100566hi def link shColon shComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000567hi def link shDerefOp shOperator
Bram Moolenaardf177f62005-02-22 08:39:57 +0000568hi def link shDerefPOL shDerefOp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000569hi def link shDerefPPS shDerefOp
Bram Moolenaardf177f62005-02-22 08:39:57 +0000570hi def link shDeref shShellVariables
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200571hi def link shDerefDelim shOperator
Bram Moolenaar071d4272004-06-13 20:20:40 +0000572hi def link shDerefSimple shDeref
573hi def link shDerefSpecial shDeref
574hi def link shDerefString shDoubleQuote
Bram Moolenaardf177f62005-02-22 08:39:57 +0000575hi def link shDerefVar shDeref
Bram Moolenaar071d4272004-06-13 20:20:40 +0000576hi def link shDoubleQuote shString
577hi def link shEcho shString
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200578hi def link shEchoDelim shOperator
Bram Moolenaarc236c162008-07-13 17:41:49 +0000579hi def link shEchoQuote shString
Bram Moolenaare2719092015-01-10 15:09:25 +0100580"hi def link shForPP shLoop
Bram Moolenaar071d4272004-06-13 20:20:40 +0000581hi def link shEmbeddedEcho shString
Bram Moolenaarc236c162008-07-13 17:41:49 +0000582hi def link shEscape shCommandSub
Bram Moolenaare90ee312010-08-05 22:08:47 +0200583hi def link shExDoubleQuote shDoubleQuote
Bram Moolenaardf177f62005-02-22 08:39:57 +0000584hi def link shExSingleQuote shSingleQuote
Bram Moolenaarc236c162008-07-13 17:41:49 +0000585hi def link shFunction Function
Bram Moolenaar071d4272004-06-13 20:20:40 +0000586hi def link shHereDoc shString
Bram Moolenaardf177f62005-02-22 08:39:57 +0000587hi def link shHerePayload shHereDoc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000588hi def link shLoop shStatement
Bram Moolenaar5c736222010-01-06 20:54:52 +0100589hi def link shMoreSpecial shSpecial
Bram Moolenaar071d4272004-06-13 20:20:40 +0000590hi def link shOption shCommandSub
591hi def link shPattern shString
Bram Moolenaarc236c162008-07-13 17:41:49 +0000592hi def link shParen shArithmetic
Bram Moolenaar071d4272004-06-13 20:20:40 +0000593hi def link shPosnParm shShellVariables
Bram Moolenaarc236c162008-07-13 17:41:49 +0000594hi def link shQuickComment shComment
Bram Moolenaar071d4272004-06-13 20:20:40 +0000595hi def link shRange shOperator
596hi def link shRedir shOperator
Bram Moolenaar4b22cdb2010-08-02 22:12:46 +0200597hi def link shSetListDelim shOperator
Bram Moolenaarc236c162008-07-13 17:41:49 +0000598hi def link shSetOption shOption
Bram Moolenaar071d4272004-06-13 20:20:40 +0000599hi def link shSingleQuote shString
600hi def link shSource shOperator
601hi def link shStringSpecial shSpecial
602hi def link shSubShRegion shOperator
603hi def link shTestOpr shConditional
Bram Moolenaar9964e462007-05-05 17:54:07 +0000604hi def link shTestPattern shString
605hi def link shTestDoubleQuote shString
606hi def link shTestSingleQuote shString
Bram Moolenaare2719092015-01-10 15:09:25 +0100607hi def link shBQpairs shString
Bram Moolenaar071d4272004-06-13 20:20:40 +0000608hi def link shVariable shSetList
609hi def link shWrapLineOperator shOperator
610
611if exists("b:is_bash")
612 hi def link bashAdminStatement shStatement
613 hi def link bashSpecialVariables shShellVariables
614 hi def link bashStatement shStatement
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000615 hi def link shFunctionParen Delimiter
616 hi def link shFunctionDelim Delimiter
Bram Moolenaar97d62492012-11-15 21:28:22 +0100617 hi def link shCharClass shSpecial
Bram Moolenaar071d4272004-06-13 20:20:40 +0000618endif
619if exists("b:is_kornshell")
620 hi def link kshSpecialVariables shShellVariables
621 hi def link kshStatement shStatement
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000622 hi def link shFunctionParen Delimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000623endif
624
Bram Moolenaar6be7f872012-01-20 21:08:56 +0100625if !exists("g:sh_no_error")
626 hi def link shCaseError Error
627 hi def link shCondError Error
628 hi def link shCurlyError Error
629 hi def link shDerefError Error
630 hi def link shDerefOpError Error
631 hi def link shDerefWordError Error
632 hi def link shDoError Error
633 hi def link shEsacError Error
634 hi def link shIfError Error
635 hi def link shInError Error
636 hi def link shParenError Error
637 hi def link shTestError Error
638 if exists("b:is_kornshell")
639 hi def link shDTestError Error
640 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000641endif
642
643hi def link shArithmetic Special
644hi def link shCharClass Identifier
645hi def link shSnglCase Statement
646hi def link shCommandSub Special
647hi def link shComment Comment
648hi def link shConditional Conditional
Bram Moolenaar9964e462007-05-05 17:54:07 +0000649hi def link shCtrlSeq Special
Bram Moolenaar071d4272004-06-13 20:20:40 +0000650hi def link shExprRegion Delimiter
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000651hi def link shFunctionKey Function
Bram Moolenaar071d4272004-06-13 20:20:40 +0000652hi def link shFunctionName Function
653hi def link shNumber Number
654hi def link shOperator Operator
655hi def link shRepeat Repeat
656hi def link shSet Statement
657hi def link shSetList Identifier
658hi def link shShellVariables PreProc
659hi def link shSpecial Special
660hi def link shStatement Statement
661hi def link shString String
662hi def link shTodo Todo
663hi def link shAlias Identifier
Bram Moolenaarbc488a72013-07-05 21:01:22 +0200664hi def link shRedir01 shRedir
665hi def link shRedir02 shRedir
666hi def link shRedir03 shRedir
667hi def link shRedir04 shRedir
668hi def link shRedir05 shRedir
669hi def link shRedir06 shRedir
670hi def link shRedir07 shRedir
671hi def link shRedir08 shRedir
672hi def link shRedir09 shRedir
673hi def link shRedir10 shRedir
674hi def link shRedir11 shRedir
675hi def link shRedir12 shRedir
676hi def link shRedir13 shRedir
677hi def link shRedir14 shRedir
678hi def link shRedir15 shRedir
679hi def link shRedir16 shRedir
680hi def link shRedir17 shRedir
681hi def link shRedir18 shRedir
682hi def link shRedir19 shRedir
683hi def link shRedir20 shRedir
684hi def link shRedir21 shRedir
685hi def link shRedir22 shRedir
686hi def link shRedir23 shRedir
687hi def link shRedir24 shRedir
688hi def link shRedir25 shRedir
689hi def link shRedir26 shRedir
690hi def link shRedir27 shRedir
691hi def link shRedir28 shRedir
692hi def link shRedir29 shRedir
693hi def link shRedir30 shRedir
694hi def link shRedir31 shRedir
695hi def link shRedir32 shRedir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000696
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000697" Set Current Syntax: {{{1
698" ===================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000699if exists("b:is_bash")
700 let b:current_syntax = "bash"
701elseif exists("b:is_kornshell")
702 let b:current_syntax = "ksh"
703else
704 let b:current_syntax = "sh"
705endif
706
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000707" vim: ts=16 fdm=marker