2011-02-17 08:07:27 -05:00
|
|
|
" Syntax highlighting for snippet files (used for UltiSnips.vim)
|
2011-03-27 02:07:44 -04:00
|
|
|
" Revision: 26/03/11 19:53:33
|
|
|
|
|
|
|
|
if exists("b:current_syntax")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
|
|
|
syntax include @Python syntax/python.vim
|
2014-06-29 22:42:11 -04:00
|
|
|
unlet b:current_syntax
|
2012-02-05 07:15:25 -05:00
|
|
|
syntax include @Viml syntax/vim.vim
|
2014-06-29 22:42:11 -04:00
|
|
|
unlet b:current_syntax
|
2014-06-29 23:47:22 -04:00
|
|
|
syntax include @Shell syntax/sh.vim
|
|
|
|
unlet b:current_syntax
|
2011-02-17 08:07:27 -05:00
|
|
|
|
|
|
|
" global matches
|
2011-03-27 02:07:44 -04:00
|
|
|
syn match snipComment "^#.*" contains=snipTODO
|
|
|
|
syn keyword snipTODO FIXME NOTE NOTES TODO XXX contained
|
|
|
|
|
2013-03-21 06:32:17 -04:00
|
|
|
syn match snipDocString '"[^"]*"$'
|
2011-02-17 08:07:27 -05:00
|
|
|
syn match snipString '"[^"]*"'
|
|
|
|
syn match snipTabsOnly "^\t\+$"
|
2014-02-18 12:57:43 -05:00
|
|
|
syn match snipLeadingSpaces "^\t* \+"
|
2011-02-17 08:07:27 -05:00
|
|
|
|
2014-02-19 15:04:52 -05:00
|
|
|
syn match snipKeyword "\(\<\(end\)\?\(snippet\|global\)\>\)\|extends\|clearsnippets\|priority" contained
|
2011-02-19 14:00:24 -05:00
|
|
|
|
|
|
|
" extends definitions
|
|
|
|
syn match snipExtends "^extends.*" contains=snipKeyword
|
2011-02-17 08:07:27 -05:00
|
|
|
|
|
|
|
" snippet definitions
|
2013-03-21 06:32:17 -04:00
|
|
|
syn match snipStart "^snippet.*" contained contains=snipKeyword,snipDocString
|
2011-02-17 08:07:27 -05:00
|
|
|
syn match snipEnd "^endsnippet" contained contains=snipKeyword
|
2014-06-29 23:47:22 -04:00
|
|
|
|
|
|
|
syn region snipCommand keepend matchgroup=snipCommandDelim start="`" skip="\\[{}\\$`]" end="`" contains=snipPythonCommand,snipVimLCommand,snipShellCommand
|
|
|
|
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
|
|
|
|
|
2012-08-12 08:05:29 -04:00
|
|
|
syn match snipVar "\$\d*" contained
|
2012-02-05 07:15:25 -05:00
|
|
|
syn region snipVisual matchgroup=Define start="\${VISUAL" end="}" contained
|
2012-08-12 08:05:29 -04:00
|
|
|
syn region snipVarExpansion matchgroup=Define start="\${\d*" end="}" contained contains=snipVar,snipVarExpansion,snipCommand
|
2014-02-18 12:57:43 -05:00
|
|
|
syn region snippet fold keepend start="^snippet" end="^endsnippet" contains=snipStart,snipEnd,snipTabsOnly,snipLeadingSpaces,snipCommand,snipVarExpansion,snipVar,snipVisual
|
2011-02-17 08:07:27 -05:00
|
|
|
|
|
|
|
" global definitions
|
|
|
|
syn match snipGlobalStart "^global.*" contained contains=snipKeyword,snipString
|
|
|
|
syn match snipGlobalEnd "^endglobal" contained contains=snipKeyword
|
2014-02-18 12:57:43 -05:00
|
|
|
syn region snipGlobal fold keepend start="^global" end="^endglobal" contains=snipGlobalStart,snipGlobalEnd,snipLeadingSpaces,snipTabsOnly,snipCommand,snipVarExpansion,snipVar,@Python
|
2011-02-17 08:07:27 -05:00
|
|
|
|
2012-11-24 04:12:36 -05:00
|
|
|
" snippet clearing
|
|
|
|
syn match snipClear "^clearsnippets"
|
2014-02-19 15:04:52 -05:00
|
|
|
syn match snipPriority "^priority"
|
2012-11-24 04:12:36 -05:00
|
|
|
|
2011-02-17 08:07:27 -05:00
|
|
|
" highlighting rules
|
|
|
|
|
2014-06-29 22:36:07 -04:00
|
|
|
hi def link snipComment Comment
|
|
|
|
hi def link snipLeadingSpaces Error
|
|
|
|
hi def link snipString String
|
|
|
|
hi def link snipDocString String
|
|
|
|
hi def link snipTabsOnly Error
|
2011-02-19 14:00:24 -05:00
|
|
|
|
2014-06-29 22:36:07 -04:00
|
|
|
hi def link snipKeyword Keyword
|
2011-02-17 08:07:27 -05:00
|
|
|
|
2014-06-29 22:36:07 -04:00
|
|
|
hi def link snipExtends Statement
|
2011-02-17 08:07:27 -05:00
|
|
|
|
2014-06-29 22:36:07 -04:00
|
|
|
hi def link snipStart Statement
|
|
|
|
hi def link snipEnd snipStart
|
2014-06-29 23:47:22 -04:00
|
|
|
|
2014-06-29 22:36:07 -04:00
|
|
|
hi def link snipCommand Special
|
2014-06-29 23:47:22 -04:00
|
|
|
hi def link snipCommandDelim snipCommand
|
|
|
|
hi def link snipShellCommand snipCommand
|
2014-06-29 22:36:07 -04:00
|
|
|
hi def link snipPythonCommand snipCommand
|
|
|
|
hi def link snipVimLCommand snipCommand
|
2014-06-29 23:47:22 -04:00
|
|
|
hi def link snipPythonCommandP PreProc
|
|
|
|
hi def link snipVimLCommandV PreProc
|
|
|
|
|
2014-06-29 22:36:07 -04:00
|
|
|
hi def link snipVar StorageClass
|
|
|
|
hi def link snipVarExpansion Normal
|
|
|
|
hi def link snipVisual Normal
|
|
|
|
hi def link snippet Normal
|
2011-02-17 08:07:27 -05:00
|
|
|
|
2014-06-29 22:36:07 -04:00
|
|
|
hi def link snipGlobalStart Statement
|
|
|
|
hi def link snipGlobalEnd Statement
|
|
|
|
hi def link snipGlobal Normal
|
2011-03-27 02:07:44 -04:00
|
|
|
|
2014-06-29 22:36:07 -04:00
|
|
|
hi def link snipClear Statement
|
|
|
|
hi def link snipPriority Statement
|
2012-11-24 04:12:36 -05:00
|
|
|
|
2014-06-29 22:42:57 -04:00
|
|
|
let b:current_syntax = "snippets"
|