syntax highlight for unite ultisnips

This commit is contained in:
Qiming zhao 2015-12-21 22:06:16 +08:00
parent 5a2dcc5cbf
commit 3a70765f40

View File

@ -5,6 +5,7 @@ let s:unite_source = {
\ 'name': 'ultisnips',
\ 'hooks': {},
\ 'action_table': {},
\ 'syntax' : 'uniteSource__Ultisnips',
\ 'default_action': 'expand',
\ }
@ -13,6 +14,20 @@ let s:unite_source.action_table.preview = {
\ 'is_quit' : 0,
\ }
function! s:unite_source.hooks.on_syntax(args, context) abort
syntax case ignore
syntax match uniteSource__UltisnipsHeader /^.*$/
\ containedin=uniteSource__Ultisnips
syntax match uniteSource__UltisnipsTrigger /\v^\s.{-}\ze\s/ contained
\ containedin=uniteSource__UltisnipsHeader
\ nextgroup=uniteSource__UltisnipsDescription
syntax match uniteSource__UltisnipsDescription /\v.{3}\s\zs\w.*$/ contained
\ containedin=uniteSource__UltisnipsHeader
highlight default link uniteSource__UltisnipsTrigger Identifier
highlight default link uniteSource__UltisnipsDescription Statement
endfunction
function! s:unite_source.action_table.preview.func(candidate)
" no nice preview at this point, cannot get snippet text
let snippet_preview = a:candidate['word']