Implement auto clear markers feature
This commit is contained in:
parent
58ed397963
commit
32e2cf9f70
@ -137,8 +137,7 @@ function! neosnippet#commands#_clear_markers() "{{{
|
||||
let expand_stack = neosnippet#variables#expand_stack()
|
||||
|
||||
" Get patterns and count.
|
||||
if !&l:modifiable
|
||||
\ || !&l:modified
|
||||
if !&l:modifiable || !&l:modified
|
||||
\ || empty(expand_stack)
|
||||
\ || neosnippet#variables#current_neosnippet().trigger
|
||||
return
|
||||
|
@ -84,6 +84,22 @@ function! neosnippet#handlers#_complete_done() "{{{
|
||||
\ '', 0, '', trigger)
|
||||
endfunction"}}}
|
||||
|
||||
function! neosnippet#handlers#_cursor_moved() "{{{
|
||||
let expand_stack = neosnippet#variables#expand_stack()
|
||||
|
||||
" Get patterns and count.
|
||||
if !&l:modifiable || !&l:modified
|
||||
\ || empty(expand_stack)
|
||||
return
|
||||
endif
|
||||
|
||||
let expand_info = expand_stack[-1]
|
||||
if expand_info.begin_line == expand_info.end_line
|
||||
\ && line('.') != expand_info.begin_line
|
||||
call neosnippet#commands#_clear_markers()
|
||||
endif
|
||||
endfunction"}}}
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
|
@ -88,6 +88,8 @@ function! s:initialize_others() "{{{
|
||||
\ call neosnippet#variables#set_snippets({})
|
||||
autocmd BufEnter *
|
||||
\ call neosnippet#mappings#_clear_select_mode_mappings()
|
||||
autocmd CursorMoved,CursorMovedI *
|
||||
\ call neosnippet#handlers#_cursor_moved()
|
||||
autocmd BufWritePre * NeoSnippetClearMarkers
|
||||
augroup END"}}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user