Guest User

FernandoBasso

a guest
Dec 20th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 35.88 KB | None | 0 0
  1. " Vim syntax file
  2. " Language:     shell (sh) Korn shell (ksh) bash (sh)
  3. " Maintainer:       Dr. Charles E. Campbell, Jr.  <[email protected]>
  4. " Previous Maintainer:  Lennart Schultz <[email protected]>
  5. " Last Change:      Aug 16, 2011
  6. " Version:      118
  7. " URL:      http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
  8. " For options and settings, please use:      :help ft-sh-syntax
  9. " This file includes many ideas from ?ric Brunet ([email protected])
  10.  
  11. " For version 5.x: Clear all syntax items {{{1
  12. " For version 6.x: Quit when a syntax file was already loaded
  13. if version < 600
  14.   syntax clear
  15. elseif exists("b:current_syntax")
  16.   finish
  17. endif
  18.  
  19. " AFAICT "." should be considered part of the iskeyword.  Using iskeywords in
  20. " syntax is dicey, so the following code permits the user to prevent/override
  21. " its setting.
  22. if exists("g:sh_isk")          " override support
  23.  exe "setlocal isk=".g:sh_isk
  24. elseif !exists("g:sh_noisk")   " prevent modification support
  25.  setlocal isk+=.
  26. endif
  27.  
  28. " trying to answer the question: which shell is /bin/sh, really?
  29. if !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh")
  30.  if executable("/bin/sh")
  31.   if     resolve("/bin/sh") =~ 'bash$'
  32.    let g:is_bash= 1
  33.   elseif resolve("/bin/sh") =~ 'ksh$'
  34.    let g:is_ksh = 1
  35.   endif
  36.  elseif executable("/usr/bin/sh")
  37.   if     resolve("/usr/bin//sh") =~ 'bash$'
  38.    let g:is_bash= 1
  39.   elseif resolve("/usr/bin//sh") =~ 'ksh$'
  40.    let g:is_ksh = 1
  41.   endif
  42.  endif
  43. endif
  44.  
  45. " handling /bin/sh with is_kornshell/is_sh {{{1
  46. " b:is_sh is set when "#! /bin/sh" is found;
  47. " However, it often is just a masquerade by bash (typically Linux)
  48. " or kornshell (typically workstations with Posix "sh").
  49. " So, when the user sets "g:is_bash", "g:is_kornshell",
  50. " or "g:is_posix", a b:is_sh is converted into b:is_bash/b:is_kornshell,
  51. " respectively.
  52. if !exists("b:is_kornshell") && !exists("b:is_bash")
  53.   if exists("g:is_posix") && !exists("g:is_kornshell")
  54.    let g:is_kornshell= g:is_posix
  55.   endif
  56.   if exists("g:is_kornshell")
  57.     let b:is_kornshell= 1
  58.     if exists("b:is_sh")
  59.       unlet b:is_sh
  60.     endif
  61.   elseif exists("g:is_bash")
  62.     let b:is_bash= 1
  63.     if exists("b:is_sh")
  64.       unlet b:is_sh
  65.     endif
  66.   else
  67.     let b:is_sh= 1
  68.   endif
  69. endif
  70.  
  71. " set up default g:sh_fold_enabled {{{1
  72. if !exists("g:sh_fold_enabled")
  73.  let g:sh_fold_enabled= 0
  74. elseif g:sh_fold_enabled != 0 && !has("folding")
  75.  let g:sh_fold_enabled= 0
  76.  echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support"
  77. endif
  78. if !exists("s:sh_fold_functions")
  79.  let s:sh_fold_functions = 1
  80. endif
  81. if !exists("s:sh_fold_heredoc")
  82.  let s:sh_fold_heredoc   = 2
  83. endif
  84. if !exists("s:sh_fold_ifdofor")
  85.  let s:sh_fold_ifdofor   = 4
  86. endif
  87. if g:sh_fold_enabled && &fdm == "manual"
  88.  setlocal fdm=syntax
  89. endif
  90.  
  91. " sh syntax is case sensitive {{{1
  92. syn case match
  93.  
  94. " Clusters: contains=@... clusters {{{1
  95. "==================================
  96. syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsacError,shCurlyError,shParenError,shTestError,shOK
  97. if exists("b:is_kornshell")
  98.  syn cluster ErrorList add=shDTestError
  99. endif
  100. syn cluster shArithParenList    contains=shArithmetic,shCaseEsac,shDeref,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement
  101. syn cluster shArithList contains=@shArithParenList,shParenError
  102. syn cluster shCaseEsacList  contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
  103. syn cluster shCaseList  contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
  104. syn cluster shColonList contains=@shCaseList
  105. syn cluster shCommandSubList    contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial
  106. syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
  107. syn cluster shDblQuoteList  contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shCtrlSeq,shSpecial
  108. syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS
  109. syn cluster shDerefVarList  contains=shDerefOp,shDerefVarArray,shDerefOpError
  110. syn cluster shEchoList  contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
  111. syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq
  112. syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest
  113. syn cluster shFunctionList  contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
  114. if exists("b:is_kornshell") || exists("b:is_bash")
  115.  syn cluster shFunctionList add=shRepeat
  116.  syn cluster shFunctionList add=shDblBrace,shDblParen
  117. endif
  118. syn cluster shHereBeginList contains=@shCommandSubList
  119. syn cluster shHereList  contains=shBeginHere,shHerePayload
  120. syn cluster shHereListDQ    contains=shBeginHere,@shDblQuoteList,shHerePayload
  121. syn cluster shIdList    contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial
  122. syn cluster shLoopList  contains=@shCaseList,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest,@shErrorList,shSet
  123. syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
  124. syn cluster shTestList  contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shExDoubleQuote,shDoubleQuote,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq
  125.  
  126. " Echo: {{{1
  127. " ====
  128. " This one is needed INSIDE a CommandSub, so that `echo bla` be correct
  129. 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
  130. 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
  131. syn match  shEchoQuote contained    '\%(\\\\\)*\\["`'()]'
  132.  
  133. " This must be after the strings, so that ... \" will be correct
  134. 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
  135.  
  136. " Alias: {{{1
  137. " =====
  138. if exists("b:is_kornshell") || exists("b:is_bash")
  139. syn match shStatement "\<alias\>"
  140. syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+\)\@="  skip="\\$" end="\>\|`"
  141. syn region shAlias matchgroup=shStatement start="\<alias\>\s\+\(\h[-._[:alnum:]]\+=\)\@=" skip="\\$" end="="
  142. endif
  143.  
  144. " Error Codes: {{{1
  145. " ============
  146. syn match   shDoError "\<done\>"
  147. syn match   shIfError "\<fi\>"
  148. syn match   shInError "\<in\>"
  149. syn match   shCaseError ";;"
  150. syn match   shEsacError "\<esac\>"
  151. syn match   shCurlyError "}"
  152. syn match   shParenError ")"
  153. syn match   shOK    '\.\(done\|fi\|in\|esac\)'
  154. if exists("b:is_kornshell")
  155. syn match     shDTestError "]]"
  156. endif
  157. syn match     shTestError "]"
  158.  
  159. " Options: {{{1
  160. " ====================
  161. syn match   shOption    "\s\zs[-+][-_a-zA-Z0-9]\+\>"
  162. syn match   shOption    "\s\zs--[^ \t$`'"|]\+"
  163.  
  164. " File Redirection Highlighted As Operators: {{{1
  165. "===========================================
  166. syn match      shRedir  "\d\=>\(&[-0-9]\)\="
  167. syn match      shRedir  "\d\=>>-\="
  168. syn match      shRedir  "\d\=<\(&[-0-9]\)\="
  169. syn match      shRedir  "\d<<-\="
  170.  
  171. " Operators: {{{1
  172. " ==========
  173. syn match   shOperator  "<<\|>>"        contained
  174. syn match   shOperator  "[!&;|]"        contained
  175. syn match   shOperator  "\[[[^:]\|\]]"      contained
  176. syn match   shOperator  "!\=="      skipwhite nextgroup=shPattern
  177. syn match   shPattern   "\<\S\+\())\)\@="   contained contains=shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shDeref
  178.  
  179. " Subshells: {{{1
  180. " ==========
  181. syn region shExpr  transparent matchgroup=shExprRegion  start="{" end="}"       contains=@shExprList2 nextgroup=shMoreSpecial
  182. syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")"    contains=@shSubShList nextgroup=shMoreSpecial
  183.  
  184. " Tests: {{{1
  185. "=======
  186. syn region shExpr   matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial
  187. syn region shTest   transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1
  188. syn match  shTestOpr    contained   "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]"
  189. syn match  shTestOpr    contained   '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern
  190. syn match  shTestPattern    contained   '\w\+'
  191. syn match  shTestDoubleQuote    contained   '\%(\%(\\\\\)*\\\)\@<!"[^"]*"'
  192. syn match  shTestSingleQuote    contained   '\\.'
  193. syn match  shTestSingleQuote    contained   "'[^']*'"
  194. if exists("b:is_kornshell") || exists("b:is_bash")
  195.  syn region  shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]"   contains=@shTestList
  196.  syn region  shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))"   contains=@shTestList
  197. endif
  198.  
  199. " Character Class In Range: {{{1
  200. " =========================
  201. syn match   shCharClass contained   "\[:\(backspace\|escape\|return\|xdigit\|alnum\|alpha\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|tab\):\]"
  202.  
  203. " Loops: do, if, while, until {{{1
  204. " ======
  205. if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor
  206.  syn region shDo    fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
  207.  syn region shIf    fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>"   contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
  208.  syn region shFor   fold matchgroup=shLoop start="\<for\_s" end="\<in\_s" end="\<do\>"me=e-2    contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
  209. else
  210.  syn region shDo    transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
  211.  syn region shIf    transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional end="\<;\_s*then\>" end="\<fi\>"   contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
  212.  syn region shFor   matchgroup=shLoop start="\<for\_s" end="\<in\>" end="\<do\>"me=e-2  contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
  213. endif
  214. if exists("b:is_kornshell") || exists("b:is_bash")
  215.  syn cluster shCaseList add=shRepeat
  216.  syn cluster shFunctionList add=shRepeat
  217.  syn region shRepeat   matchgroup=shLoop   start="\<while\_s" end="\<in\_s" end="\<do\>"me=e-2  contains=@shLoopList,shDblParen,shDblBrace
  218.  syn region shRepeat   matchgroup=shLoop   start="\<until\_s" end="\<in\_s" end="\<do\>"me=e-2  contains=@shLoopList,shDblParen,shDblBrace
  219.  syn region shCaseEsac matchgroup=shConditional start="\<select\s" matchgroup=shConditional end="\<in\>" end="\<do\>" contains=@shLoopList
  220. else
  221.  syn region shRepeat   matchgroup=shLoop   start="\<while\_s" end="\<do\>"me=e-2        contains=@shLoopList
  222.  syn region shRepeat   matchgroup=shLoop   start="\<until\_s" end="\<do\>"me=e-2        contains=@shLoopList
  223. endif
  224. syn region shCurlyIn   contained    matchgroup=Delimiter start="{" end="}" contains=@shCurlyList
  225. syn match  shComma     contained    ","
  226.  
  227. " Case: case...esac {{{1
  228. " ====
  229. syn match   shCaseBar   contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|"     nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
  230. syn match   shCaseStart contained skipwhite skipnl "("          nextgroup=shCase,shCaseBar
  231. if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor
  232.  syn region  shCase fold contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)"  end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
  233.  syn region  shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>"   contains=@shCaseEsacList
  234. else
  235.  syn region  shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)"  end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
  236.  syn region  shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>"    contains=@shCaseEsacList
  237. endif
  238. syn keyword shCaseIn    contained skipwhite skipnl in           nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
  239. if exists("b:is_bash")
  240.  syn region  shCaseExSingleQuote    matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial  skipwhite skipnl nextgroup=shCaseBar    contained
  241. else
  242.  syn region  shCaseExSingleQuote    matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+   contains=shStringSpecial    skipwhite skipnl nextgroup=shCaseBar    contained
  243. endif
  244. syn region  shCaseSingleQuote   matchgroup=shQuote start=+'+ end=+'+        contains=shStringSpecial        skipwhite skipnl nextgroup=shCaseBar    contained
  245. syn region  shCaseDoubleQuote   matchgroup=shQuote start=+"+ skip=+\\\\\|\\.+ end=+"+   contains=@shDblQuoteList,shStringSpecial    skipwhite skipnl nextgroup=shCaseBar    contained
  246. syn region  shCaseCommandSub    start=+`+ skip=+\\\\\|\\.+ end=+`+      contains=@shCommandSubList      skipwhite skipnl nextgroup=shCaseBar    contained
  247. syn region  shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+]+ contained
  248.  
  249. " Misc: {{{1
  250. "======
  251. syn match   shWrapLineOperator "\\$"
  252. syn region  shCommandSub   start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList
  253. syn match   shEscape    contained   '\\.'         contains=@shCommandSubList
  254.  
  255. " $() and $(()): {{{1
  256. " $(..) is not supported by sh (Bourne shell).  However, apparently
  257. " some systems (HP?) have as their /bin/sh a (link to) Korn shell
  258. " (ie. Posix compliant shell).  /bin/ksh should work for those
  259. " systems too, however, so the following syntax will flag $(..) as
  260. " an Error under /bin/sh.  By consensus of vimdev'ers!
  261. if exists("b:is_kornshell") || exists("b:is_bash")
  262.  syn region shCommandSub matchgroup=shCmdSubRegion start="\$("  skip='\\\\\|\\.' end=")"  contains=@shCommandSubList
  263.  syn region shArithmetic matchgroup=shArithRegion  start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
  264.  syn match  shSkipInitWS contained  "^\s\+"
  265. else
  266.  syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
  267. endif
  268.  
  269. if exists("b:is_bash")
  270.  syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
  271.  syn cluster shCaseList add=bashAdminStatement,bashStatement
  272.  syn keyword bashSpecialVariables contained auto_resume BASH BASH_ALIASES BASH_ALIASES BASH_ARGC BASH_ARGC BASH_ARGV BASH_ARGV BASH_CMDS BASH_CMDS BASH_COMMAND BASH_COMMAND BASH_ENV BASH_EXECUTION_STRING BASH_EXECUTION_STRING BASH_LINENO BASH_LINENO BASHOPTS BASHOPTS BASHPID BASHPID BASH_REMATCH BASH_REMATCH BASH_SOURCE BASH_SOURCE BASH_SUBSHELL BASH_SUBSHELL BASH_VERSINFO BASH_VERSION BASH_XTRACEFD BASH_XTRACEFD CDPATH COLUMNS COLUMNS COMP_CWORD COMP_CWORD COMP_KEY COMP_KEY COMP_LINE COMP_LINE COMP_POINT COMP_POINT COMPREPLY COMPREPLY COMP_TYPE COMP_TYPE COMP_WORDBREAKS COMP_WORDBREAKS COMP_WORDS COMP_WORDS COPROC COPROC DIRSTACK EMACS EMACS ENV ENV EUID FCEDIT FIGNORE FUNCNAME FUNCNAME FUNCNEST FUNCNEST GLOBIGNORE GROUPS histchars HISTCMD HISTCONTROL HISTFILE HISTFILESIZE HISTIGNORE HISTSIZE HISTTIMEFORMAT HISTTIMEFORMAT HOME HOSTFILE HOSTNAME HOSTTYPE IFS IGNOREEOF INPUTRC LANG LC_ALL LC_COLLATE LC_CTYPE LC_CTYPE LC_MESSAGES LC_NUMERIC LC_NUMERIC LINENO LINES LINES MACHTYPE MAIL MAILCHECK MAILPATH MAPFILE MAPFILE OLDPWD OPTARG OPTERR OPTIND OSTYPE PATH PIPESTATUS POSIXLY_CORRECT POSIXLY_CORRECT PPID PROMPT_COMMAND PS1 PS2 PS3 PS4 PWD RANDOM READLINE_LINE READLINE_LINE READLINE_POINT READLINE_POINT REPLY SECONDS SHELL SHELL SHELLOPTS SHLVL TIMEFORMAT TIMEOUT TMPDIR TMPDIR UID
  273.  syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep install less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch
  274.  syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
  275. endif
  276.  
  277. if exists("b:is_kornshell")
  278.  syn cluster shCommandSubList add=kshSpecialVariables,kshStatement
  279.  syn cluster shCaseList add=kshStatement
  280.  syn keyword kshSpecialVariables contained CDPATH COLUMNS EDITOR ENV ERRNO FCEDIT FPATH HISTFILE HISTSIZE HOME IFS LINENO LINES MAIL MAILCHECK MAILPATH OLDPWD OPTARG OPTIND PATH PPID PS1 PS2 PS3 PS4 PWD RANDOM REPLY SECONDS SHELL TMOUT VISUAL
  281.  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
  282. endif
  283.  
  284. syn match   shSource    "^\.\s"
  285. syn match   shSource    "\s\.\s"
  286. "syn region  shColon    start="^\s*:" end="$" end="\s#"me=e-2 contains=@shColonList
  287. syn region  shColon start="^\s*\zs:" end="$" end="\s#"me=e-2
  288.  
  289. " String And Character Constants: {{{1
  290. "================================
  291. syn match   shNumber    "-\=\<\d\+\>#\="
  292. syn match   shCtrlSeq   "\\\d\d\d\|\\[abcfnrtv0]"       contained
  293. if exists("b:is_bash")
  294.  syn match   shSpecial  "\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]"  contained
  295. endif
  296. if exists("b:is_bash")
  297.  syn region  shExSingleQuote    matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial
  298.  syn region  shExDoubleQuote    matchgroup=shQuote start=+\$"+ skip=+\\\\\|\\.\|\\"+ end=+"+    contains=@shDblQuoteList,shStringSpecial,shSpecial
  299. else
  300.  syn region  shExSingleQuote    matchGroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+   contains=shStringSpecial
  301.  syn region  shExDoubleQuote    matchGroup=Error start=+\$"+ skip=+\\\\\|\\.+ end=+"+   contains=shStringSpecial
  302. endif
  303. syn region  shSingleQuote   matchgroup=shQuote start=+'+ end=+'+        contains=@Spell
  304. syn region  shDoubleQuote   matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+    contains=@shDblQuoteList,shStringSpecial,@Spell
  305. "syn region  shDoubleQuote  matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell
  306. syn match   shStringSpecial "[^[:print:] \t]"   contained
  307. syn match   shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]"
  308. syn match   shSpecial   "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial
  309. syn match   shSpecial   "^\%(\\\\\)*\\[\\"'`$()#]"
  310. syn match   shMoreSpecial   "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained
  311.  
  312. " Comments: {{{1
  313. "==========
  314. syn cluster shCommentGroup  contains=shTodo,@Spell
  315. syn keyword shTodo  contained       COMBAK FIXME TODO XXX
  316. syn match   shComment       "^\s*\zs#.*$"   contains=@shCommentGroup
  317. syn match   shComment       "\s\zs#.*$" contains=@shCommentGroup
  318. syn match   shQuickComment  contained   "#.*$"
  319.  
  320. " Here Documents: {{{1
  321. " =========================================
  322. if version < 600
  323.  syn region shHereDoc matchgroup=shRedir start="<<\s*\**END[a-zA-Z_0-9]*\**"  matchgroup=shRedir end="^END[a-zA-Z_0-9]*$" contains=@shDblQuoteList
  324.  syn region shHereDoc matchgroup=shRedir start="<<-\s*\**END[a-zA-Z_0-9]*\**" matchgroup=shRedir end="^\s*END[a-zA-Z_0-9]*$" contains=@shDblQuoteList
  325.  syn region shHereDoc matchgroup=shRedir start="<<\s*\**EOF\**" matchgroup=shRedir  end="^EOF$" contains=@shDblQuoteList
  326.  syn region shHereDoc matchgroup=shRedir start="<<-\s*\**EOF\**" matchgroup=shRedir end="^\s*EOF$"  contains=@shDblQuoteList
  327.  syn region shHereDoc matchgroup=shRedir start="<<\s*\**\.\**"  matchgroup=shRedir  end="^\.$"  contains=@shDblQuoteList
  328.  syn region shHereDoc matchgroup=shRedir start="<<-\s*\**\.\**" matchgroup=shRedir  end="^\s*\.$"   contains=@shDblQuoteList
  329.  
  330. elseif (g:sh_fold_enabled % (s:sh_fold_heredoc * 2))/s:sh_fold_heredoc
  331.  syn region shHereDoc matchgroup=shRedir fold start="<<\s*\z(\S*\)"     matchgroup=shRedir end="^\z1\s*$"   contains=@shDblQuoteList
  332.  syn region shHereDoc matchgroup=shRedir fold start="<<\s*\"\z(\S*\)\""     matchgroup=shRedir end="^\z1\s*$"
  333.  syn region shHereDoc matchgroup=shRedir fold start="<<\s*'\z(\S*\)'"       matchgroup=shRedir end="^\z1\s*$"
  334.  syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\z(\S*\)"        matchgroup=shRedir end="^\s*\z1\s*$"    contains=@shDblQuoteList
  335.  syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\"\z(\S*\)\""        matchgroup=shRedir end="^\s*\z1\s*$"
  336.  syn region shHereDoc matchgroup=shRedir fold start="<<-\s*'\z(\S*\)'"      matchgroup=shRedir end="^\s*\z1\s*$"
  337.  syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\z(\S*\)"        matchgroup=shRedir end="^\z1\s*$"
  338.  syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\"\z(\S*\)\""    matchgroup=shRedir end="^\z1\s*$"
  339.  syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*'\z(\S*\)'"     matchgroup=shRedir end="^\s*\z1\s*$"
  340.  syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\z(\S*\)"       matchgroup=shRedir end="^\s*\z1\s*$"
  341.  syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\"\z(\S*\)\""   matchgroup=shRedir end="^\s*\z1\s*$"
  342.  syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*'\z(\S*\)'"      matchgroup=shRedir end="^\z1\s*$"
  343.  syn region shHereDoc matchgroup=shRedir fold start="<<\\\z(\S*\)"      matchgroup=shRedir end="^\z1\s*$"
  344.  
  345. else
  346.  syn region shHereDoc matchgroup=shRedir start="<<\s*\\\=\z(\S*\)"  matchgroup=shRedir end="^\z1\s*$"    contains=@shDblQuoteList
  347.  syn region shHereDoc matchgroup=shRedir start="<<\s*\"\z(\S*\)\""  matchgroup=shRedir end="^\z1\s*$"
  348.  syn region shHereDoc matchgroup=shRedir start="<<-\s*\z(\S*\)"     matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList
  349.  syn region shHereDoc matchgroup=shRedir start="<<-\s*'\z(\S*\)'"   matchgroup=shRedir end="^\s*\z1\s*$"
  350.  syn region shHereDoc matchgroup=shRedir start="<<\s*'\z(\S*\)'"    matchgroup=shRedir end="^\z1\s*$"
  351.  syn region shHereDoc matchgroup=shRedir start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
  352.  syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
  353.  syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\z(\S*\)"    matchgroup=shRedir end="^\s*\z1\s*$"
  354.  syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*'\z(\S*\)'"  matchgroup=shRedir end="^\s*\z1\s*$"
  355.  syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*'\z(\S*\)'"   matchgroup=shRedir end="^\z1\s*$"
  356.  syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
  357.  syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\"\z(\S*\)\""    matchgroup=shRedir end="^\s*\z1\s*$"
  358.  syn region shHereDoc matchgroup=shRedir start="<<\\\z(\S*\)"       matchgroup=shRedir end="^\z1\s*$"
  359. endif
  360.  
  361. " Here Strings: {{{1
  362. " =============
  363. " available for: bash; ksh (really should be ksh93 only) but not if its a posix
  364. if exists("b:is_bash") || (exists("b:is_kornshell") && !exists("g:is_posix"))
  365.  syn match shRedir "<<<"
  366. endif
  367.  
  368. " Identifiers: {{{1
  369. "=============
  370. syn match  shSetOption  "\s\zs[-+][a-zA-Z0-9]\+\>"  contained
  371. syn match  shVariable   "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier
  372. syn match  shSetIdentifier  "="     contained   nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote
  373. if exists("b:is_bash")
  374.  syn region shSetList oneline matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$"    matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList
  375.  syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|)]\|$"         matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
  376. elseif exists("b:is_kornshell")
  377.  syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$"        matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
  378.  syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="$"               matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
  379. else
  380.  syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$"        matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
  381. endif
  382.  
  383. " Functions: {{{1
  384. if !exists("g:is_posix")
  385.  syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo
  386. endif
  387.  
  388. if exists("b:is_bash")
  389.  if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions
  390.   syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}"    contains=@shFunctionList            skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
  391.   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
  392.  else
  393.   syn region shFunctionOne  matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{"    end="}" contains=@shFunctionList
  394.   syn region shFunctionTwo  matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained
  395.  endif
  396. else
  397.  if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions
  398.   syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}"   contains=@shFunctionList            skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
  399.   syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{"    end="}" contains=shFunctionKey,@shFunctionList contained    skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
  400.  else
  401.   syn region shFunctionOne  matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{"   end="}" contains=@shFunctionList
  402.   syn region shFunctionTwo  matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{"    end="}" contains=shFunctionKey,@shFunctionList contained
  403.  endif
  404. endif
  405.  
  406. " Parameter Dereferencing: {{{1
  407. " ========================
  408. syn match  shDerefSimple    "\$\%(\h\w*\|\d\)"
  409. syn region shDeref  matchgroup=PreProc start="\${" end="}"  contains=@shDerefList,shDerefVarArray
  410. syn match  shDerefWordError "[^}$[]"    contained
  411. syn match  shDerefSimple    "\$[-#*@!?]"
  412. syn match  shDerefSimple    "\$\$"
  413. if exists("b:is_bash") || exists("b:is_kornshell")
  414.  syn region shDeref matchgroup=PreProc start="\${##\=" end="}"  contains=@shDerefList
  415.  syn region shDeref matchgroup=PreProc start="\${\$\$" end="}"  contains=@shDerefList
  416. endif
  417.  
  418. " bash: ${!prefix*} and ${#parameter}: {{{1
  419. " ====================================
  420. if exists("b:is_bash")
  421.  syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp
  422.  syn match  shDerefVar  contained   "{\@<=!\w\+"        nextgroup=@shDerefVarList
  423. endif
  424.  
  425. syn match  shDerefSpecial   contained   "{\@<=[-*@?0]"      nextgroup=shDerefOp,shDerefOpError
  426. syn match  shDerefSpecial   contained   "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp
  427. syn match  shDerefVar   contained   "{\@<=\w\+"     nextgroup=@shDerefVarList
  428.  
  429. " sh ksh bash : ${var[... ]...}  array reference: {{{1
  430. syn region  shDerefVarArray   contained matchgroup=shDeref start="\[" end="]"   contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError
  431.  
  432. " Special ${parameter OPERATOR word} handling: {{{1
  433. " sh ksh bash : ${parameter:-word}    word is default value
  434. " sh ksh bash : ${parameter:=word}    assign word as default value
  435. " sh ksh bash : ${parameter:?word}    display word if parameter is null
  436. " sh ksh bash : ${parameter:+word}    use word if parameter is not null, otherwise nothing
  437. "    ksh bash : ${parameter#pattern}  remove small left  pattern
  438. "    ksh bash : ${parameter##pattern} remove large left  pattern
  439. "    ksh bash : ${parameter%pattern}  remove small right pattern
  440. "    ksh bash : ${parameter%%pattern} remove large right pattern
  441. "        bash : ${parameter^pattern}  Case modification
  442. "        bash : ${parameter^^pattern} Case modification
  443. "        bash : ${parameter,pattern}  Case modification
  444. "        bash : ${parameter,,pattern} Case modification
  445. syn cluster shDerefPatternList  contains=shDerefPattern,shDerefString
  446. syn match shDerefOpError    contained   ":[[:punct:]]"
  447. syn match  shDerefOp    contained   ":\=[-=?]"  nextgroup=@shDerefPatternList
  448. syn match  shDerefOp    contained   ":\=+"  nextgroup=@shDerefPatternList
  449. if exists("b:is_bash") || exists("b:is_kornshell")
  450.  syn match  shDerefOp   contained   "#\{1,2}"   nextgroup=@shDerefPatternList
  451.  syn match  shDerefOp   contained   "%\{1,2}"   nextgroup=@shDerefPatternList
  452.  syn match  shDerefPattern  contained   "[^{}]\+"   contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern
  453.  syn region shDerefPattern  contained   start="{" end="}"   contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern
  454.  syn match  shDerefEscape   contained   '\%(\\\\\)*\\.'
  455. endif
  456. if exists("b:is_bash")
  457.  syn match  shDerefOp   contained   "[,^]\{1,2}"    nextgroup=@shDerefPatternList
  458. endif
  459. syn region shDerefString    contained   matchgroup=shDerefDelim start=+\%(\\\)\@<!'+ end=+'+        contains=shStringSpecial
  460. syn region shDerefString    contained   matchgroup=shDerefDelim start=+\%(\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial
  461. syn match  shDerefString    contained   "\\["']"    nextgroup=shDerefPattern
  462.  
  463. if exists("b:is_bash")
  464. " bash : ${parameter:offset}
  465. " bash : ${parameter:offset:length}
  466.  syn region shDerefOp   contained   start=":[$[:alnum:]_]"me=e-1 end=":"me=e-1 end="}"me=e-1 contains=@shCommandSubList nextgroup=shDerefPOL
  467.  syn match  shDerefPOL  contained   ":[^}]\+"   contains=@shCommandSubList
  468.  
  469. " bash : ${parameter//pattern/string}
  470. " bash : ${parameter//pattern}
  471.  syn match  shDerefPPS  contained   '/\{1,2}'   nextgroup=shDerefPPSleft
  472.  syn region shDerefPPSleft  contained   start='.'   skip=@\%(\\\)\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList
  473.  syn region shDerefPPSright contained   start='.'   end='\ze}'  contains=@shCommandSubList
  474. endif
  475.  
  476. " Arithmetic Parenthesized Expressions: {{{1
  477. syn region shParen matchgroup=shArithRegion start='(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList
  478.  
  479. " Useful sh Keywords: {{{1
  480. " ===================
  481. syn keyword shStatement break cd chdir continue eval exec exit kill newgrp pwd read readonly return shift test trap ulimit umask wait
  482. syn keyword shConditional contained elif else then
  483. syn keyword shCondError elif else then
  484.  
  485. " Useful ksh Keywords: {{{1
  486. " ====================
  487. if exists("b:is_kornshell") || exists("b:is_bash")
  488. syn keyword shStatement autoload bg false fc fg functions getopts hash history integer jobs let nohup printf r stop suspend times true type unalias whence
  489. if exists("g:is_posix")
  490.  syn keyword shStatement command
  491. else
  492.  syn keyword shStatement time
  493. endif
  494.  
  495. " Useful bash Keywords: {{{1
  496. " =====================
  497. if exists("b:is_bash")
  498.  syn keyword shStatement bind builtin dirs disown enable help local logout popd pushd shopt source
  499. else
  500.  syn keyword shStatement login newgrp
  501. endif
  502. endif
  503.  
  504. " Synchronization: {{{1
  505. " ================
  506. if !exists("sh_minlines")
  507.  let sh_minlines = 200
  508. endif
  509. if !exists("sh_maxlines")
  510.  let sh_maxlines = 2 * sh_minlines
  511. endif
  512. exec "syn sync minlines=" . sh_minlines . " maxlines=" . sh_maxlines
  513. syn sync match shCaseEsacSync   grouphere   shCaseEsac  "\<case\>"
  514. syn sync match shCaseEsacSync   groupthere  shCaseEsac  "\<esac\>"
  515. syn sync match shDoSync grouphere   shDo    "\<do\>"
  516. syn sync match shDoSync groupthere  shDo    "\<done\>"
  517. syn sync match shForSync    grouphere   shFor   "\<for\>"
  518. syn sync match shForSync    groupthere  shFor   "\<in\>"
  519. syn sync match shIfSync grouphere   shIf    "\<if\>"
  520. syn sync match shIfSync groupthere  shIf    "\<fi\>"
  521. syn sync match shUntilSync  grouphere   shRepeat    "\<until\>"
  522. syn sync match shWhileSync  grouphere   shRepeat    "\<while\>"
  523.  
  524. " Default Highlighting: {{{1
  525. " =====================
  526. hi def link shArithRegion   shShellVariables
  527. hi def link shBeginHere shRedir
  528. hi def link shCaseBar   shConditional
  529. hi def link shCaseCommandSub    shCommandSub
  530. hi def link shCaseDoubleQuote   shDoubleQuote
  531. hi def link shCaseIn    shConditional
  532. hi def link shQuote shOperator
  533. hi def link shCaseSingleQuote   shSingleQuote
  534. hi def link shCaseStart shConditional
  535. hi def link shCmdSubRegion  shShellVariables
  536. hi def link shColon shComment
  537. hi def link shDerefOp   shOperator
  538. hi def link shDerefPOL  shDerefOp
  539. hi def link shDerefPPS  shDerefOp
  540. hi def link shDeref shShellVariables
  541. hi def link shDerefDelim    shOperator
  542. hi def link shDerefSimple   shDeref
  543. hi def link shDerefSpecial  shDeref
  544. hi def link shDerefString   shDoubleQuote
  545. hi def link shDerefVar  shDeref
  546. hi def link shDoubleQuote   shString
  547. hi def link shEcho  shString
  548. hi def link shEchoDelim shOperator
  549. hi def link shEchoQuote shString
  550. hi def link shEmbeddedEcho  shString
  551. hi def link shEscape    shCommandSub
  552. hi def link shExDoubleQuote shDoubleQuote
  553. hi def link shExSingleQuote shSingleQuote
  554. hi def link shFunction  Function
  555. hi def link shHereDoc   shString
  556. hi def link shHerePayload   shHereDoc
  557. hi def link shLoop  shStatement
  558. hi def link shMoreSpecial   shSpecial
  559. hi def link shOption    shCommandSub
  560. hi def link shPattern   shString
  561. hi def link shParen shArithmetic
  562. hi def link shPosnParm  shShellVariables
  563. hi def link shQuickComment  shComment
  564. hi def link shRange shOperator
  565. hi def link shRedir shOperator
  566. hi def link shSetListDelim  shOperator
  567. hi def link shSetOption shOption
  568. hi def link shSingleQuote   shString
  569. hi def link shSource    shOperator
  570. hi def link shStringSpecial shSpecial
  571. hi def link shSubShRegion   shOperator
  572. hi def link shTestOpr   shConditional
  573. hi def link shTestPattern   shString
  574. hi def link shTestDoubleQuote   shString
  575. hi def link shTestSingleQuote   shString
  576. hi def link shVariable  shSetList
  577. hi def link shWrapLineOperator  shOperator
  578.  
  579. if exists("b:is_bash")
  580.   hi def link bashAdminStatement    shStatement
  581.   hi def link bashSpecialVariables  shShellVariables
  582.   hi def link bashStatement     shStatement
  583.   hi def link shFunctionParen       Delimiter
  584.   hi def link shFunctionDelim       Delimiter
  585. endif
  586. if exists("b:is_kornshell")
  587.   hi def link kshSpecialVariables   shShellVariables
  588.   hi def link kshStatement      shStatement
  589.   hi def link shFunctionParen       Delimiter
  590. endif
  591.  
  592. hi def link shCaseError     Error
  593. hi def link shCondError     Error
  594. hi def link shCurlyError        Error
  595. hi def link shDerefError        Error
  596. hi def link shDerefOpError      Error
  597. hi def link shDerefWordError        Error
  598. hi def link shDoError       Error
  599. hi def link shEsacError     Error
  600. hi def link shIfError       Error
  601. hi def link shInError       Error
  602. hi def link shParenError        Error
  603. hi def link shTestError     Error
  604. if exists("b:is_kornshell")
  605.   hi def link shDTestError      Error
  606. endif
  607.  
  608. hi def link shArithmetic        Special
  609. hi def link shCharClass     Identifier
  610. hi def link shSnglCase      Statement
  611. hi def link shCommandSub        Special
  612. hi def link shComment       Comment
  613. hi def link shConditional       Conditional
  614. hi def link shCtrlSeq       Special
  615. hi def link shExprRegion        Delimiter
  616. hi def link shFunctionKey       Function
  617. hi def link shFunctionName      Function
  618. hi def link shNumber        Number
  619. hi def link shOperator      Operator
  620. hi def link shRepeat        Repeat
  621. hi def link shSet       Statement
  622. hi def link shSetList       Identifier
  623. hi def link shShellVariables        PreProc
  624. hi def link shSpecial       Special
  625. hi def link shStatement     Statement
  626. hi def link shString        String
  627. hi def link shTodo      Todo
  628. hi def link shAlias     Identifier
  629.  
  630. " Set Current Syntax: {{{1
  631. " ===================
  632. if exists("b:is_bash")
  633. let b:current_syntax = "bash"
  634. elseif exists("b:is_kornshell")
  635. let b:current_syntax = "ksh"
  636. else
  637. let b:current_syntax = "sh"
  638. endif
  639.  
  640. " vim: ts=16 fdm=marker
Advertisement
Add Comment
Please, Sign In to add comment