Improve complete done behavior
This commit is contained in:
parent
5246b1f924
commit
12ad06d37d
@ -31,13 +31,6 @@ function! neosnippet#handlers#_complete_done() "{{{
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let snippets = neosnippet#helpers#get_snippets()
|
|
||||||
if has_key(snippets, v:completed_item.word)
|
|
||||||
\ && !get(snippets[v:completed_item.word], 'oneshot', 0)
|
|
||||||
" Don't overwrite exists snippets
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let item = v:completed_item
|
let item = v:completed_item
|
||||||
|
|
||||||
let abbr = (item.abbr != '') ? item.abbr : item.word
|
let abbr = (item.abbr != '') ? item.abbr : item.word
|
||||||
@ -56,8 +49,8 @@ function! neosnippet#handlers#_complete_done() "{{{
|
|||||||
|
|
||||||
" Make snippet arguments
|
" Make snippet arguments
|
||||||
let cnt = 1
|
let cnt = 1
|
||||||
let snippet = item.word
|
let snippet = ''
|
||||||
if snippet !~ '()\?$'
|
if item.word !~ '()\?$'
|
||||||
let snippet .= '('
|
let snippet .= '('
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -83,19 +76,8 @@ function! neosnippet#handlers#_complete_done() "{{{
|
|||||||
let snippet .= '${0}'
|
let snippet .= '${0}'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let options = neosnippet#parser#_initialize_snippet_options()
|
|
||||||
let options.word = 1
|
|
||||||
let options.oneshot = 1
|
|
||||||
|
|
||||||
let neosnippet = neosnippet#variables#current_neosnippet()
|
|
||||||
let trigger = item.word
|
|
||||||
let neosnippet.snippets[trigger] =
|
|
||||||
\ neosnippet#parser#_initialize_snippet(
|
|
||||||
\ { 'name' : trigger, 'word' : snippet, 'options' : options },
|
|
||||||
\ '', 0, '', trigger)
|
|
||||||
|
|
||||||
let [cur_text, col, expr] = neosnippet#mappings#_pre_trigger()
|
let [cur_text, col, expr] = neosnippet#mappings#_pre_trigger()
|
||||||
call neosnippet#view#_expand(cur_text, col, trigger)
|
call neosnippet#view#_insert(snippet, {}, cur_text, col)
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
|
|
||||||
function! neosnippet#handlers#_cursor_moved() "{{{
|
function! neosnippet#handlers#_cursor_moved() "{{{
|
||||||
|
Loading…
Reference in New Issue
Block a user