From e92b423040506f01334b9eb72f7cab5e9ff3bbd2 Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Sun, 17 Jun 2018 17:22:39 +0100 Subject: [PATCH] completefunc set to CompleteSnippets() --- vimrc.plugins.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/vimrc.plugins.vim b/vimrc.plugins.vim index c35efbc..c379690 100644 --- a/vimrc.plugins.vim +++ b/vimrc.plugins.vim @@ -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