Fix #306 clear all markers when BufWritePost
This commit is contained in:
parent
4c1650096f
commit
cfc99eedb5
@ -101,6 +101,22 @@ function! neosnippet#handlers#_cursor_moved() "{{{
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
function! neosnippet#handlers#_all_clear_markers() "{{{
|
||||
let pos = getpos('.')
|
||||
|
||||
try
|
||||
" Search out of range.
|
||||
while neosnippet#view#_search_outof_range(col('.'))
|
||||
endwhile
|
||||
finally
|
||||
stopinsert
|
||||
|
||||
call setpos('.', pos)
|
||||
|
||||
call neosnippet#variables#clear_expand_stack()
|
||||
endtry
|
||||
endfunction"}}}
|
||||
|
||||
function! neosnippet#handlers#_get_in_paren(str) abort "{{{
|
||||
let s = ''
|
||||
let level = 0
|
||||
|
@ -50,7 +50,8 @@ function! s:initialize_others() "{{{
|
||||
augroup neosnippet "{{{
|
||||
autocmd!
|
||||
" Set make cache event.
|
||||
autocmd FileType * call neosnippet#commands#_make_cache(&filetype)
|
||||
autocmd FileType *
|
||||
\ call neosnippet#commands#_make_cache(&filetype)
|
||||
" Re make cache events
|
||||
autocmd BufWritePost *.snip,*.snippets
|
||||
\ call neosnippet#variables#set_snippets({})
|
||||
@ -58,7 +59,8 @@ function! s:initialize_others() "{{{
|
||||
\ call neosnippet#mappings#_clear_select_mode_mappings()
|
||||
autocmd CursorMoved,CursorMovedI *
|
||||
\ call neosnippet#handlers#_cursor_moved()
|
||||
autocmd BufWritePre * NeoSnippetClearMarkers
|
||||
autocmd BufWritePre *
|
||||
\ call neosnippet#handlers#_all_clear_markers()
|
||||
augroup END"}}}
|
||||
|
||||
if exists('v:completed_item')
|
||||
|
@ -140,7 +140,7 @@ function! neosnippet#view#_jump(_, col) "{{{
|
||||
|
||||
" Get patterns and count.
|
||||
if empty(expand_stack)
|
||||
return s:search_outof_range(a:col)
|
||||
return neosnippet#view#_search_outof_range(a:col)
|
||||
endif
|
||||
|
||||
let expand_info = expand_stack[-1]
|
||||
@ -170,7 +170,7 @@ function! neosnippet#view#_jump(_, col) "{{{
|
||||
let expand_stack = neosnippet#variables#expand_stack()
|
||||
let expand_stack = expand_stack[: -2]
|
||||
|
||||
return s:search_outof_range(a:col)
|
||||
return neosnippet#view#_search_outof_range(a:col)
|
||||
endfunction"}}}
|
||||
|
||||
function! s:indent_snippet(begin, end) "{{{
|
||||
@ -269,7 +269,7 @@ function! neosnippet#view#_search_snippet_range(start, end, cnt, ...) "{{{
|
||||
|
||||
return 0
|
||||
endfunction"}}}
|
||||
function! s:search_outof_range(col) "{{{
|
||||
function! neosnippet#view#_search_outof_range(col) "{{{
|
||||
call s:substitute_placeholder_marker(1, 0, 0)
|
||||
|
||||
let pattern = neosnippet#get_placeholder_marker_pattern()
|
||||
|
Loading…
Reference in New Issue
Block a user