2015-08-21 21:36:11 +00:00
|
|
|
"=============================================================================
|
|
|
|
" FILE: handlers.vim
|
2017-06-15 00:11:15 +00:00
|
|
|
" AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
|
2017-06-15 00:04:27 +00:00
|
|
|
" License: MIT license
|
2015-08-21 21:36:11 +00:00
|
|
|
"=============================================================================
|
|
|
|
|
2016-02-08 12:48:14 +00:00
|
|
|
function! neosnippet#handlers#_cursor_moved() abort "{{{
|
2015-08-29 00:33:43 +00:00
|
|
|
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
|
2015-12-19 01:00:57 +00:00
|
|
|
call neosnippet#view#_clear_markers(expand_info)
|
2015-08-29 00:33:43 +00:00
|
|
|
endif
|
|
|
|
endfunction"}}}
|
|
|
|
|
2016-02-08 12:48:14 +00:00
|
|
|
function! neosnippet#handlers#_all_clear_markers() abort "{{{
|
2016-05-17 11:50:40 +00:00
|
|
|
if !&l:modifiable
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
2015-12-15 18:40:40 +00:00
|
|
|
let pos = getpos('.')
|
|
|
|
|
|
|
|
try
|
2015-12-19 01:00:57 +00:00
|
|
|
while !empty(neosnippet#variables#expand_stack())
|
|
|
|
call neosnippet#view#_clear_markers(
|
|
|
|
\ neosnippet#variables#expand_stack()[-1])
|
2016-06-30 23:15:01 +00:00
|
|
|
stopinsert
|
2015-12-15 18:40:40 +00:00
|
|
|
endwhile
|
|
|
|
finally
|
|
|
|
call setpos('.', pos)
|
|
|
|
endtry
|
|
|
|
endfunction"}}}
|
|
|
|
|
2016-02-08 12:48:14 +00:00
|
|
|
function! neosnippet#handlers#_restore_unnamed_register() abort "{{{
|
2016-01-26 12:32:31 +00:00
|
|
|
let neosnippet = neosnippet#variables#current_neosnippet()
|
|
|
|
|
|
|
|
if neosnippet.unnamed_register != ''
|
|
|
|
\ && @" !=# neosnippet.unnamed_register
|
|
|
|
let @" = neosnippet.unnamed_register
|
|
|
|
let neosnippet.unnamed_register = ''
|
|
|
|
endif
|
|
|
|
endfunction"}}}
|
|
|
|
|
2015-08-21 21:36:11 +00:00
|
|
|
" vim: foldmethod=marker
|