Fix coloring of shell/VimL/Python command substitutions

Include the sh syntax for shell commands.
Make the matching on !v/!p work more accurately.
Highlight the !v/!p separately from the embedded Python/VimL.

AFAIK the only issue now is that "\`" escapes inside shell/VimL/Python
are not treated as bare "`" characters by the embedded syntax, but I
don't believe there's any way to fix that.
This commit is contained in:
Kevin Ballard 2014-06-29 20:47:22 -07:00
parent 5b80ef187d
commit 739e3d94ad

View File

@ -9,6 +9,8 @@ syntax include @Python syntax/python.vim
unlet b:current_syntax unlet b:current_syntax
syntax include @Viml syntax/vim.vim syntax include @Viml syntax/vim.vim
unlet b:current_syntax unlet b:current_syntax
syntax include @Shell syntax/sh.vim
unlet b:current_syntax
" global matches " global matches
syn match snipComment "^#.*" contains=snipTODO syn match snipComment "^#.*" contains=snipTODO
@ -27,9 +29,12 @@ syn match snipExtends "^extends.*" contains=snipKeyword
" snippet definitions " snippet definitions
syn match snipStart "^snippet.*" contained contains=snipKeyword,snipDocString syn match snipStart "^snippet.*" contained contains=snipKeyword,snipDocString
syn match snipEnd "^endsnippet" contained contains=snipKeyword syn match snipEnd "^endsnippet" contained contains=snipKeyword
syn region snipCommand keepend start="`" skip="\\[{}\\$`]" end="`" contains=snipPythonCommand,snipVimLCommand
syn region snipPythonCommand keepend start="`!p" skip="\\[{}\\$`]" end="`" contained contains=@Python syn region snipCommand keepend matchgroup=snipCommandDelim start="`" skip="\\[{}\\$`]" end="`" contains=snipPythonCommand,snipVimLCommand,snipShellCommand
syn region snipVimLCommand keepend start="`!v" skip="\\[{}\\$`]" end="`" contained contains=@Viml syn region snipShellCommand start="\ze\_." skip="\\[{}\\$`]" end="\ze`" contained contains=@Shell
syn region snipPythonCommand matchgroup=snipPythonCommandP start="`\@<=!p\_s" skip="\\[{}\\$`]" end="\ze`" contained contains=@Python
syn region snipVimLCommand matchgroup=snipVimLCommandV start="`\@<=!v\_s" skip="\\[{}\\$`]" end="\ze`" contained contains=@Viml
syn match snipVar "\$\d*" contained syn match snipVar "\$\d*" contained
syn region snipVisual matchgroup=Define start="\${VISUAL" end="}" contained syn region snipVisual matchgroup=Define start="\${VISUAL" end="}" contained
syn region snipVarExpansion matchgroup=Define start="\${\d*" end="}" contained contains=snipVar,snipVarExpansion,snipCommand syn region snipVarExpansion matchgroup=Define start="\${\d*" end="}" contained contains=snipVar,snipVarExpansion,snipCommand
@ -58,9 +63,15 @@ hi def link snipExtends Statement
hi def link snipStart Statement hi def link snipStart Statement
hi def link snipEnd snipStart hi def link snipEnd snipStart
hi def link snipCommand Special hi def link snipCommand Special
hi def link snipCommandDelim snipCommand
hi def link snipShellCommand snipCommand
hi def link snipPythonCommand snipCommand hi def link snipPythonCommand snipCommand
hi def link snipVimLCommand snipCommand hi def link snipVimLCommand snipCommand
hi def link snipPythonCommandP PreProc
hi def link snipVimLCommandV PreProc
hi def link snipVar StorageClass hi def link snipVar StorageClass
hi def link snipVarExpansion Normal hi def link snipVarExpansion Normal
hi def link snipVisual Normal hi def link snipVisual Normal