Mercurial > vim
comparison runtime/syntax/sh.vim @ 19180:8edf0aeb71b9
Update runtime files.
Commit: https://github.com/vim/vim/commit/1d9215b9aaa120b9d78fee49488556f73007ce78
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 25 13:27:42 2020 +0100
Update runtime files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 25 Jan 2020 13:30:05 +0100 |
parents | 9ccb1ea9b2fc |
children | 7f88f6a3ed4c |
comparison
equal
deleted
inserted
replaced
19179:539bca3da740 | 19180:8edf0aeb71b9 |
---|---|
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 <NcampObell@SdrPchip.AorgM-NOSPAM> |
4 " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> | 4 " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> |
5 " Last Change: Jun 16, 2019 | 5 " Last Change: Oct 16, 2019 |
6 " Version: 188 | 6 " Version: 189 |
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 Eric Brunet (eric.brunet@ens.fr) | 9 " This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) |
10 | 10 |
11 " quit when a syntax file was already loaded {{{1 | 11 " quit when a syntax file was already loaded {{{1 |
122 "================================== | 122 "================================== |
123 syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError,shOK | 123 syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError,shOK |
124 if exists("b:is_kornshell") || exists("b:is_bash") | 124 if exists("b:is_kornshell") || exists("b:is_bash") |
125 syn cluster ErrorList add=shDTestError | 125 syn cluster ErrorList add=shDTestError |
126 endif | 126 endif |
127 syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor | 127 syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor,shFunctionKey,shFunctionOne,shFunctionTwo |
128 syn cluster shArithList contains=@shArithParenList,shParenError | 128 syn cluster shArithList contains=@shArithParenList,shParenError |
129 syn cluster shCaseEsacList contains=shCaseStart,shCaseLabel,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange | 129 syn cluster shCaseEsacList contains=shCaseStart,shCaseLabel,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange |
130 syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shComment,shDo,shEcho,shExpr,shFor,shForPP,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq | 130 syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shComment,shDo,shEcho,shExpr,shFor,shForPP,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq |
131 syn cluster shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable | 131 syn cluster shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable |
132 syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial | 132 syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial |
133 syn cluster shDblQuoteList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial,shSpecialDQ | 133 " COMBAK: removing shEscape fromshDblQuoteList fails ksh04:43 |
134 syn cluster shDblQuoteList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shPosnParm,shCtrlSeq,shSpecial,shSpecialDQ | |
134 syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS | 135 syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS |
135 syn cluster shDerefVarList contains=shDerefOff,shDerefOp,shDerefVarArray,shDerefOpError | 136 syn cluster shDerefVarList contains=shDerefOff,shDerefOp,shDerefVarArray,shDerefOpError |
136 syn cluster shEchoList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote | 137 syn cluster shEchoList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote |
137 syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq | 138 syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq |
138 syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest | 139 syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest |
145 syn cluster shHereList contains=shBeginHere,shHerePayload | 146 syn cluster shHereList contains=shBeginHere,shHerePayload |
146 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload | 147 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload |
147 syn cluster shIdList contains=shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr | 148 syn cluster shIdList contains=shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr |
148 syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo | 149 syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo |
149 syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch | 150 syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch |
151 syn cluster shPPSLeftList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable | |
150 syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm | 152 syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm |
151 syn cluster shSubShList contains=@shCommandSubList,shCommandSubBQ,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator | 153 syn cluster shSubShList contains=@shCommandSubList,shCommandSubBQ,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator |
152 syn cluster shTestList contains=shArithmetic,shCharClass,shCommandSub,shCommandSubBQ,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr | 154 syn cluster shTestList contains=shArithmetic,shCharClass,shCommandSub,shCommandSubBQ,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr |
153 syn cluster shNoZSList contains=shSpecialNoZS | 155 syn cluster shNoZSList contains=shSpecialNoZS |
154 syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shCommandSub,shCommandSubBQ,shArithmetic | 156 syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shCommandSub,shCommandSubBQ,shArithmetic |
155 | 157 |
156 " Echo: {{{1 | 158 " Echo: {{{1 |
157 " ==== | 159 " ==== |
158 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct | 160 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct |
159 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 | 161 syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment |
160 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 | 162 syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment |
161 syn match shEchoQuote contained '\%(\\\\\)*\\["`'()]' | 163 syn match shEchoQuote contained '\%(\\\\\)*\\["`'()]' |
162 | 164 |
163 " This must be after the strings, so that ... \" will be correct | 165 " This must be after the strings, so that ... \" will be correct |
164 syn region shEmbeddedEcho contained matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|`)]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=shNumber,shExSingleQuote,shSingleQuote,shDeref,shDerefSimple,shSpecialVar,shOperator,shExDoubleQuote,shDoubleQuote,shCharClass,shCtrlSeq | 166 syn region shEmbeddedEcho contained matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|`)]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=shNumber,shExSingleQuote,shSingleQuote,shDeref,shDerefSimple,shSpecialVar,shOperator,shExDoubleQuote,shDoubleQuote,shCharClass,shCtrlSeq |
165 | 167 |
194 endif | 196 endif |
195 | 197 |
196 " Options: {{{1 | 198 " Options: {{{1 |
197 " ==================== | 199 " ==================== |
198 syn match shOption "\s\zs[-+][-_a-zA-Z#@]\+" | 200 syn match shOption "\s\zs[-+][-_a-zA-Z#@]\+" |
199 syn match shOption "\s\zs--[^ \t$`'"|);]\+" | 201 syn match shOption "\s\zs--[^ \t$=`'"|);]\+" |
200 | 202 |
201 " File Redirection Highlighted As Operators: {{{1 | 203 " File Redirection Highlighted As Operators: {{{1 |
202 "=========================================== | 204 "=========================================== |
203 syn match shRedir "\d\=>\(&[-0-9]\)\=" | 205 syn match shRedir "\d\=>\(&[-0-9]\)\=" |
204 syn match shRedir "\d\=>>-\=" | 206 syn match shRedir "\d\=>>-\=" |
290 endif | 292 endif |
291 " Misc: {{{1 | 293 " Misc: {{{1 |
292 "====== | 294 "====== |
293 syn match shWrapLineOperator "\\$" | 295 syn match shWrapLineOperator "\\$" |
294 syn region shCommandSubBQ start="`" skip="\\\\\|\\." end="`" contains=shBQComment,@shCommandSubList | 296 syn region shCommandSubBQ start="`" skip="\\\\\|\\." end="`" contains=shBQComment,@shCommandSubList |
295 "see ksh13 | 297 "COMBAK: see ksh13:50 |
296 "syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shSingleQuote,shDoubleQuote,shComment | 298 "syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shSingleQuote,shDoubleQuote,shComment |
299 "COMBAK: see sh11:27 | |
297 syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment | 300 syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment |
301 "COMBAK: see ksh13:53 | |
302 "syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' | |
298 | 303 |
299 " $() and $(()): {{{1 | 304 " $() and $(()): {{{1 |
300 " $(..) is not supported by sh (Bourne shell). However, apparently | 305 " $(..) is not supported by sh (Bourne shell). However, apparently |
301 " some systems (HP?) have as their /bin/sh a (link to) Korn shell | 306 " some systems (HP?) have as their /bin/sh a (link to) Korn shell |
302 " (ie. Posix compliant shell). /bin/ksh should work for those | 307 " (ie. Posix compliant shell). /bin/ksh should work for those |
354 syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell nextgroup=shSpecialStart,shSpecialSQ | 359 syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell nextgroup=shSpecialStart,shSpecialSQ |
355 syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell nextgroup=shSpecialStart | 360 syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell nextgroup=shSpecialStart |
356 syn region shDoubleQuote matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contained contains=@shDblQuoteList,shStringSpecial,@Spell nextgroup=shSpecialStart | 361 syn region shDoubleQuote matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contained contains=@shDblQuoteList,shStringSpecial,@Spell nextgroup=shSpecialStart |
357 syn match shStringSpecial "[^[:print:] \t]" contained | 362 syn match shStringSpecial "[^[:print:] \t]" contained |
358 syn match shStringSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shComment | 363 syn match shStringSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shComment |
364 syn match shStringSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" | |
359 syn match shSpecialSQ "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" contained nextgroup=shBkslshSnglQuote,@shNoZSList | 365 syn match shSpecialSQ "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" contained nextgroup=shBkslshSnglQuote,@shNoZSList |
360 syn match shSpecialDQ "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" contained nextgroup=shBkslshDblQuote,@shNoZSList | 366 syn match shSpecialDQ "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" contained nextgroup=shBkslshDblQuote,@shNoZSList |
361 syn match shSpecialStart "\%(\\\\\)*\\[\\"'`$()#]" contained nextgroup=shBkslshSnglQuote,shBkslshDblQuote,@shNoZSList | 367 syn match shSpecialStart "\%(\\\\\)*\\[\\"'`$()#]" contained nextgroup=shBkslshSnglQuote,shBkslshDblQuote,@shNoZSList |
362 syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" | 368 syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" |
363 syn match shSpecialNoZS contained "\%(\\\\\)*\\[\\"'`$()#]" | 369 syn match shSpecialNoZS contained "\%(\\\\\)*\\[\\"'`$()#]" |
525 syn match shDerefLen contained ":[^}]\+" contains=shDeref,shDerefSimple,shArithmetic | 531 syn match shDerefLen contained ":[^}]\+" contains=shDeref,shDerefSimple,shArithmetic |
526 | 532 |
527 " bash : ${parameter//pattern/string} | 533 " bash : ${parameter//pattern/string} |
528 " bash : ${parameter//pattern} | 534 " bash : ${parameter//pattern} |
529 syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft | 535 syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft |
530 syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList | 536 syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shPPSLeftList |
531 syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList | 537 syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList |
532 | 538 |
533 " bash : ${parameter/#substring/replacement} | 539 " bash : ${parameter/#substring/replacement} |
534 syn match shDerefPSR contained '/#' nextgroup=shDerefPSRleft,shDoubleQuote,shSingleQuote | 540 syn match shDerefPSR contained '/#' nextgroup=shDerefPSRleft,shDoubleQuote,shSingleQuote |
535 syn region shDerefPSRleft contained start='[^"']' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright | 541 syn region shDerefPSRleft contained start='[^"']' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright |