Mercurial > vim
comparison runtime/syntax/sh.vim @ 7176:30042ddff503
commit https://github.com/vim/vim/commit/60cce2fb736c8ff6fdb9603f502d3c15f1f7a25d
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Oct 13 23:21:27 2015 +0200
Update runtime files.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 13 Oct 2015 23:30:05 +0200 |
parents | 37828f7503c7 |
children | 873eae260c97 |
comparison
equal
deleted
inserted
replaced
7175:27c1768bc708 | 7176:30042ddff503 |
---|---|
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: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> | 3 " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> |
4 " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> | 4 " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> |
5 " Last Change: May 29, 2015 | 5 " Last Change: Oct 09, 2015 |
6 " Version: 137 | 6 " Version: 139 |
7 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH | 7 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH |
8 " For options and settings, please use: :help ft-sh-syntax | 8 " For options and settings, please use: :help ft-sh-syntax |
9 " 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) |
10 | 10 |
11 " For version 5.x: Clear all syntax items {{{1 | 11 " For version 5.x: Clear all syntax items {{{1 |
14 syntax clear | 14 syntax clear |
15 elseif exists("b:current_syntax") | 15 elseif exists("b:current_syntax") |
16 finish | 16 finish |
17 endif | 17 endif |
18 | 18 |
19 " AFAICT "." should be considered part of the iskeyword. Using iskeywords in | 19 " AFAICT "." should be considered part of the iskeyword for ksh. Using iskeywords |
20 " syntax is dicey, so the following code permits the user to | 20 " in syntax is dicey, so the following code permits the user to prevent/override |
21 " g:sh_isk set to a string : specify iskeyword. | 21 " g:sh_isk set to a string : specify iskeyword. |
22 " g:sh_noisk exists : don't change iskeyword | 22 " g:sh_noisk exists : don't change iskeyword |
23 " g:sh_noisk does not exist : (default) append "." to iskeyword | 23 " g:sh_noisk does not exist : (default) append "." to iskeyword for kornshell |
24 if exists("g:sh_isk") && type(g:sh_isk) == 1 " user specifying iskeyword | 24 if exists("g:sh_isk") && type(g:sh_isk) == 1 " user specifying iskeyword |
25 exe "setl isk=".g:sh_isk | 25 exe "setl isk=".g:sh_isk |
26 elseif !exists("g:sh_noisk") " optionally prevent appending '.' to iskeyword | 26 elseif !exists("g:sh_noisk") && exists("b:is_kornshell") " append '.' to iskeyword |
27 setl isk+=. | 27 setl isk+=. |
28 endif | 28 endif |
29 | 29 |
30 " trying to answer the question: which shell is /bin/sh, really? | 30 " trying to answer the question: which shell is /bin/sh, really? |
31 " If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess. | 31 " If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess. |
126 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload | 126 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload |
127 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr | 127 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr |
128 syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo | 128 syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo |
129 syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr | 129 syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr |
130 syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator | 130 syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator |
131 syn cluster shTestList contains=shCharClass,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr | 131 syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr |
132 " Echo: {{{1 | 132 " Echo: {{{1 |
133 " ==== | 133 " ==== |
134 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct | 134 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct |
135 syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment | 135 syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment |
136 syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment | 136 syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment |
319 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial | 319 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial |
320 syn region shExDoubleQuote matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial | 320 syn region shExDoubleQuote matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+ contains=shStringSpecial |
321 endif | 321 endif |
322 syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell | 322 syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell |
323 syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell | 323 syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell |
324 syn region shDoubleQuote matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell | |
325 syn match shStringSpecial "[^[:print:] \t]" contained | 324 syn match shStringSpecial "[^[:print:] \t]" contained |
326 syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" | 325 syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" |
327 " COMBAK: why is ,shComment on next line??? | 326 " COMBAK: why is ,shComment on next line??? |
328 syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial,shComment | 327 syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" |
329 syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shComment | 328 syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" |
330 syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained | 329 syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained |
331 | 330 |
332 " Comments: {{{1 | 331 " Comments: {{{1 |
333 "========== | 332 "========== |
334 syn cluster shCommentGroup contains=shTodo,@Spell | 333 syn cluster shCommentGroup contains=shTodo,@Spell |
407 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo | 406 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo |
408 endif | 407 endif |
409 | 408 |
410 if exists("b:is_bash") | 409 if exists("b:is_bash") |
411 if s:sh_fold_functions | 410 if s:sh_fold_functions |
412 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 411 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
413 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 | 412 syn region shFunctionTwo fold matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
414 syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 413 syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
415 syn region shFunctionFour fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 414 syn region shFunctionFour fold matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
416 else | 415 else |
417 syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList | 416 syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList |
418 syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained | 417 syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained |
419 syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList | 418 syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList |
420 syn region shFunctionFour matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained | 419 syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained |
421 endif | 420 endif |
422 else | 421 else |
423 if s:sh_fold_functions | 422 if s:sh_fold_functions |
424 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 423 syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
425 syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 424 syn region shFunctionTwo fold matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
426 syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 425 syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
427 syn region shFunctionFour fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment | 426 syn region shFunctionFour fold matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment |
428 else | 427 else |
429 syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList | 428 syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList |
430 syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained | 429 syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained |
431 syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList | 430 syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList |
432 syn region shFunctionFour matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained | 431 syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained |
433 endif | 432 endif |
434 endif | 433 endif |
435 | 434 |
436 " Parameter Dereferencing: {{{1 | 435 " Parameter Dereferencing: {{{1 |
437 " ======================== | 436 " ======================== |