Mercurial > vim
comparison runtime/syntax/sh.vim @ 1201:4d2585cf5950
updated for version 7.1b
author | vimboss |
---|---|
date | Thu, 10 May 2007 17:35:54 +0000 |
parents | e63691e7c504 |
children | 73fe8baea242 |
comparison
equal
deleted
inserted
replaced
1200:f58cb9bf1260 | 1201:4d2585cf5950 |
---|---|
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: Sep 15, 2006 | 5 " Last Change: Dec 12, 2006 |
6 " Version: 88 | 6 " Version: 89 |
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 " |
9 " Using the following VIM variables: {{{1 | 9 " Using the following VIM variables: {{{1 |
10 " g:is_bash if none of the previous three variables are | 10 " g:is_bash if none of the previous three variables are |
11 " defined, then if g:is_bash is set enhance with | 11 " defined, then if g:is_bash is set enhance with |
73 syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq | 73 syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq |
74 syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq | 74 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 | 75 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 | 76 syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq |
77 syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial | 77 syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial |
78 syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq | 78 syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq,shSpecial |
79 syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS | 79 syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS |
80 syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError | 80 syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError |
81 syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq | 81 syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq |
82 syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq | 82 syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq |
83 syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest | 83 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 | 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 |
85 if exists("b:is_kornshell") || exists("b:is_bash") | |
86 syn cluster shFunctionList add=shDblBrace,shDblParen | |
87 endif | |
85 syn cluster shHereBeginList contains=@shCommandSubList | 88 syn cluster shHereBeginList contains=@shCommandSubList |
86 syn cluster shHereList contains=shBeginHere,shHerePayload | 89 syn cluster shHereList contains=shBeginHere,shHerePayload |
87 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload | 90 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload |
88 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shIdWhiteSpace,shDeref,shDerefSimple,shRedir,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq | 91 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shIdWhiteSpace,shDeref,shDerefSimple,shRedir,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq |
89 syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest | 92 syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest |
90 syn cluster shSubShList contains=@shCaseList | 93 syn cluster shSubShList contains=@shCaseList,shOperator |
91 syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shDoubleQuote,shExpr,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq | 94 syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shDoubleQuote,shExpr,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq |
92 | 95 |
93 | 96 |
94 " Echo: {{{1 | 97 " Echo: {{{1 |
95 " ==== | 98 " ==== |
125 " Options Interceptor: {{{1 | 128 " Options Interceptor: {{{1 |
126 " ==================== | 129 " ==================== |
127 syn match shOption "\s[\-+][a-zA-Z0-9]\+\>"ms=s+1 | 130 syn match shOption "\s[\-+][a-zA-Z0-9]\+\>"ms=s+1 |
128 syn match shOption "\s--[^ \t$`'"|]\+"ms=s+1 | 131 syn match shOption "\s--[^ \t$`'"|]\+"ms=s+1 |
129 | 132 |
133 " File Redirection Highlighted As Operators: {{{1 | |
134 "=========================================== | |
135 syn match shRedir "\d\=>\(&[-0-9]\)\=" | |
136 syn match shRedir "\d\=>>-\=" | |
137 syn match shRedir "\d\=<\(&[-0-9]\)\=" | |
138 syn match shRedir "\d<<-\=" | |
139 | |
130 " Operators: {{{1 | 140 " Operators: {{{1 |
131 " ========== | 141 " ========== |
142 syn match shOperator "<<\|>>" contained | |
132 syn match shOperator "[!&;|]" | 143 syn match shOperator "[!&;|]" |
133 syn match shOperator "\[[[^:]\|\]]" | 144 syn match shOperator "\[[[^:]\|\]]" |
134 syn match shOperator "!\==" skipwhite nextgroup=shPattern | 145 syn match shOperator "!\==" skipwhite nextgroup=shPattern |
135 syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shDoubleQuote,shDeref | 146 syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shDoubleQuote,shDeref |
136 | 147 |
184 | 195 |
185 " Case: case...esac {{{1 | 196 " Case: case...esac {{{1 |
186 " ==== | 197 " ==== |
187 syn match shCaseBar contained skipwhite "[^|"`'()]\{-}|"hs=e nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote | 198 syn match shCaseBar contained skipwhite "[^|"`'()]\{-}|"hs=e nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote |
188 syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar | 199 syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar |
189 syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="[^#$()'"]\{-})"ms=s,hs=e end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment | 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 |
190 if g:sh_fold_enabled | 201 if g:sh_fold_enabled |
191 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList | 202 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList |
192 else | 203 else |
193 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList | 204 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList |
194 endif | 205 endif |
253 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial | 264 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial |
254 endif | 265 endif |
255 syn region shSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial,@Spell | 266 syn region shSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial,@Spell |
256 syn region shDoubleQuote matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell | 267 syn region shDoubleQuote matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell |
257 syn match shStringSpecial "[^[:print:]]" contained | 268 syn match shStringSpecial "[^[:print:]]" contained |
258 syn match shSpecial "\\[\\\"\'`$()#]" | 269 syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" |
270 syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" | |
271 syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" | |
259 | 272 |
260 " Comments: {{{1 | 273 " Comments: {{{1 |
261 "========== | 274 "========== |
262 syn cluster shCommentGroup contains=shTodo,@Spell | 275 syn cluster shCommentGroup contains=shTodo,@Spell |
263 syn keyword shTodo contained COMBAK FIXME TODO XXX | 276 syn keyword shTodo contained COMBAK FIXME TODO XXX |
264 syn match shComment "^#.*$" contains=@shCommentGroup | 277 syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup |
265 syn match shComment "[^0-9]#.*$" contains=@shCommentGroup | 278 syn match shComment "#.*$" contains=@shCommentGroup |
266 | |
267 " File Redirection Highlighted As Operators: {{{1 | |
268 "=========================================== | |
269 syn match shRedir "\d\=>\(&[-0-9]\)\=" | |
270 syn match shRedir "\d\=>>-\=" | |
271 syn match shRedir "\d\=<\(&[-0-9]\)\=" | |
272 syn match shRedir "\d<<-\=" | |
273 | 279 |
274 " Here Documents: {{{1 | 280 " Here Documents: {{{1 |
275 " ========================================= | 281 " ========================================= |
276 if version < 600 | 282 if 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 | 283 syn region shHereDoc matchgroup=shRedir start="<<\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList |
336 syn match shStatement "\<\(set\|export\|unset\)\>" | 342 syn match shStatement "\<\(set\|export\|unset\)\>" |
337 endif | 343 endif |
338 | 344 |
339 " Functions: {{{1 | 345 " Functions: {{{1 |
340 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo | 346 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo |
341 syn match shFunctionStart "^\s*{" contained | 347 " COMBAK -- look at bash09. function foo() (line#35) is folding 38 lines. Not being terminated properly |
348 "syn match shFunctionStart "{" contained | |
342 if g:sh_fold_enabled | 349 if g:sh_fold_enabled |
343 syn region shFunctionOne transparent fold start="^\s*\h\w*\s*()\_s*\ze{" matchgroup=shFunctionStart end="}" contains=@shFunctionList | 350 syn region shFunctionOne transparent fold start="^\s*\h\w*\s*()\_s*\ze{" matchgroup=shFunctionStart end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart |
344 syn region shFunctionTwo transparent fold start="\h\w*\s*\%(()\)\=\_s*\ze{" matchgroup=shFunctionStart end="}" contains=shFunctionKey,@shFunctionList contained | 351 syn region shFunctionTwo transparent fold start="\h\w*\s*\%(()\)\=\_s*\ze{" matchgroup=shFunctionStart end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart |
345 else | 352 else |
346 syn region shFunctionOne transparent start="^\s*\h\w*\s*()\_s*\ze{" matchgroup=shFunctionStart end="}" contains=@shFunctionList | 353 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 | 354 syn region shFunctionTwo transparent start="\h\w*\s*\%(()\)\=\_s*\ze{" matchgroup=shFunctionStart end="}" contains=shFunctionKey,@shFunctionList contained |
348 endif | 355 endif |
349 | 356 |