blob: 4edff04619cde73a07f93ced20e5b5efbcdd04ac [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 Moolenaar9964e462007-05-05 17:54:07 +00005" Last Change: Sep 15, 2006
6" Version: 88
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 Moolenaar9964e462007-05-05 17:54:07 +000078syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq
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 Moolenaar071d4272004-06-13 20:20:40 +000085syn cluster shHereBeginList contains=@shCommandSubList
86syn cluster shHereList contains=shBeginHere,shHerePayload
87syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
Bram Moolenaar9964e462007-05-05 17:54:07 +000088syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shIdWhiteSpace,shDeref,shDerefSimple,shRedir,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq
Bram Moolenaar383f9bc2005-01-19 22:18:32 +000089syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest
Bram Moolenaar071d4272004-06-13 20:20:40 +000090syn cluster shSubShList contains=@shCaseList
Bram Moolenaar9964e462007-05-05 17:54:07 +000091syn 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 +000092
93
Bram Moolenaard4755bb2004-09-02 19:12:26 +000094" Echo: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000095" ====
96" This one is needed INSIDE a CommandSub, so that `echo bla` be correct
97syn 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
98syn 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
99
100" This must be after the strings, so that bla \" be correct
Bram Moolenaar9964e462007-05-05 17:54:07 +0000101syn 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 +0000102
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000103" Alias: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000104" =====
105if exists("b:is_kornshell") || exists("b:is_bash")
106 syn match shStatement "\<alias\>"
107 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\w\+\)\@=" skip="\\$" end="\>\|`"
108 syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\w\+=\)\@=" skip="\\$" end="="
109endif
110
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000111" Error Codes: {{{1
112" ============
Bram Moolenaar071d4272004-06-13 20:20:40 +0000113syn match shDoError "\<done\>"
114syn match shIfError "\<fi\>"
115syn match shInError "\<in\>"
116syn match shCaseError ";;"
117syn match shEsacError "\<esac\>"
118syn match shCurlyError "}"
119syn match shParenError ")"
120if exists("b:is_kornshell")
121 syn match shDTestError "]]"
122endif
123syn match shTestError "]"
124
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000125" Options Interceptor: {{{1
126" ====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000127syn match shOption "\s[\-+][a-zA-Z0-9]\+\>"ms=s+1
Bram Moolenaare1438bb2006-03-01 22:01:55 +0000128syn match shOption "\s--[^ \t$`'"|]\+"ms=s+1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000129
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000130" Operators: {{{1
131" ==========
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132syn match shOperator "[!&;|]"
133syn match shOperator "\[[[^:]\|\]]"
134syn match shOperator "!\==" skipwhite nextgroup=shPattern
Bram Moolenaardf177f62005-02-22 08:39:57 +0000135syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shDoubleQuote,shDeref
Bram Moolenaar071d4272004-06-13 20:20:40 +0000136
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000137" Subshells: {{{1
138" ==========
Bram Moolenaar071d4272004-06-13 20:20:40 +0000139syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2
140syn region shSubSh transparent matchgroup=shSubShRegion start="(" end=")" contains=@shSubShList
141
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000142" Tests: {{{1
143"=======
Bram Moolenaar071d4272004-06-13 20:20:40 +0000144"syn region shExpr transparent matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList
Bram Moolenaar9964e462007-05-05 17:54:07 +0000145syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList
146syn region shTest transparent matchgroup=shStatement start="\<test\>" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1
147syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]"
148syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern
149syn match shTestPattern contained '\w\+'
150syn match shTestDoubleQuote contained '"[^"]*"'
151syn match shTestSingleQuote contained '\\.'
152syn match shTestSingleQuote contained "'[^']*'"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000153if exists("b:is_kornshell") || exists("b:is_bash")
154 syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList
155 syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList
156endif
157
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000158" Character Class In Range: {{{1
159" =========================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000160syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]"
161
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000162" Loops: do, if, while, until {{{1
163" ======
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000164if g:sh_fold_enabled
165 syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
166 syn region shIf fold transparent matchgroup=shConditional start="\<if\>" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>" contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey
167 syn region shFor fold matchgroup=shLoop start="\<for\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
168else
169 syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
170 syn region shIf transparent matchgroup=shConditional start="\<if\>" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>" contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey
171 syn region shFor matchgroup=shLoop start="\<for\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
172endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000173if exists("b:is_kornshell") || exists("b:is_bash")
174 syn cluster shCaseList add=shRepeat
175 syn region shRepeat matchgroup=shLoop start="\<while\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace
176 syn region shRepeat matchgroup=shLoop start="\<until\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace
177 syn region shCaseEsac matchgroup=shConditional start="\<select\>" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList
178else
179 syn region shRepeat matchgroup=shLoop start="\<while\>" end="\<do\>"me=e-2 contains=@shLoopList
180 syn region shRepeat matchgroup=shLoop start="\<until\>" end="\<do\>"me=e-2 contains=@shLoopList
181endif
Bram Moolenaar572cb562005-08-05 21:35:02 +0000182syn region shCurlyIn contained matchgroup=Delimiter start="{" end="}" contains=@shCurlyList
183syn match shComma contained ","
Bram Moolenaar071d4272004-06-13 20:20:40 +0000184
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000185" Case: case...esac {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000186" ====
Bram Moolenaardf177f62005-02-22 08:39:57 +0000187syn match shCaseBar contained skipwhite "[^|"`'()]\{-}|"hs=e nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
Bram Moolenaar071d4272004-06-13 20:20:40 +0000188syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000189syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="[^#$()'"]\{-})"ms=s,hs=e end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000190if g:sh_fold_enabled
191 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
192else
193 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
194endif
Bram Moolenaardf177f62005-02-22 08:39:57 +0000195syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
196if exists("b:is_bash")
197 syn region shCaseExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained
198else
199 syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
200endif
Bram Moolenaar8b6144b2006-02-08 09:20:24 +0000201syn region shCaseSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000202syn region shCaseDoubleQuote matchgroup=shOperator start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
203syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained
204
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000205" Misc: {{{1
206"======
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207syn match shWrapLineOperator "\\$"
208syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList
209
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000210" $() and $(()): {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211" $(..) is not supported by sh (Bourne shell). However, apparently
212" some systems (HP?) have as their /bin/sh a (link to) Korn shell
213" (ie. Posix compliant shell). /bin/ksh should work for those
214" systems too, however, so the following syntax will flag $(..) as
215" an Error under /bin/sh. By consensus of vimdev'ers!
216if exists("b:is_kornshell") || exists("b:is_bash")
217 syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
218 syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shCommandSubList
219 syn match shSkipInitWS contained "^\s\+"
220else
Bram Moolenaardf177f62005-02-22 08:39:57 +0000221 syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000222endif
223
224if exists("b:is_bash")
225 syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
226 syn cluster shCaseList add=bashAdminStatement,bashStatement
227 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
228 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
229 syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
230endif
231
232if exists("b:is_kornshell")
233 syn cluster shCommandSubList add=kshSpecialVariables,kshStatement
234 syn cluster shCaseList add=kshStatement
235 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
236 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
237endif
238
239syn match shSource "^\.\s"
240syn match shSource "\s\.\s"
241syn region shColon start="^\s*:" end="$\|" end="#"me=e-1 contains=@shColonList
242
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000243" String And Character Constants: {{{1
244"================================
Bram Moolenaar9964e462007-05-05 17:54:07 +0000245syn match shNumber "-\=\<\d\+\>#\="
246syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained
Bram Moolenaardf177f62005-02-22 08:39:57 +0000247if exists("b:is_bash")
248 syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c.\|\\[abefnrtv]" contained
Bram Moolenaardf177f62005-02-22 08:39:57 +0000249endif
250if exists("b:is_bash")
251 syn region shExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial
252else
Bram Moolenaar9964e462007-05-05 17:54:07 +0000253 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial
Bram Moolenaardf177f62005-02-22 08:39:57 +0000254endif
Bram Moolenaar9964e462007-05-05 17:54:07 +0000255syn region shSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial,@Spell
256syn region shDoubleQuote matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000257syn match shStringSpecial "[^[:print:]]" contained
258syn match shSpecial "\\[\\\"\'`$()#]"
259
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000260" Comments: {{{1
261"==========
Bram Moolenaar071d4272004-06-13 20:20:40 +0000262syn cluster shCommentGroup contains=shTodo,@Spell
Bram Moolenaar18144c82006-04-12 21:52:12 +0000263syn keyword shTodo contained COMBAK FIXME TODO XXX
Bram Moolenaar9964e462007-05-05 17:54:07 +0000264syn match shComment "^#.*$" contains=@shCommentGroup
265syn match shComment "[^0-9]#.*$" contains=@shCommentGroup
Bram Moolenaar071d4272004-06-13 20:20:40 +0000266
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000267" File Redirection Highlighted As Operators: {{{1
268"===========================================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000269syn match shRedir "\d\=>\(&[-0-9]\)\="
270syn match shRedir "\d\=>>-\="
271syn match shRedir "\d\=<\(&[-0-9]\)\="
272syn match shRedir "\d<<-\="
273
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000274" Here Documents: {{{1
275" =========================================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000276if version < 600
277 syn region shHereDoc matchgroup=shRedir start="<<\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList
278 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
279 syn region shHereDoc matchgroup=shRedir start="<<\s*\**EOF\**" matchgroup=shRedir end="^EOF$" contains=@shDblQuoteList
280 syn region shHereDoc matchgroup=shRedir start="<<-\s*\**EOF\**" matchgroup=shRedir end="^\s*EOF$" contains=@shDblQuoteList
281 syn region shHereDoc matchgroup=shRedir start="<<\s*\**\.\**" matchgroup=shRedir end="^\.$" contains=@shDblQuoteList
282 syn region shHereDoc matchgroup=shRedir start="<<-\s*\**\.\**" matchgroup=shRedir end="^\s*\.$" contains=@shDblQuoteList
283
284elseif g:sh_fold_enabled
Bram Moolenaar9964e462007-05-05 17:54:07 +0000285 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000286 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
287 syn region shHereDoc matchgroup=shRedir fold start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
288 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList
289 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
290 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
291 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
292 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
293 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
294 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$"
295 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
296 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000297 syn region shHereDoc matchgroup=shRedir fold start="<<\\\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000298
Bram Moolenaar071d4272004-06-13 20:20:40 +0000299else
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000300 syn region shHereDoc matchgroup=shRedir start="<<\s*\\\=\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList
301 syn region shHereDoc matchgroup=shRedir start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
302 syn region shHereDoc matchgroup=shRedir start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList
303 syn region shHereDoc matchgroup=shRedir start="<<-\s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
304 syn region shHereDoc matchgroup=shRedir start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
305 syn region shHereDoc matchgroup=shRedir start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
306 syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
307 syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$"
308 syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
309 syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
310 syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
311 syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000312 syn region shHereDoc matchgroup=shRedir start="<<\\\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000313endif
314
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000315" Here Strings: {{{1
316" =============
317if exists("b:is_bash")
318 syn match shRedir "<<<"
319endif
320
321" Identifiers: {{{1
322"=============
Bram Moolenaar071d4272004-06-13 20:20:40 +0000323syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier
324syn match shIdWhiteSpace contained "\s"
Bram Moolenaardf177f62005-02-22 08:39:57 +0000325syn match shSetIdentifier contained "=" nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shSingleQuote,shExSingleQuote
Bram Moolenaar071d4272004-06-13 20:20:40 +0000326if exists("b:is_bash")
Bram Moolenaar9964e462007-05-05 17:54:07 +0000327 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
328 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
329 syn match shSet "\<\(declare\|typeset\|local\|export\|set\|unset\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000330elseif exists("b:is_kornshell")
Bram Moolenaar9964e462007-05-05 17:54:07 +0000331 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
332 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
333 syn match shSet "\<\(typeset\|set\|export\|unset\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000334else
Bram Moolenaar9964e462007-05-05 17:54:07 +0000335 syn region shSetList matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$\|\ze[|)]" matchgroup=shOperator end="\ze[|);&]" matchgroup=NONE end="[#=]"me=e-1 contains=@shIdList
336 syn match shStatement "\<\(set\|export\|unset\)\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000337endif
338
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000339" Functions: {{{1
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000340syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo
Bram Moolenaar8dff8182006-04-06 20:18:50 +0000341syn match shFunctionStart "^\s*{" contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000342if g:sh_fold_enabled
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000343 syn region shFunctionOne transparent fold start="^\s*\h\w*\s*()\_s*\ze{" matchgroup=shFunctionStart end="}" contains=@shFunctionList
344 syn region shFunctionTwo transparent fold start="\h\w*\s*\%(()\)\=\_s*\ze{" matchgroup=shFunctionStart end="}" contains=shFunctionKey,@shFunctionList contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000345else
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000346 syn region shFunctionOne transparent start="^\s*\h\w*\s*()\_s*\ze{" matchgroup=shFunctionStart end="}" contains=@shFunctionList
347 syn region shFunctionTwo transparent start="\h\w*\s*\%(()\)\=\_s*\ze{" matchgroup=shFunctionStart end="}" contains=shFunctionKey,@shFunctionList contained
Bram Moolenaar071d4272004-06-13 20:20:40 +0000348endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000349
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000350" Parameter Dereferencing: {{{1
351" ========================
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000352syn match shDerefSimple "\$\%(\h\w*\|\d\)"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000353syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray
354syn match shDerefWordError "[^}$[]" contained
355syn match shDerefSimple "\$[-#*@!?]"
356syn match shDerefSimple "\$\$"
357if exists("b:is_bash") || exists("b:is_kornshell")
358 syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList
359endif
360
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000361" bash: ${!prefix*} and ${#parameter}: {{{1
362" ====================================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000363if exists("b:is_bash")
364 syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp
365 syn match shDerefVar contained "{\@<=!\w\+" nextgroup=@shDerefVarList
366endif
367
368syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError
369syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp
370syn match shDerefVar contained "{\@<=\w\+" nextgroup=@shDerefVarList
371
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000372" sh ksh bash : ${var[... ]...} array reference: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000373syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError
374
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000375" Special ${parameter OPERATOR word} handling: {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000376" sh ksh bash : ${parameter:-word} word is default value
377" sh ksh bash : ${parameter:=word} assign word as default value
378" sh ksh bash : ${parameter:?word} display word if parameter is null
379" sh ksh bash : ${parameter:+word} use word if parameter is not null, otherwise nothing
380" ksh bash : ${parameter#pattern} remove small left pattern
381" ksh bash : ${parameter##pattern} remove large left pattern
382" ksh bash : ${parameter%pattern} remove small right pattern
383" ksh bash : ${parameter%%pattern} remove large right pattern
384syn cluster shDerefPatternList contains=shDerefPattern,shDerefString
385syn match shDerefOpError contained ":[[:punct:]]"
386syn match shDerefOp contained ":\=[-=?]" nextgroup=@shDerefPatternList
387syn match shDerefOp contained ":\=+" nextgroup=@shDerefPatternList
388if exists("b:is_bash") || exists("b:is_kornshell")
389 syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList
390 syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000391 syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern
Bram Moolenaar071d4272004-06-13 20:20:40 +0000392 syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000393 syn match shDerefEscape contained '\%(\\\\\)*\\.'
Bram Moolenaar071d4272004-06-13 20:20:40 +0000394endif
395syn region shDerefString contained matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial
396syn region shDerefString contained matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial
397syn match shDerefString contained "\\["']"
398
Bram Moolenaar071d4272004-06-13 20:20:40 +0000399if exists("b:is_bash")
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000400 " bash : ${parameter:offset}
401 " bash : ${parameter:offset:length}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000402 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 +0000403 syn match shDerefPOL contained ":[^}]\+" contains=@shCommandSubList
404
405 " bash : ${parameter//pattern/string}
406 " bash : ${parameter//pattern}
407 syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft
Bram Moolenaara5792f52005-11-23 21:25:05 +0000408 syn region shDerefPPSleft contained start='.' skip=@\%(\\\)\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000409 syn region shDerefPPSright contained start='.' end='\ze}' contains=@shCommandSubList
Bram Moolenaar071d4272004-06-13 20:20:40 +0000410endif
411
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000412" Useful sh Keywords: {{{1
413" ===================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000414syn keyword shStatement break cd chdir continue eval exec exit kill newgrp pwd read readonly return shift test trap ulimit umask wait
415syn keyword shConditional contained elif else then
416syn keyword shCondError elif else then
417
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000418" Useful ksh Keywords: {{{1
419" ====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000420if exists("b:is_kornshell") || exists("b:is_bash")
Bram Moolenaar071d4272004-06-13 20:20:40 +0000421 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
422
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000423" Useful bash Keywords: {{{1
424" =====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000425 if exists("b:is_bash")
426 syn keyword shStatement bind builtin dirs disown enable help local logout popd pushd shopt source
427 else
428 syn keyword shStatement login newgrp
429 endif
430endif
431
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000432" Synchronization: {{{1
433" ================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000434if !exists("sh_minlines")
435 let sh_minlines = 200
436endif
437if !exists("sh_maxlines")
438 let sh_maxlines = 2 * sh_minlines
439endif
440exec "syn sync minlines=" . sh_minlines . " maxlines=" . sh_maxlines
441syn sync match shCaseEsacSync grouphere shCaseEsac "\<case\>"
442syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>"
443syn sync match shDoSync grouphere shDo "\<do\>"
444syn sync match shDoSync groupthere shDo "\<done\>"
445syn sync match shForSync grouphere shFor "\<for\>"
446syn sync match shForSync groupthere shFor "\<in\>"
447syn sync match shIfSync grouphere shIf "\<if\>"
448syn sync match shIfSync groupthere shIf "\<fi\>"
449syn sync match shUntilSync grouphere shRepeat "\<until\>"
450syn sync match shWhileSync grouphere shRepeat "\<while\>"
451
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000452" Default Highlighting: {{{1
453" =====================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000454hi def link shArithRegion shShellVariables
Bram Moolenaardf177f62005-02-22 08:39:57 +0000455hi def link shBeginHere shRedir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000456hi def link shCaseBar shConditional
Bram Moolenaar071d4272004-06-13 20:20:40 +0000457hi def link shCaseCommandSub shCommandSub
458hi def link shCaseDoubleQuote shDoubleQuote
Bram Moolenaardf177f62005-02-22 08:39:57 +0000459hi def link shCaseIn shConditional
Bram Moolenaar071d4272004-06-13 20:20:40 +0000460hi def link shCaseSingleQuote shSingleQuote
461hi def link shCaseStart shConditional
462hi def link shCmdSubRegion shShellVariables
463hi def link shColon shStatement
Bram Moolenaar071d4272004-06-13 20:20:40 +0000464hi def link shDerefOp shOperator
Bram Moolenaardf177f62005-02-22 08:39:57 +0000465hi def link shDerefPOL shDerefOp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000466hi def link shDerefPPS shDerefOp
Bram Moolenaardf177f62005-02-22 08:39:57 +0000467hi def link shDeref shShellVariables
Bram Moolenaar071d4272004-06-13 20:20:40 +0000468hi def link shDerefSimple shDeref
469hi def link shDerefSpecial shDeref
470hi def link shDerefString shDoubleQuote
Bram Moolenaardf177f62005-02-22 08:39:57 +0000471hi def link shDerefVar shDeref
Bram Moolenaar071d4272004-06-13 20:20:40 +0000472hi def link shDoubleQuote shString
473hi def link shEcho shString
474hi def link shEmbeddedEcho shString
Bram Moolenaardf177f62005-02-22 08:39:57 +0000475hi def link shExSingleQuote shSingleQuote
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000476hi def link shFunctionStart Delimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000477hi def link shHereDoc shString
Bram Moolenaardf177f62005-02-22 08:39:57 +0000478hi def link shHerePayload shHereDoc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000479hi def link shLoop shStatement
480hi def link shOption shCommandSub
481hi def link shPattern shString
482hi def link shPosnParm shShellVariables
483hi def link shRange shOperator
484hi def link shRedir shOperator
485hi def link shSingleQuote shString
486hi def link shSource shOperator
487hi def link shStringSpecial shSpecial
488hi def link shSubShRegion shOperator
489hi def link shTestOpr shConditional
Bram Moolenaar9964e462007-05-05 17:54:07 +0000490hi def link shTestPattern shString
491hi def link shTestDoubleQuote shString
492hi def link shTestSingleQuote shString
Bram Moolenaar071d4272004-06-13 20:20:40 +0000493hi def link shVariable shSetList
494hi def link shWrapLineOperator shOperator
495
496if exists("b:is_bash")
497 hi def link bashAdminStatement shStatement
498 hi def link bashSpecialVariables shShellVariables
499 hi def link bashStatement shStatement
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000500 hi def link shFunctionParen Delimiter
501 hi def link shFunctionDelim Delimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000502endif
503if exists("b:is_kornshell")
504 hi def link kshSpecialVariables shShellVariables
505 hi def link kshStatement shStatement
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000506 hi def link shFunctionParen Delimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +0000507endif
508
509hi def link shCaseError Error
510hi def link shCondError Error
511hi def link shCurlyError Error
512hi def link shDerefError Error
513hi def link shDerefOpError Error
514hi def link shDerefWordError Error
515hi def link shDoError Error
516hi def link shEsacError Error
517hi def link shIfError Error
518hi def link shInError Error
519hi def link shParenError Error
520hi def link shTestError Error
521if exists("b:is_kornshell")
522 hi def link shDTestError Error
523endif
524
525hi def link shArithmetic Special
526hi def link shCharClass Identifier
527hi def link shSnglCase Statement
528hi def link shCommandSub Special
529hi def link shComment Comment
530hi def link shConditional Conditional
Bram Moolenaar9964e462007-05-05 17:54:07 +0000531hi def link shCtrlSeq Special
Bram Moolenaar071d4272004-06-13 20:20:40 +0000532hi def link shExprRegion Delimiter
Bram Moolenaarcd71fa32005-03-11 22:46:48 +0000533hi def link shFunctionKey Function
Bram Moolenaar071d4272004-06-13 20:20:40 +0000534hi def link shFunctionName Function
535hi def link shNumber Number
536hi def link shOperator Operator
537hi def link shRepeat Repeat
538hi def link shSet Statement
539hi def link shSetList Identifier
540hi def link shShellVariables PreProc
541hi def link shSpecial Special
542hi def link shStatement Statement
543hi def link shString String
544hi def link shTodo Todo
545hi def link shAlias Identifier
546
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000547" Set Current Syntax: {{{1
548" ===================
Bram Moolenaar071d4272004-06-13 20:20:40 +0000549if exists("b:is_bash")
550 let b:current_syntax = "bash"
551elseif exists("b:is_kornshell")
552 let b:current_syntax = "ksh"
553else
554 let b:current_syntax = "sh"
555endif
556
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000557" vim: ts=16 fdm=marker