completefunc set to CompleteSnippets()

This commit is contained in:
ManjaroOne666 2018-06-17 17:22:39 +01:00
parent e86a27c888
commit e92b423040
1 changed files with 29 additions and 0 deletions

View File

@ -362,6 +362,35 @@ function! ListUltisnips() abort
endfor
echo '---------------------------------------------------'
endfunction
function! CompleteSnippets(findstart, base)
if a:findstart
let l:line = getline('.')
let l:start = col('.') - 1
while l:start > 0 && l:line[l:start - 1] =~ '\a'
let l:start -= 1
endwhile
return l:start
else
let l:res = []
let l:snips = UltiSnips#SnippetsInCurrentScope(1)
let l:keylist = sort(keys(l:snips))
for l:key in l:keylist
if l:key =~ '^' . a:base
let l:item = {'word': l:key, 'menu': l:snips[l:key]}
call add(l:res, l:item)
endif
endfor
return l:res
endif
endfunction
set completefunc=CompleteSnippets
"}}}
" Netrw