Merge pull request #624 from chemzqm/patch-1

syntax highlight for unite ultisnips
This commit is contained in:
Stanislav Seletskiy 2015-12-22 12:21:16 +05:00
commit dbd43ad27c

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']