Updated runtime files.
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
" Vim syntax file
|
||||
" Language: shell (sh) Korn shell (ksh) bash (sh)
|
||||
" Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
|
||||
" Last Change: Mar 19, 2012
|
||||
" Version: 122
|
||||
" Last Change: Nov 14, 2012
|
||||
" Version: 128
|
||||
" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
|
||||
" For options and settings, please use: :help ft-sh-syntax
|
||||
" This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr)
|
||||
@ -17,15 +17,18 @@ elseif exists("b:current_syntax")
|
||||
endif
|
||||
|
||||
" AFAICT "." should be considered part of the iskeyword. Using iskeywords in
|
||||
" syntax is dicey, so the following code permits the user to prevent/override
|
||||
" its setting.
|
||||
if exists("g:sh_isk") " override support
|
||||
exe "setlocal isk=".g:sh_isk
|
||||
elseif !exists("g:sh_noisk") " prevent modification support
|
||||
setlocal isk+=.
|
||||
" syntax is dicey, so the following code permits the user to
|
||||
" g:sh_isk set to a string : specify iskeyword.
|
||||
" g:sh_noisk exists : don't change iskeyword
|
||||
" g:sh_noisk does not exist : (default) append "." to iskeyword
|
||||
if exists("g:sh_isk") && type(g:sh_isk) == 1 " user specifying iskeyword
|
||||
exe "setl isk=".g:sh_isk
|
||||
elseif !exists("g:sh_noisk") " optionally prevent appending '.' to iskeyword
|
||||
setl isk+=.
|
||||
endif
|
||||
|
||||
" trying to answer the question: which shell is /bin/sh, really?
|
||||
" If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess.
|
||||
if !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh")
|
||||
if executable("/bin/sh")
|
||||
if resolve("/bin/sh") =~ 'bash$'
|
||||
@ -76,16 +79,19 @@ elseif g:sh_fold_enabled != 0 && !has("folding")
|
||||
echomsg "Ignoring g:sh_fold_enabled=".g:sh_fold_enabled."; need to re-compile vim for +fold support"
|
||||
endif
|
||||
if !exists("s:sh_fold_functions")
|
||||
let s:sh_fold_functions = 1
|
||||
let s:sh_fold_functions= and(g:sh_fold_enabled,1)
|
||||
endif
|
||||
if !exists("s:sh_fold_heredoc")
|
||||
let s:sh_fold_heredoc = 2
|
||||
let s:sh_fold_heredoc = and(g:sh_fold_enabled,2)
|
||||
endif
|
||||
if !exists("s:sh_fold_ifdofor")
|
||||
let s:sh_fold_ifdofor = 4
|
||||
let s:sh_fold_ifdofor = and(g:sh_fold_enabled,4)
|
||||
endif
|
||||
if g:sh_fold_enabled && &fdm == "manual"
|
||||
setlocal fdm=syntax
|
||||
" Given that the user provided g:sh_fold_enabled
|
||||
" AND g:sh_fold_enabled is manual (usual default)
|
||||
" implies a desire for syntax-based folding
|
||||
setl fdm=syntax
|
||||
endif
|
||||
|
||||
" sh syntax is case sensitive {{{1
|
||||
@ -102,12 +108,12 @@ syn cluster shArithList contains=@shArithParenList,shParenError
|
||||
syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
|
||||
syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
|
||||
"syn cluster shColonList contains=@shCaseList
|
||||
syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial
|
||||
syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shExDoubleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial,shCmdParenRegion
|
||||
syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
|
||||
syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shCtrlSeq,shSpecial
|
||||
syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial
|
||||
syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS
|
||||
syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError
|
||||
syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
|
||||
syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shEscape,shExpr,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
|
||||
syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq
|
||||
syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest
|
||||
syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
|
||||
@ -160,7 +166,7 @@ endif
|
||||
|
||||
" Options: {{{1
|
||||
" ====================
|
||||
syn match shOption "\s\zs[-+][-_a-zA-Z0-9]\+\>"
|
||||
syn match shOption "\s\zs[-+][-_a-zA-Z0-9#]\+"
|
||||
syn match shOption "\s\zs--[^ \t$`'"|]\+"
|
||||
|
||||
" File Redirection Highlighted As Operators: {{{1
|
||||
@ -204,14 +210,15 @@ syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum
|
||||
|
||||
" Loops: do, if, while, until {{{1
|
||||
" ======
|
||||
if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor
|
||||
if s:sh_fold_ifdofor
|
||||
syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
|
||||
syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList
|
||||
syn region shFor fold matchgroup=shLoop start="\<for\_s" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
|
||||
syn region shFor fold matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
|
||||
else
|
||||
syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList
|
||||
syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList
|
||||
syn region shFor matchgroup=shLoop start="\<for\_s" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
|
||||
syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn
|
||||
syn match shForPP '\<for\>\ze\_s*(('
|
||||
endif
|
||||
if exists("b:is_kornshell") || exists("b:is_bash")
|
||||
syn cluster shCaseList add=shRepeat
|
||||
@ -230,7 +237,7 @@ syn match shComma contained ","
|
||||
" ====
|
||||
syn match shCaseBar contained skipwhite "\(^\|[^\\]\)\(\\\\\)*\zs|" nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
|
||||
syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBar
|
||||
if (g:sh_fold_enabled % (s:sh_fold_ifdofor * 2))/s:sh_fold_ifdofor
|
||||
if s:sh_fold_ifdofor
|
||||
syn region shCase fold contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
|
||||
syn region shCaseEsac fold matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
|
||||
else
|
||||
@ -246,13 +253,17 @@ endif
|
||||
syn region shCaseSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
|
||||
syn region shCaseDoubleQuote matchgroup=shQuote start=+"+ skip=+\\\\\|\\.+ end=+"+ contains=@shDblQuoteList,shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
|
||||
syn region shCaseCommandSub start=+`+ skip=+\\\\\|\\.+ end=+`+ contains=@shCommandSubList skipwhite skipnl nextgroup=shCaseBar contained
|
||||
syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+]+ contained
|
||||
|
||||
if exists("b:is_bash")
|
||||
syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+ contained contains=shCharClass
|
||||
syn match shCharClass '\[:\%(alnum\|alpha\|ascii\|blank\|cntrl\|digit\|graph\|lower\|print\|punct\|space\|upper\|word\|or\|xdigit\):\]' contained
|
||||
else
|
||||
syn region shCaseRange matchgroup=Delimiter start=+\[+ skip=+\\\\+ end=+\]+ contained
|
||||
endif
|
||||
" Misc: {{{1
|
||||
"======
|
||||
syn match shWrapLineOperator "\\$"
|
||||
syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList
|
||||
syn match shEscape contained '\\.' contains=@shCommandSubList
|
||||
syn region shCommandSub start="`" skip="\\\\\|\\." end="`" contains=@shCommandSubList
|
||||
syn match shEscape contained '\%(\\\\\)*\\.'
|
||||
|
||||
" $() and $(()): {{{1
|
||||
" $(..) is not supported by sh (Bourne shell). However, apparently
|
||||
@ -268,20 +279,23 @@ if exists("b:is_kornshell") || exists("b:is_bash")
|
||||
elseif !exists("g:sh_no_error")
|
||||
syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
|
||||
endif
|
||||
syn region shCmdParenRegion matchgroup=shCmdSubRegion start="(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
|
||||
|
||||
if exists("b:is_bash")
|
||||
syn cluster shCommandSubList add=bashSpecialVariables,bashStatement
|
||||
syn cluster shCaseList add=bashAdminStatement,bashStatement
|
||||
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
|
||||
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
|
||||
syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch
|
||||
syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
|
||||
syn keyword bashStatement command compgen
|
||||
endif
|
||||
|
||||
if exists("b:is_kornshell")
|
||||
syn cluster shCommandSubList add=kshSpecialVariables,kshStatement
|
||||
syn cluster shCaseList add=kshStatement
|
||||
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
|
||||
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
|
||||
syn keyword kshStatement cat chmod clear cp du egrep expr fgrep find grep killall less ls mkdir mv nice printenv rm rmdir sed sort strip stty tail touch tput
|
||||
syn keyword kshStatement command setgroups setsenv
|
||||
endif
|
||||
|
||||
syn match shSource "^\.\s"
|
||||
@ -309,8 +323,8 @@ syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip
|
||||
"syn region shDoubleQuote matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell
|
||||
syn match shStringSpecial "[^[:print:] \t]" contained
|
||||
syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]"
|
||||
syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial
|
||||
syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]"
|
||||
syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial,shComment
|
||||
syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shComment
|
||||
syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained
|
||||
|
||||
" Comments: {{{1
|
||||
@ -319,6 +333,7 @@ syn cluster shCommentGroup contains=shTodo,@Spell
|
||||
syn keyword shTodo contained COMBAK FIXME TODO XXX
|
||||
syn match shComment "^\s*\zs#.*$" contains=@shCommentGroup
|
||||
syn match shComment "\s\zs#.*$" contains=@shCommentGroup
|
||||
syn match shComment contained "#.*$" contains=@shCommentGroup
|
||||
syn match shQuickComment contained "#.*$"
|
||||
|
||||
" Here Documents: {{{1
|
||||
@ -331,52 +346,52 @@ if version < 600
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\**\.\**" matchgroup=shRedir end="^\.$" contains=@shDblQuoteList
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\**\.\**" matchgroup=shRedir end="^\s*\.$" contains=@shDblQuoteList
|
||||
|
||||
elseif (g:sh_fold_enabled % (s:sh_fold_heredoc * 2))/s:sh_fold_heredoc
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\\\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
|
||||
elseif s:sh_fold_heredoc
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\z([^ \t|]*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*'\z([^ \t|]*\)'" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\z([^ \t|]*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir fold start="<<\\\z([^ \t|]*\)" matchgroup=shRedir end="^\z1\s*$"
|
||||
|
||||
else
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\\\=\z(\S*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\z(\S*\)" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*'\z(\S*\)'" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\"\z(\S*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\\\z(\S*\)" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\\\=\z([^ \t|]*\)" matchgroup=shRedir end="^\z1\s*$" contains=@shDblQuoteList
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\z([^ \t|]*\)" matchgroup=shRedir end="^\s*\z1\s*$" contains=@shDblQuoteList
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*'\z([^ \t|]*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*'\z([^ \t|]*\)'" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\"\z([^ \t|]*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\z([^ \t|]*\)" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*'\z([^ \t|]*\)'" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir end="^\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<-\s*\\\_$\_s*\"\z([^ \t|]*\)\"" matchgroup=shRedir end="^\s*\z1\s*$"
|
||||
syn region shHereDoc matchgroup=shRedir start="<<\\\z([^ \t|]*\)" matchgroup=shRedir end="^\z1\s*$"
|
||||
endif
|
||||
|
||||
" Here Strings: {{{1
|
||||
" =============
|
||||
" available for: bash; ksh (really should be ksh93 only) but not if its a posix
|
||||
if exists("b:is_bash") || (exists("b:is_kornshell") && !exists("g:is_posix"))
|
||||
syn match shRedir "<<<"
|
||||
syn match shRedir "<<<" skipwhite nextgroup=shCmdParenRegion
|
||||
endif
|
||||
|
||||
" Identifiers: {{{1
|
||||
"=============
|
||||
syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained
|
||||
syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shSetIdentifier
|
||||
syn match shSetIdentifier "=" contained nextgroup=shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote
|
||||
syn match shSetIdentifier "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote
|
||||
if exists("b:is_bash")
|
||||
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
|
||||
syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
|
||||
syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList
|
||||
elseif exists("b:is_kornshell")
|
||||
syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
|
||||
syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
|
||||
@ -390,15 +405,15 @@ if !exists("g:is_posix")
|
||||
endif
|
||||
|
||||
if exists("b:is_bash")
|
||||
if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions
|
||||
syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
if s:sh_fold_functions
|
||||
syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
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
|
||||
else
|
||||
syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList
|
||||
syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained
|
||||
endif
|
||||
else
|
||||
if (g:sh_fold_enabled % (s:sh_fold_functions * 2))/s:sh_fold_functions
|
||||
if s:sh_fold_functions
|
||||
syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
else
|
||||
@ -409,7 +424,7 @@ endif
|
||||
|
||||
" Parameter Dereferencing: {{{1
|
||||
" ========================
|
||||
syn match shDerefSimple "\$\%(\h\w*\|\d\)"
|
||||
syn match shDerefSimple "\$\%(\k\+\|\d\)"
|
||||
syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray
|
||||
if !exists("g:sh_no_error")
|
||||
syn match shDerefWordError "[^}$[]" contained
|
||||
@ -425,12 +440,12 @@ endif
|
||||
" ====================================
|
||||
if exists("b:is_bash")
|
||||
syn region shDeref matchgroup=PreProc start="\${!" end="\*\=}" contains=@shDerefList,shDerefOp
|
||||
syn match shDerefVar contained "{\@<=!\w\+" nextgroup=@shDerefVarList
|
||||
syn match shDerefVar contained "{\@<=!\k\+" nextgroup=@shDerefVarList
|
||||
endif
|
||||
|
||||
syn match shDerefSpecial contained "{\@<=[-*@?0]" nextgroup=shDerefOp,shDerefOpError
|
||||
syn match shDerefSpecial contained "\({[#!]\)\@<=[[:alnum:]*@_]\+" nextgroup=@shDerefVarList,shDerefOp
|
||||
syn match shDerefVar contained "{\@<=\w\+" nextgroup=@shDerefVarList
|
||||
syn match shDerefVar contained "{\@<=\k\+" nextgroup=@shDerefVarList
|
||||
|
||||
" sh ksh bash : ${var[... ]...} array reference: {{{1
|
||||
syn region shDerefVarArray contained matchgroup=shDeref start="\[" end="]" contains=@shCommandSubList nextgroup=shDerefOp,shDerefOpError
|
||||
@ -477,12 +492,12 @@ if exists("b:is_bash")
|
||||
" bash : ${parameter//pattern/string}
|
||||
" bash : ${parameter//pattern}
|
||||
syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft
|
||||
syn region shDerefPPSleft contained start='.' skip=@\%(\\\)\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList
|
||||
syn region shDerefPPSright contained start='.' end='\ze}' contains=@shCommandSubList
|
||||
syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList
|
||||
syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shCommandSubList
|
||||
endif
|
||||
|
||||
" Arithmetic Parenthesized Expressions: {{{1
|
||||
syn region shParen matchgroup=shArithRegion start='(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList
|
||||
syn region shParen matchgroup=shArithRegion start='[^$]\zs(\%(\ze[^(]\|$\)' end=')' contains=@shArithParenList
|
||||
|
||||
" Useful sh Keywords: {{{1
|
||||
" ===================
|
||||
@ -557,6 +572,7 @@ hi def link shDoubleQuote shString
|
||||
hi def link shEcho shString
|
||||
hi def link shEchoDelim shOperator
|
||||
hi def link shEchoQuote shString
|
||||
hi def link shForPP shLoop
|
||||
hi def link shEmbeddedEcho shString
|
||||
hi def link shEscape shCommandSub
|
||||
hi def link shExDoubleQuote shDoubleQuote
|
||||
@ -592,6 +608,7 @@ if exists("b:is_bash")
|
||||
hi def link bashStatement shStatement
|
||||
hi def link shFunctionParen Delimiter
|
||||
hi def link shFunctionDelim Delimiter
|
||||
hi def link shCharClass shSpecial
|
||||
endif
|
||||
if exists("b:is_kornshell")
|
||||
hi def link kshSpecialVariables shShellVariables
|
||||
|
||||
Reference in New Issue
Block a user