Add neosnippet#complete_done()
This commit is contained in:
parent
7121b95c9e
commit
ef8729c7cc
@ -42,6 +42,10 @@ endfunction
|
|||||||
function! neosnippet#expand(trigger) abort
|
function! neosnippet#expand(trigger) abort
|
||||||
return neosnippet#mappings#_expand(a:trigger)
|
return neosnippet#mappings#_expand(a:trigger)
|
||||||
endfunction
|
endfunction
|
||||||
|
function! neosnippet#complete_done() abort
|
||||||
|
return neosnippet#mappings#_complete_done(
|
||||||
|
\ neosnippet#util#get_cur_text(), col('.'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! neosnippet#get_snippets_directory() abort
|
function! neosnippet#get_snippets_directory() abort
|
||||||
return neosnippet#helpers#get_snippets_directory()
|
return neosnippet#helpers#get_snippets_directory()
|
||||||
|
@ -140,7 +140,7 @@ function! neosnippet#mappings#_expand(trigger) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:snippets_expand(cur_text, col) abort
|
function! s:snippets_expand(cur_text, col) abort
|
||||||
if s:expand_completed_snippets(a:cur_text, a:col)
|
if neosnippet#mappings#_complete_done(a:cur_text, a:col)
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -184,8 +184,13 @@ function! s:get_completed_snippets(cur_text, col) abort
|
|||||||
|
|
||||||
return []
|
return []
|
||||||
endfunction
|
endfunction
|
||||||
function! s:expand_completed_snippets(cur_text, col) abort
|
function! neosnippet#mappings#_complete_done(cur_text, col) abort
|
||||||
let [cur_text, snippet] = s:get_completed_snippets(a:cur_text, a:col)
|
let ret = s:get_completed_snippets(a:cur_text, a:col)
|
||||||
|
if empty(ret)
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let [cur_text, snippet] = ret
|
||||||
call neosnippet#view#_insert(snippet, {}, cur_text, a:col)
|
call neosnippet#view#_insert(snippet, {}, cur_text, a:col)
|
||||||
return 1
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -373,6 +373,11 @@ neosnippet#get_snippets_directory()
|
|||||||
snippets directories and |g:neosnippet#snippets_directory|
|
snippets directories and |g:neosnippet#snippets_directory|
|
||||||
directories.
|
directories.
|
||||||
|
|
||||||
|
*neosnippet#complete_done()*
|
||||||
|
neosnippet#complete_done()
|
||||||
|
It expands the snippet for |CompleteDone| event.
|
||||||
|
>
|
||||||
|
autocmd CompleteDone * call neosnippet#complete_done()
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
EXAMPLES *neosnippet-examples*
|
EXAMPLES *neosnippet-examples*
|
||||||
|
Loading…
Reference in New Issue
Block a user