Fix skip completion behavior
This commit is contained in:
parent
d1fa664ec9
commit
f106827933
@ -27,8 +27,6 @@ let s:save_cpo = &cpo
|
|||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! neosnippet#view#_expand(cur_text, col, trigger_name) "{{{
|
function! neosnippet#view#_expand(cur_text, col, trigger_name) "{{{
|
||||||
call s:skip_next_auto_completion()
|
|
||||||
|
|
||||||
let snippets = neosnippet#helpers#get_snippets()
|
let snippets = neosnippet#helpers#get_snippets()
|
||||||
|
|
||||||
if a:trigger_name == '' || !has_key(snippets, a:trigger_name)
|
if a:trigger_name == '' || !has_key(snippets, a:trigger_name)
|
||||||
@ -135,45 +133,47 @@ function! neosnippet#view#_insert(snippet, options, cur_text, col) "{{{
|
|||||||
endtry
|
endtry
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
function! neosnippet#view#_jump(_, col) "{{{
|
function! neosnippet#view#_jump(_, col) "{{{
|
||||||
call s:skip_next_auto_completion()
|
try
|
||||||
|
let expand_stack = neosnippet#variables#expand_stack()
|
||||||
|
|
||||||
let expand_stack = neosnippet#variables#expand_stack()
|
" Get patterns and count.
|
||||||
|
if empty(expand_stack)
|
||||||
|
return neosnippet#view#_search_outof_range(a:col)
|
||||||
|
endif
|
||||||
|
|
||||||
" Get patterns and count.
|
let expand_info = expand_stack[-1]
|
||||||
if empty(expand_stack)
|
" Search patterns.
|
||||||
return neosnippet#view#_search_outof_range(a:col)
|
let [begin, end] = neosnippet#view#_get_snippet_range(
|
||||||
endif
|
\ expand_info.begin_line,
|
||||||
|
\ expand_info.begin_patterns,
|
||||||
|
\ expand_info.end_line,
|
||||||
|
\ expand_info.end_patterns)
|
||||||
|
|
||||||
let expand_info = expand_stack[-1]
|
let begin_cnt = expand_info.holder_cnt
|
||||||
" Search patterns.
|
if expand_info.snippet =~
|
||||||
let [begin, end] = neosnippet#view#_get_snippet_range(
|
\ neosnippet#get_placeholder_marker_substitute_nonzero_pattern()
|
||||||
\ expand_info.begin_line,
|
while (expand_info.holder_cnt - begin_cnt) < 5
|
||||||
\ expand_info.begin_patterns,
|
" Next count.
|
||||||
\ expand_info.end_line,
|
let expand_info.holder_cnt += 1
|
||||||
\ expand_info.end_patterns)
|
if neosnippet#view#_search_snippet_range(
|
||||||
|
\ begin, end, expand_info.holder_cnt - 1)
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endif
|
||||||
|
|
||||||
let begin_cnt = expand_info.holder_cnt
|
" Search placeholder 0.
|
||||||
if expand_info.snippet =~
|
if neosnippet#view#_search_snippet_range(begin, end, 0)
|
||||||
\ neosnippet#get_placeholder_marker_substitute_nonzero_pattern()
|
return 1
|
||||||
while (expand_info.holder_cnt - begin_cnt) < 5
|
endif
|
||||||
" Next count.
|
|
||||||
let expand_info.holder_cnt += 1
|
|
||||||
if neosnippet#view#_search_snippet_range(
|
|
||||||
\ begin, end, expand_info.holder_cnt - 1)
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Search placeholder 0.
|
" Not found.
|
||||||
if neosnippet#view#_search_snippet_range(begin, end, 0)
|
call neosnippet#variables#pop_expand_stack()
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Not found.
|
return neosnippet#view#_jump(a:_, a:col)
|
||||||
call neosnippet#variables#pop_expand_stack()
|
finally
|
||||||
|
call s:skip_next_auto_completion()
|
||||||
return neosnippet#view#_jump(a:_, a:col)
|
endtry
|
||||||
endfunction"}}}
|
endfunction"}}}
|
||||||
|
|
||||||
function! s:indent_snippet(begin, end) "{{{
|
function! s:indent_snippet(begin, end) "{{{
|
||||||
|
Loading…
Reference in New Issue
Block a user