Mercurial > vim
comparison runtime/syntax/sh.vim @ 1668:0b796e045c42 v7.2b.000
updated for version 7.2b-000
author | vimboss |
---|---|
date | Sun, 13 Jul 2008 17:41:49 +0000 |
parents | 73fe8baea242 |
children | f4f8014d516e |
comparison
equal
deleted
inserted
replaced
1667:131dbd3d2a4b | 1668:0b796e045c42 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: shell (sh) Korn shell (ksh) bash (sh) | 2 " Language: shell (sh) Korn shell (ksh) bash (sh) |
3 " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> | 3 " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> |
4 " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> | 4 " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> |
5 " Last Change: Apr 24, 2008 | 5 " Last Change: Jul 01, 2008 |
6 " Version: 90 | 6 " Version: 100 |
7 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax | 7 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax |
8 " | 8 " For options and settings, please use: :help ft-sh-syntax |
9 " Using the following VIM variables: {{{1 | |
10 " 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 | |
13 " 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 | |
17 " g:sh_fold_enabled if non-zero, syntax folding is enabled | |
18 " g:sh_minlines sets up syn sync minlines (dflt: 200) | |
19 " g:sh_maxlines sets up syn sync maxlines (dflt: 2x sh_minlines) | |
20 " | |
21 " This file includes many ideas from Éric Brunet (eric.brunet@ens.fr) | 9 " This file includes many ideas from Éric Brunet (eric.brunet@ens.fr) |
22 | 10 |
23 " For version 5.x: Clear all syntax items {{{1 | 11 " For version 5.x: Clear all syntax items {{{1 |
24 " For version 6.x: Quit when a syntax file was already loaded | 12 " For version 6.x: Quit when a syntax file was already loaded |
25 if version < 600 | 13 if version < 600 |
52 else | 40 else |
53 let b:is_sh= 1 | 41 let b:is_sh= 1 |
54 endif | 42 endif |
55 endif | 43 endif |
56 | 44 |
45 " adjust iskeyword for shell characters | |
46 "setlocal isk=@,48-57,_,192-255,#,.,/ | |
47 | |
57 " set up default g:sh_fold_enabled {{{1 | 48 " set up default g:sh_fold_enabled {{{1 |
58 if !exists("g:sh_fold_enabled") | 49 if !exists("g:sh_fold_enabled") |
59 let g:sh_fold_enabled= 0 | 50 let g:sh_fold_enabled= 0 |
60 elseif g:sh_fold_enabled != 0 && !has("folding") | 51 elseif g:sh_fold_enabled != 0 && !has("folding") |
61 let g:sh_fold_enabled= 0 | 52 let g:sh_fold_enabled= 0 |
62 echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support" | 53 echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support" |
63 endif | 54 endif |
55 if !exists("s:sh_fold_functions") | |
56 let s:sh_fold_functions = 1 | |
57 endif | |
58 if !exists("s:sh_fold_heredoc") | |
59 let s:sh_fold_heredoc = 2 | |
60 endif | |
61 if !exists("s:sh_fold_ifdofor") | |
62 let s:sh_fold_ifdofor = 4 | |
63 endif | |
64 if g:sh_fold_enabled && &fdm == "manual" | 64 if g:sh_fold_enabled && &fdm == "manual" |
65 set fdm=syntax | 65 set fdm=syntax |
66 endif | 66 endif |
67 | 67 |
68 " sh syntax is case sensitive {{{1 | 68 " sh syntax is case sensitive {{{1 |
69 syn case match | 69 syn case match |
70 | 70 |
71 " Clusters: contains=@... clusters {{{1 | 71 " Clusters: contains=@... clusters {{{1 |
72 "================================== | 72 "================================== |
73 syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq | 73 syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError |
74 if exists("b:is_kornshell") | |
75 syn cluster ErrorList add=shDTestError | |
76 endif | |
77 syn cluster shArithParenList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen | |
78 syn cluster shArithList contains=@shArithParenList,shParenError | |
79 syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial | |
74 syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq | 80 syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq |
75 syn cluster shColonList contains=@shCaseList | 81 syn cluster shColonList contains=@shCaseList |
76 syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq | 82 syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial |
77 syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial | 83 syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial |
78 syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq,shSpecial | 84 syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq,shSpecial |
79 syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS | 85 syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS |
80 syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError | 86 syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError |
81 syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq | 87 syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote |
82 syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq | 88 syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq |
83 syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest | 89 syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest |
84 syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shFunctionStart,shCtrlSeq | 90 syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq |
85 if exists("b:is_kornshell") || exists("b:is_bash") | 91 if exists("b:is_kornshell") || exists("b:is_bash") |
92 syn cluster shFunctionList add=shRepeat | |
86 syn cluster shFunctionList add=shDblBrace,shDblParen | 93 syn cluster shFunctionList add=shDblBrace,shDblParen |
87 endif | 94 endif |
88 syn cluster shHereBeginList contains=@shCommandSubList | 95 syn cluster shHereBeginList contains=@shCommandSubList |
89 syn cluster shHereList contains=shBeginHere,shHerePayload | 96 syn cluster shHereList contains=shBeginHere,shHerePayload |
90 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload | 97 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload |
91 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shIdWhiteSpace,shDeref,shDerefSimple,shRedir,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq | 98 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial |
92 syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest | 99 syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest,@shErrorList,shSet |
93 syn cluster shSubShList contains=@shCaseList,shOperator | 100 syn cluster shSubShList contains=@shCaseList,shOperator |
94 syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shDoubleQuote,shExpr,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq | 101 syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shDoubleQuote,shExpr,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq |
95 | 102 |
96 | 103 |
97 " Echo: {{{1 | 104 " Echo: {{{1 |
98 " ==== | 105 " ==== |
99 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct | 106 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct |
100 syn 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 | 107 syn 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 skipwhite nextgroup=shQuickComment |
101 syn 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 | 108 syn 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 skipwhite nextgroup=shQuickComment |
102 | 109 syn match shEchoQuote contained '\%(\\\\\)*\\["`']' |
103 " This must be after the strings, so that bla \" be correct | 110 |
111 " This must be after the strings, so that ... \" will be correct | |
104 syn 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 | 112 syn 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 |
105 | 113 |
106 " Alias: {{{1 | 114 " Alias: {{{1 |
107 " ===== | 115 " ===== |
108 if exists("b:is_kornshell") || exists("b:is_bash") | 116 if exists("b:is_kornshell") || exists("b:is_bash") |
123 if exists("b:is_kornshell") | 131 if exists("b:is_kornshell") |
124 syn match shDTestError "]]" | 132 syn match shDTestError "]]" |
125 endif | 133 endif |
126 syn match shTestError "]" | 134 syn match shTestError "]" |
127 | 135 |
128 " Options Interceptor: {{{1 | 136 " Options: {{{1 |
129 " ==================== | 137 " ==================== |
130 syn match shOption "\s[\-+][a-zA-Z0-9]\+\>"ms=s+1 | 138 syn match shOption "\s\zs[-+][a-zA-Z0-9]\+\>" |
131 syn match shOption "\s--[^ \t$`'"|]\+"ms=s+1 | 139 syn match shOption "\s\zs--[^ \t$`'"|]\+" |
132 | 140 |
133 " File Redirection Highlighted As Operators: {{{1 | 141 " File Redirection Highlighted As Operators: {{{1 |
134 "=========================================== | 142 "=========================================== |
135 syn match shRedir "\d\=>\(&[-0-9]\)\=" | 143 syn match shRedir "\d\=>\(&[-0-9]\)\=" |
136 syn match shRedir "\d\=>>-\=" | 144 syn match shRedir "\d\=>>-\=" |
138 syn match shRedir "\d<<-\=" | 146 syn match shRedir "\d<<-\=" |
139 | 147 |
140 " Operators: {{{1 | 148 " Operators: {{{1 |
141 " ========== | 149 " ========== |
142 syn match shOperator "<<\|>>" contained | 150 syn match shOperator "<<\|>>" contained |
143 syn match shOperator "[!&;|]" | 151 syn match shOperator "[!&;|]" contained |
144 syn match shOperator "\[[[^:]\|\]]" | 152 syn match shOperator "\[[[^:]\|\]]" contained |
145 syn match shOperator "!\==" skipwhite nextgroup=shPattern | 153 syn match shOperator "!\==" skipwhite nextgroup=shPattern |
146 syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shDoubleQuote,shDeref | 154 syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shDoubleQuote,shDeref |
147 | 155 |
148 " Subshells: {{{1 | 156 " Subshells: {{{1 |
149 " ========== | 157 " ========== |
170 " ========================= | 178 " ========================= |
171 syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]" | 179 syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]" |
172 | 180 |
173 " Loops: do, if, while, until {{{1 | 181 " Loops: do, if, while, until {{{1 |
174 " ====== | 182 " ====== |
175 if g:sh_fold_enabled | 183 if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor |
176 syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList | 184 syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList |
177 syn region shIf fold transparent matchgroup=shConditional start="\<if\>" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>" contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey | 185 syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>" contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey |
178 syn region shFor fold matchgroup=shLoop start="\<for\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn | 186 syn region shFor fold matchgroup=shLoop start="\<for\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn |
179 else | 187 else |
180 syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList | 188 syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList |
181 syn region shIf transparent matchgroup=shConditional start="\<if\>" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>" contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey | 189 syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>" contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey |
182 syn region shFor matchgroup=shLoop start="\<for\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn | 190 syn region shFor matchgroup=shLoop start="\<for\_s" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn |
183 endif | 191 endif |
184 if exists("b:is_kornshell") || exists("b:is_bash") | 192 if exists("b:is_kornshell") || exists("b:is_bash") |
185 syn cluster shCaseList add=shRepeat | 193 syn cluster shCaseList add=shRepeat |
186 syn region shRepeat matchgroup=shLoop start="\<while\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace | 194 syn cluster shFunctionList add=shRepeat |
187 syn region shRepeat matchgroup=shLoop start="\<until\>" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace | 195 syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace |
188 syn region shCaseEsac matchgroup=shConditional start="\<select\>" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList | 196 syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen,shDblBrace |
189 else | 197 syn region shCaseEsac matchgroup=shConditional start="\<select\s" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList |
190 syn region shRepeat matchgroup=shLoop start="\<while\>" end="\<do\>"me=e-2 contains=@shLoopList | 198 else |
191 syn region shRepeat matchgroup=shLoop start="\<until\>" end="\<do\>"me=e-2 contains=@shLoopList | 199 syn region shRepeat matchgroup=shLoop start="\<while\_s" end="\<do\>"me=e-2 contains=@shLoopList |
200 syn region shRepeat matchgroup=shLoop start="\<until\_s" end="\<do\>"me=e-2 contains=@shLoopList | |
192 endif | 201 endif |
193 syn region shCurlyIn contained matchgroup=Delimiter start="{" end="}" contains=@shCurlyList | 202 syn region shCurlyIn contained matchgroup=Delimiter start="{" end="}" contains=@shCurlyList |
194 syn match shComma contained "," | 203 syn match shComma contained "," |
195 | 204 |
196 " Case: case...esac {{{1 | 205 " Case: case...esac {{{1 |
197 " ==== | 206 " ==== |
198 syn match shCaseBar contained skipwhite "[^|"`'()]\{-}|"hs=e nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote | 207 syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote |
199 syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar | 208 syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar |
200 syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\([^#$()'" \t]\|\\.\)\{-})"ms=s,hs=e end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment | 209 syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment |
201 if g:sh_fold_enabled | 210 if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor |
202 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList | 211 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList |
203 else | 212 else |
204 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList | 213 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList |
205 endif | 214 endif |
206 syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote | 215 syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote |
207 if exists("b:is_bash") | 216 if exists("b:is_bash") |
208 syn region shCaseExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained | 217 syn region shCaseExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained |
209 syn region shCaseExDoubleQuote matchgroup=shOperator start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial,shSpecial,shCommandSub,shDeref skipwhite skipnl nextgroup=shCaseBar contained | |
210 else | 218 else |
211 syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained | 219 syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained |
212 endif | 220 endif |
213 syn region shCaseSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained | 221 syn region shCaseSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained |
214 syn region shCaseDoubleQuote matchgroup=shOperator start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained | 222 syn region shCaseDoubleQuote matchgroup=shOperator start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained |
216 | 224 |
217 " Misc: {{{1 | 225 " Misc: {{{1 |
218 "====== | 226 "====== |
219 syn match shWrapLineOperator "\\$" | 227 syn match shWrapLineOperator "\\$" |
220 syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList | 228 syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList |
229 syn match shEscape contained '\\.' | |
221 | 230 |
222 " $() and $(()): {{{1 | 231 " $() and $(()): {{{1 |
223 " $(..) is not supported by sh (Bourne shell). However, apparently | 232 " $(..) is not supported by sh (Bourne shell). However, apparently |
224 " some systems (HP?) have as their /bin/sh a (link to) Korn shell | 233 " some systems (HP?) have as their /bin/sh a (link to) Korn shell |
225 " (ie. Posix compliant shell). /bin/ksh should work for those | 234 " (ie. Posix compliant shell). /bin/ksh should work for those |
226 " systems too, however, so the following syntax will flag $(..) as | 235 " systems too, however, so the following syntax will flag $(..) as |
227 " an Error under /bin/sh. By consensus of vimdev'ers! | 236 " an Error under /bin/sh. By consensus of vimdev'ers! |
228 if exists("b:is_kornshell") || exists("b:is_bash") | 237 if exists("b:is_kornshell") || exists("b:is_bash") |
229 syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList | 238 syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList |
230 syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shCommandSubList | 239 syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList |
231 syn match shSkipInitWS contained "^\s\+" | 240 syn match shSkipInitWS contained "^\s\+" |
232 else | 241 else |
233 syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList | 242 syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList |
234 endif | 243 endif |
235 | 244 |
259 if exists("b:is_bash") | 268 if exists("b:is_bash") |
260 syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c.\|\\[abefnrtv]" contained | 269 syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c.\|\\[abefnrtv]" contained |
261 endif | 270 endif |
262 if exists("b:is_bash") | 271 if exists("b:is_bash") |
263 syn region shExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial | 272 syn region shExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial |
264 syn region shExDoubleQuote matchgroup=shOperator start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial,shSpecial,shCommandSub,shDeref | |
265 else | 273 else |
266 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial | 274 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial |
267 endif | 275 endif |
268 syn region shSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial,@Spell | 276 syn region shSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial,@Spell |
269 syn region shDoubleQuote matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell | 277 syn region shDoubleQuote matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell |
275 " Comments: {{{1 | 283 " Comments: {{{1 |
276 "========== | 284 "========== |
277 syn cluster shCommentGroup contains=shTodo,@Spell | 285 syn cluster shCommentGroup contains=shTodo,@Spell |
278 syn keyword shTodo contained COMBAK FIXME TODO XXX | 286 syn keyword shTodo contained COMBAK FIXME TODO XXX |
279 syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup | 287 syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup |
280 syn match shComment "#.*$" contains=@shCommentGroup | 288 syn match shComment "\s\zs#.*$" contains=@shCommentGroup |
289 syn match shQuickComment contained "#.*$" | |
281 | 290 |
282 " Here Documents: {{{1 | 291 " Here Documents: {{{1 |
283 " ========================================= | 292 " ========================================= |
284 if version < 600 | 293 if version < 600 |
285 syn region shHereDoc matchgroup=shRedir start="<<\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList | 294 syn region shHereDoc matchgroup=shRedir start="<<\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList |
287 syn region shHereDoc matchgroup=shRedir start="<<\s*\**EOF\**" matchgroup=shRedir end="^EOF$" contains=@shDblQuoteList | 296 syn region shHereDoc matchgroup=shRedir start="<<\s*\**EOF\**" matchgroup=shRedir end="^EOF$" contains=@shDblQuoteList |
288 syn region shHereDoc matchgroup=shRedir start="<<-\s*\**EOF\**" matchgroup=shRedir end="^\s*EOF$" contains=@shDblQuoteList | 297 syn region shHereDoc matchgroup=shRedir start="<<-\s*\**EOF\**" matchgroup=shRedir end="^\s*EOF$" contains=@shDblQuoteList |
289 syn region shHereDoc matchgroup=shRedir start="<<\s*\**\.\**" matchgroup=shRedir end="^\.$" contains=@shDblQuoteList | 298 syn region shHereDoc matchgroup=shRedir start="<<\s*\**\.\**" matchgroup=shRedir end="^\.$" contains=@shDblQuoteList |
290 syn region shHereDoc matchgroup=shRedir start="<<-\s*\**\.\**" matchgroup=shRedir end="^\s*\.$" contains=@shDblQuoteList | 299 syn region shHereDoc matchgroup=shRedir start="<<-\s*\**\.\**" matchgroup=shRedir end="^\s*\.$" contains=@shDblQuoteList |
291 | 300 |
292 elseif g:sh_fold_enabled | 301 elseif (g:sh_fold_enabled % (s:sh_fold_heredoc * 2))/s:sh_fold_heredoc |
293 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList | 302 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList |
294 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$" | 303 syn region shHereDoc matchgroup=shRedir fold start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$" |
295 syn region shHereDoc matchgroup=shRedir fold start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$" | 304 syn region shHereDoc matchgroup=shRedir fold start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$" |
296 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList | 305 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList |
297 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$" | 306 syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$" |
326 syn match shRedir "<<<" | 335 syn match shRedir "<<<" |
327 endif | 336 endif |
328 | 337 |
329 " Identifiers: {{{1 | 338 " Identifiers: {{{1 |
330 "============= | 339 "============= |
331 syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier | 340 syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained |
332 syn match shIdWhiteSpace contained "\s" | 341 syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier |
333 syn match shSetIdentifier contained "=" nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shSingleQuote,shExSingleQuote | 342 syn match shSetIdentifier "=" contained nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shSingleQuote,shExSingleQuote |
334 if exists("b:is_bash") | 343 if exists("b:is_bash") |
335 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 | 344 syn region shSetList oneline matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze#\|=" contains=@shIdList |
336 syn region shSetList matchgroup=shSet start="\<set\>[^/]"me=e-1 end="$" end="\\ze[|)]" matchgroup=shOperator end="\ze[|);&]"me=e-1 matchgroup=NONE end="[#=]"me=e-1 contains=@shIdList | 345 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|)]\|$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze[#=]" contains=@shIdList |
337 syn match shSet "\<\(declare\|typeset\|local\|export\|set\|unset\)\>" | |
338 elseif exists("b:is_kornshell") | 346 elseif exists("b:is_kornshell") |
339 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 | 347 syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze[#=]" contains=@shIdList |
340 syn region shSetList matchgroup=shSet start="\<set\>\ze[^/]" end="$\|\ze[})]" matchgroup=shOperator end="\ze[|);&]"me=e-1 matchgroup=NONE end="[#=]"me=e-1 contains=@shIdList | 348 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze[#=]" contains=@shIdList |
341 syn match shSet "\<\(typeset\|set\|export\|unset\)\>" | 349 else |
342 else | 350 syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze[#=]" contains=@shIdList |
343 syn region shSetList matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$\|\ze[|)]" matchgroup=shOperator end="\ze[|);&]" matchgroup=NONE end="[#=]"me=e-1 contains=@shIdList | |
344 syn match shStatement "\<\(set\|export\|unset\)\>" | |
345 endif | 351 endif |
346 | 352 |
347 " Functions: {{{1 | 353 " Functions: {{{1 |
348 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo | 354 if !exists("g:is_posix") |
349 " COMBAK -- look at bash09. function foo() (line#35) is folding 38 lines. Not being terminated properly | 355 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo |
350 "syn match shFunctionStart "{" contained | 356 endif |
351 if g:sh_fold_enabled | 357 |
352 syn region shFunctionOne transparent fold start="^\s*\h\w*\s*()\_s*\ze{" matchgroup=shFunctionStart end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart | 358 if exists("b:is_bash") |
353 syn region shFunctionTwo transparent fold start="\h\w*\s*\%(()\)\=\_s*\ze{" matchgroup=shFunctionStart end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart | 359 if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions |
354 else | 360 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
355 syn region shFunctionOne transparent start="^\s*\h\w*\s*()\_s*\ze{" matchgroup=shFunctionStart end="}" contains=@shFunctionList | 361 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 |
356 syn region shFunctionTwo transparent start="\h\w*\s*\%(()\)\=\_s*\ze{" matchgroup=shFunctionStart end="}" contains=shFunctionKey,@shFunctionList contained | 362 else |
363 syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList | |
364 syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained | |
365 endif | |
366 else | |
367 if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions | |
368 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | |
369 syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | |
370 else | |
371 syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList | |
372 syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained | |
373 endif | |
357 endif | 374 endif |
358 | 375 |
359 " Parameter Dereferencing: {{{1 | 376 " Parameter Dereferencing: {{{1 |
360 " ======================== | 377 " ======================== |
361 syn match shDerefSimple "\$\%(\h\w*\|\d\)" | 378 syn match shDerefSimple "\$\%(\h\w*\|\d\)" |
363 syn match shDerefWordError "[^}$[]" contained | 380 syn match shDerefWordError "[^}$[]" contained |
364 syn match shDerefSimple "\$[-#*@!?]" | 381 syn match shDerefSimple "\$[-#*@!?]" |
365 syn match shDerefSimple "\$\$" | 382 syn match shDerefSimple "\$\$" |
366 if exists("b:is_bash") || exists("b:is_kornshell") | 383 if exists("b:is_bash") || exists("b:is_kornshell") |
367 syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList | 384 syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList |
385 syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList | |
368 endif | 386 endif |
369 | 387 |
370 " bash: ${!prefix*} and ${#parameter}: {{{1 | 388 " bash: ${!prefix*} and ${#parameter}: {{{1 |
371 " ==================================== | 389 " ==================================== |
372 if exists("b:is_bash") | 390 if exists("b:is_bash") |
399 syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList | 417 syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList |
400 syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern | 418 syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern |
401 syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern | 419 syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern |
402 syn match shDerefEscape contained '\%(\\\\\)*\\.' | 420 syn match shDerefEscape contained '\%(\\\\\)*\\.' |
403 endif | 421 endif |
404 syn region shDerefString contained matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial | 422 syn region shDerefString contained matchgroup=shOperator start=+\%(\\\)\@<!'+ end=+'+ contains=shStringSpecial |
405 syn region shDerefString contained matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial | 423 syn region shDerefString contained matchgroup=shOperator start=+\%(\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial |
406 syn match shDerefString contained "\\["']" | 424 syn match shDerefString contained "\\["']" nextgroup=shDerefPattern |
407 | 425 |
408 if exists("b:is_bash") | 426 if exists("b:is_bash") |
409 " bash : ${parameter:offset} | 427 " bash : ${parameter:offset} |
410 " bash : ${parameter:offset:length} | 428 " bash : ${parameter:offset:length} |
411 syn region shDerefOp contained start=":[$[:alnum:]_]"me=e-1 end=":"me=e-1 end="}"me=e-1 contains=@shCommandSubList nextgroup=shDerefPOL | 429 syn region shDerefOp contained start=":[$[:alnum:]_]"me=e-1 end=":"me=e-1 end="}"me=e-1 contains=@shCommandSubList nextgroup=shDerefPOL |
416 syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft | 434 syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft |
417 syn region shDerefPPSleft contained start='.' skip=@\%(\\\)\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList | 435 syn region shDerefPPSleft contained start='.' skip=@\%(\\\)\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList |
418 syn region shDerefPPSright contained start='.' end='\ze}' contains=@shCommandSubList | 436 syn region shDerefPPSright contained start='.' end='\ze}' contains=@shCommandSubList |
419 endif | 437 endif |
420 | 438 |
439 " Arithmetic Parenthesized Expressions: {{{1 | |
440 syn region shParen matchgroup=shArithRegion start='(\ze[^(]' end=')' contains=@shArithParenList | |
441 | |
421 " Useful sh Keywords: {{{1 | 442 " Useful sh Keywords: {{{1 |
422 " =================== | 443 " =================== |
423 syn keyword shStatement break cd chdir continue eval exec exit kill newgrp pwd read readonly return shift test trap ulimit umask wait | 444 syn keyword shStatement break cd chdir continue eval exec exit kill newgrp pwd read readonly return shift test trap ulimit umask wait |
424 syn keyword shConditional contained elif else then | 445 syn keyword shConditional contained elif else then |
425 syn keyword shCondError elif else then | 446 syn keyword shCondError elif else then |
426 | 447 |
427 " Useful ksh Keywords: {{{1 | 448 " Useful ksh Keywords: {{{1 |
428 " ==================== | 449 " ==================== |
429 if exists("b:is_kornshell") || exists("b:is_bash") | 450 if exists("b:is_kornshell") || exists("b:is_bash") |
430 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 | 451 syn keyword shStatement autoload bg false fc fg functions getopts hash history integer jobs let nohup print printf r stop suspend times true type unalias whence |
452 if exists("g:is_posix") | |
453 syn keyword shStatement command | |
454 else | |
455 syn keyword shStatement time | |
456 endif | |
431 | 457 |
432 " Useful bash Keywords: {{{1 | 458 " Useful bash Keywords: {{{1 |
433 " ===================== | 459 " ===================== |
434 if exists("b:is_bash") | 460 if exists("b:is_bash") |
435 syn keyword shStatement bind builtin dirs disown enable help local logout popd pushd shopt source | 461 syn keyword shStatement bind builtin dirs disown enable help local logout popd pushd shopt source |
465 hi def link shCaseBar shConditional | 491 hi def link shCaseBar shConditional |
466 hi def link shCaseCommandSub shCommandSub | 492 hi def link shCaseCommandSub shCommandSub |
467 hi def link shCaseDoubleQuote shDoubleQuote | 493 hi def link shCaseDoubleQuote shDoubleQuote |
468 hi def link shCaseIn shConditional | 494 hi def link shCaseIn shConditional |
469 hi def link shCaseSingleQuote shSingleQuote | 495 hi def link shCaseSingleQuote shSingleQuote |
470 hi def link shCaseDoubleQuote shSingleQuote | |
471 hi def link shCaseStart shConditional | 496 hi def link shCaseStart shConditional |
472 hi def link shCmdSubRegion shShellVariables | 497 hi def link shCmdSubRegion shShellVariables |
473 hi def link shColon shStatement | 498 hi def link shColon shStatement |
474 hi def link shDerefOp shOperator | 499 hi def link shDerefOp shOperator |
475 hi def link shDerefPOL shDerefOp | 500 hi def link shDerefPOL shDerefOp |
479 hi def link shDerefSpecial shDeref | 504 hi def link shDerefSpecial shDeref |
480 hi def link shDerefString shDoubleQuote | 505 hi def link shDerefString shDoubleQuote |
481 hi def link shDerefVar shDeref | 506 hi def link shDerefVar shDeref |
482 hi def link shDoubleQuote shString | 507 hi def link shDoubleQuote shString |
483 hi def link shEcho shString | 508 hi def link shEcho shString |
509 hi def link shEchoQuote shString | |
484 hi def link shEmbeddedEcho shString | 510 hi def link shEmbeddedEcho shString |
511 hi def link shEscape shCommandSub | |
485 hi def link shExSingleQuote shSingleQuote | 512 hi def link shExSingleQuote shSingleQuote |
486 hi def link shExDoubleQuote shSingleQuote | 513 hi def link shFunction Function |
487 hi def link shFunctionStart Delimiter | |
488 hi def link shHereDoc shString | 514 hi def link shHereDoc shString |
489 hi def link shHerePayload shHereDoc | 515 hi def link shHerePayload shHereDoc |
490 hi def link shLoop shStatement | 516 hi def link shLoop shStatement |
491 hi def link shOption shCommandSub | 517 hi def link shOption shCommandSub |
492 hi def link shPattern shString | 518 hi def link shPattern shString |
519 hi def link shParen shArithmetic | |
493 hi def link shPosnParm shShellVariables | 520 hi def link shPosnParm shShellVariables |
521 hi def link shQuickComment shComment | |
494 hi def link shRange shOperator | 522 hi def link shRange shOperator |
495 hi def link shRedir shOperator | 523 hi def link shRedir shOperator |
524 hi def link shSetOption shOption | |
496 hi def link shSingleQuote shString | 525 hi def link shSingleQuote shString |
497 hi def link shSource shOperator | 526 hi def link shSource shOperator |
498 hi def link shStringSpecial shSpecial | 527 hi def link shStringSpecial shSpecial |
499 hi def link shSubShRegion shOperator | 528 hi def link shSubShRegion shOperator |
500 hi def link shTestOpr shConditional | 529 hi def link shTestOpr shConditional |