Mercurial > vim
comparison runtime/syntax/sh.vim @ 2034:7bc41231fbc7
Update runtime files.
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Wed, 06 Jan 2010 20:54:52 +0100 |
parents | f4f8014d516e |
children | b9e314fe473f |
comparison
equal
deleted
inserted
replaced
2033:de5a43c5eedc | 2034:7bc41231fbc7 |
---|---|
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: Jul 11, 2008 | 5 " Last Change: Nov 17, 2009 |
6 " Version: 102 | 6 " Version: 110 |
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 " 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 |
65 " sh syntax is case sensitive {{{1 | 65 " sh syntax is case sensitive {{{1 |
66 syn case match | 66 syn case match |
67 | 67 |
68 " Clusters: contains=@... clusters {{{1 | 68 " Clusters: contains=@... clusters {{{1 |
69 "================================== | 69 "================================== |
70 syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError | 70 syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError,shOK |
71 if exists("b:is_kornshell") | 71 if exists("b:is_kornshell") |
72 syn cluster ErrorList add=shDTestError | 72 syn cluster ErrorList add=shDTestError |
73 endif | 73 endif |
74 syn cluster shArithParenList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen | 74 syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shDeref,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement |
75 syn cluster shArithList contains=@shArithParenList,shParenError | 75 syn cluster shArithList contains=@shArithParenList,shParenError |
76 syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial | 76 syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange |
77 syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq | 77 syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq |
78 syn cluster shColonList contains=@shCaseList | 78 syn cluster shColonList contains=@shCaseList |
79 syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial | 79 syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial |
80 syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial | 80 syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial |
81 syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq,shSpecial | 81 syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq,shSpecial |
82 syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS | 82 syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS |
83 syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError | 83 syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError |
84 syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote | 84 syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote |
85 syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq | 85 syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq |
86 syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest | 86 syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest |
87 syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq | 87 syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq |
88 if exists("b:is_kornshell") || exists("b:is_bash") | 88 if exists("b:is_kornshell") || exists("b:is_bash") |
89 syn cluster shFunctionList add=shRepeat | 89 syn cluster shFunctionList add=shRepeat |
90 syn cluster shFunctionList add=shDblBrace,shDblParen | 90 syn cluster shFunctionList add=shDblBrace,shDblParen |
91 endif | 91 endif |
92 syn cluster shHereBeginList contains=@shCommandSubList | 92 syn cluster shHereBeginList contains=@shCommandSubList |
93 syn cluster shHereList contains=shBeginHere,shHerePayload | 93 syn cluster shHereList contains=shBeginHere,shHerePayload |
94 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload | 94 syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload |
95 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial | 95 syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial |
96 syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest,@shErrorList,shSet | 96 syn cluster shLoopList contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest,@shErrorList,shSet |
97 syn cluster shSubShList contains=@shCaseList,shOperator | 97 syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator |
98 syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shDoubleQuote,shExpr,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq | 98 syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shDoubleQuote,shExpr,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq |
99 | |
100 | 99 |
101 " Echo: {{{1 | 100 " Echo: {{{1 |
102 " ==== | 101 " ==== |
103 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct | 102 " This one is needed INSIDE a CommandSub, so that `echo bla` be correct |
104 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 | 103 syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shOperator end="$" matchgroup=NONE end="[<>;&|()]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment |
105 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 | 104 syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shOperator end="$" matchgroup=NONE end="[<>;&|()]"me=e-1 end="\d[<>]"me=e-2 end="\s#"me=e-2 contains=@shEchoList skipwhite nextgroup=shQuickComment |
106 syn match shEchoQuote contained '\%(\\\\\)*\\["`']' | 105 syn match shEchoQuote contained '\%(\\\\\)*\\["`'()]' |
107 | 106 |
108 " This must be after the strings, so that ... \" will be correct | 107 " This must be after the strings, so that ... \" will be correct |
109 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 | 108 syn region shEmbeddedEcho contained matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shOperator 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,shDoubleQuote,shCharClass,shCtrlSeq |
110 | 109 |
111 " Alias: {{{1 | 110 " Alias: {{{1 |
112 " ===== | 111 " ===== |
113 if exists("b:is_kornshell") || exists("b:is_bash") | 112 if exists("b:is_kornshell") || exists("b:is_bash") |
114 syn match shStatement "\<alias\>" | 113 syn match shStatement "\<alias\>" |
123 syn match shInError "\<in\>" | 122 syn match shInError "\<in\>" |
124 syn match shCaseError ";;" | 123 syn match shCaseError ";;" |
125 syn match shEsacError "\<esac\>" | 124 syn match shEsacError "\<esac\>" |
126 syn match shCurlyError "}" | 125 syn match shCurlyError "}" |
127 syn match shParenError ")" | 126 syn match shParenError ")" |
127 syn match shOK '\.\(done\|fi\|in\|esac\)' | |
128 if exists("b:is_kornshell") | 128 if exists("b:is_kornshell") |
129 syn match shDTestError "]]" | 129 syn match shDTestError "]]" |
130 endif | 130 endif |
131 syn match shTestError "]" | 131 syn match shTestError "]" |
132 | 132 |
150 syn match shOperator "!\==" skipwhite nextgroup=shPattern | 150 syn match shOperator "!\==" skipwhite nextgroup=shPattern |
151 syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shDoubleQuote,shDeref | 151 syn match shPattern "\<\S\+\())\)\@=" contained contains=shExSingleQuote,shSingleQuote,shDoubleQuote,shDeref |
152 | 152 |
153 " Subshells: {{{1 | 153 " Subshells: {{{1 |
154 " ========== | 154 " ========== |
155 syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2 | 155 syn region shExpr transparent matchgroup=shExprRegion start="{" end="}" contains=@shExprList2 nextgroup=shMoreSpecial |
156 syn region shSubSh transparent matchgroup=shSubShRegion start="(" end=")" contains=@shSubShList | 156 syn region shSubSh transparent matchgroup=shSubShRegion start="(" end=")" contains=@shSubShList nextgroup=shMoreSpecial |
157 | 157 |
158 " Tests: {{{1 | 158 " Tests: {{{1 |
159 "======= | 159 "======= |
160 "syn region shExpr transparent matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList | 160 syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList,shSpecial |
161 syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList | 161 syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1 |
162 syn region shTest transparent matchgroup=shStatement start="\<test\>" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1 | |
163 syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" | 162 syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" |
164 syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern | 163 syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern |
165 syn match shTestPattern contained '\w\+' | 164 syn match shTestPattern contained '\w\+' |
166 syn match shTestDoubleQuote contained '"[^"]*"' | 165 syn match shTestDoubleQuote contained '"[^"]*"' |
167 syn match shTestSingleQuote contained '\\.' | 166 syn match shTestSingleQuote contained '\\.' |
201 | 200 |
202 " Case: case...esac {{{1 | 201 " Case: case...esac {{{1 |
203 " ==== | 202 " ==== |
204 syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote | 203 syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote |
205 syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar | 204 syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar |
206 syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment | |
207 if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor | 205 if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor |
206 syn region shCase fold contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment | |
208 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList | 207 syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList |
209 else | 208 else |
209 syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment | |
210 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList | 210 syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList |
211 endif | 211 endif |
212 syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote | 212 syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote |
213 if exists("b:is_bash") | 213 if exists("b:is_bash") |
214 syn region shCaseExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained | 214 syn region shCaseExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained |
216 syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained | 216 syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained |
217 endif | 217 endif |
218 syn region shCaseSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained | 218 syn region shCaseSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained |
219 syn region shCaseDoubleQuote matchgroup=shOperator start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained | 219 syn region shCaseDoubleQuote matchgroup=shOperator start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained |
220 syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained | 220 syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained |
221 syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+]+ contained | |
221 | 222 |
222 " Misc: {{{1 | 223 " Misc: {{{1 |
223 "====== | 224 "====== |
224 syn match shWrapLineOperator "\\$" | 225 syn match shWrapLineOperator "\\$" |
225 syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList | 226 syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList |
254 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 | 255 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 |
255 endif | 256 endif |
256 | 257 |
257 syn match shSource "^\.\s" | 258 syn match shSource "^\.\s" |
258 syn match shSource "\s\.\s" | 259 syn match shSource "\s\.\s" |
259 syn region shColon start="^\s*:" end="$\|" end="#"me=e-1 contains=@shColonList | 260 "syn region shColon start="^\s*:" end="$" end="\s#"me=e-2 contains=@shColonList |
261 syn region shColon start="^\s*\zs:" end="$" end="\s#"me=e-2 | |
260 | 262 |
261 " String And Character Constants: {{{1 | 263 " String And Character Constants: {{{1 |
262 "================================ | 264 "================================ |
263 syn match shNumber "-\=\<\d\+\>#\=" | 265 syn match shNumber "-\=\<\d\+\>#\=" |
264 syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained | 266 syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained |
265 if exists("b:is_bash") | 267 if exists("b:is_bash") |
266 syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c.\|\\[abefnrtv]" contained | 268 syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained |
267 endif | 269 endif |
268 if exists("b:is_bash") | 270 if exists("b:is_bash") |
269 syn region shExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial | 271 syn region shExSingleQuote matchgroup=shOperator start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial |
270 else | 272 else |
271 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial | 273 syn region shExSingleQuote matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial |
272 endif | 274 endif |
273 syn region shSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial,@Spell | 275 syn region shSingleQuote matchgroup=shOperator start=+'+ end=+'+ contains=@Spell |
274 syn region shDoubleQuote matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell | 276 syn region shDoubleQuote matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell |
275 syn match shStringSpecial "[^[:print:] \t]" contained | 277 syn match shStringSpecial "[^[:print:] \t]" contained |
276 syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" | 278 syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]" |
277 syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" | 279 syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial |
278 syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" | 280 syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" |
281 syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained | |
279 | 282 |
280 " Comments: {{{1 | 283 " Comments: {{{1 |
281 "========== | 284 "========== |
282 syn cluster shCommentGroup contains=shTodo,@Spell | 285 syn cluster shCommentGroup contains=shTodo,@Spell |
283 syn keyword shTodo contained COMBAK FIXME TODO XXX | 286 syn keyword shTodo contained COMBAK FIXME TODO XXX |
284 syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup | 287 syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup |
285 syn match shComment "\s\zs#.*$" contains=@shCommentGroup | 288 syn match shComment "\s\zs#.*$" contains=@shCommentGroup |
286 syn match shQuickComment contained "#.*$" | 289 syn match shQuickComment contained "#.*$" |
287 | 290 |
288 " Here Documents: {{{1 | 291 " Here Documents: {{{1 |
289 " ========================================= | 292 " ========================================= |
290 if version < 600 | 293 if version < 600 |
291 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 |
336 "============= | 339 "============= |
337 syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained | 340 syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained |
338 syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier | 341 syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier |
339 syn match shSetIdentifier "=" contained nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shSingleQuote,shExSingleQuote | 342 syn match shSetIdentifier "=" contained nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shSingleQuote,shExSingleQuote |
340 if exists("b:is_bash") | 343 if exists("b:is_bash") |
341 syn region shSetList oneline matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze#\|=" 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\s\+#\|=" contains=@shIdList |
342 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|)]\|$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze[#=]" contains=@shIdList | 345 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|)]\|$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList |
343 elseif exists("b:is_kornshell") | 346 elseif exists("b:is_kornshell") |
344 syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze[#=]" contains=@shIdList | 347 syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList |
345 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze[#=]" contains=@shIdList | 348 syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList |
346 else | 349 else |
347 syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze[#=]" contains=@shIdList | 350 syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shOperator end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList |
348 endif | 351 endif |
349 | 352 |
350 " Functions: {{{1 | 353 " Functions: {{{1 |
351 if !exists("g:is_posix") | 354 if !exists("g:is_posix") |
352 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo | 355 syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo |
490 hi def link shCaseDoubleQuote shDoubleQuote | 493 hi def link shCaseDoubleQuote shDoubleQuote |
491 hi def link shCaseIn shConditional | 494 hi def link shCaseIn shConditional |
492 hi def link shCaseSingleQuote shSingleQuote | 495 hi def link shCaseSingleQuote shSingleQuote |
493 hi def link shCaseStart shConditional | 496 hi def link shCaseStart shConditional |
494 hi def link shCmdSubRegion shShellVariables | 497 hi def link shCmdSubRegion shShellVariables |
495 hi def link shColon shStatement | 498 hi def link shColon shComment |
496 hi def link shDerefOp shOperator | 499 hi def link shDerefOp shOperator |
497 hi def link shDerefPOL shDerefOp | 500 hi def link shDerefPOL shDerefOp |
498 hi def link shDerefPPS shDerefOp | 501 hi def link shDerefPPS shDerefOp |
499 hi def link shDeref shShellVariables | 502 hi def link shDeref shShellVariables |
500 hi def link shDerefSimple shDeref | 503 hi def link shDerefSimple shDeref |
509 hi def link shExSingleQuote shSingleQuote | 512 hi def link shExSingleQuote shSingleQuote |
510 hi def link shFunction Function | 513 hi def link shFunction Function |
511 hi def link shHereDoc shString | 514 hi def link shHereDoc shString |
512 hi def link shHerePayload shHereDoc | 515 hi def link shHerePayload shHereDoc |
513 hi def link shLoop shStatement | 516 hi def link shLoop shStatement |
517 hi def link shMoreSpecial shSpecial | |
514 hi def link shOption shCommandSub | 518 hi def link shOption shCommandSub |
515 hi def link shPattern shString | 519 hi def link shPattern shString |
516 hi def link shParen shArithmetic | 520 hi def link shParen shArithmetic |
517 hi def link shPosnParm shShellVariables | 521 hi def link shPosnParm shShellVariables |
518 hi def link shQuickComment shComment | 522 hi def link shQuickComment shComment |