only write buffer to disk if sensible

Only write the buffer to disk on CursorMoved / CursorMovedI, if the file
is already handled by Sy.
This commit is contained in:
Marco Hinz 2013-04-13 15:36:20 +02:00
parent eb7bcb8c48
commit 661eb7cedd

View File

@ -59,17 +59,11 @@ augroup signify
endif
if get(g:, 'signify_cursorhold_normal')
autocmd CursorHold *
\ if filewritable(s:path) && empty(&buftype) |
\ update | call s:start(s:path) |
\ endif
autocmd CursorHold * if has_key(s:sy, s:path) && filewritable(s:path) | update | call s:start(s:path) | endif
endif
if get(g:, 'signify_cursorhold_insert')
autocmd CursorHoldI *
\ if filewritable(s:path) && empty(&buftype) |
\ update | call s:start(s:path) |
\ endif
autocmd CursorHoldI * if has_key(s:sy, s:path) && filewritable(s:path) | update | call s:start(s:path) | endif
endif
if !has('gui_win32')
@ -130,6 +124,7 @@ endfunction
" Function: s:start {{{1
function! s:start(path) abort
if !filereadable(a:path)
\ || !empty(&buftype)
\ || (exists('g:signify_skip_filetype') && has_key(g:signify_skip_filetype, &ft))
\ || (exists('g:signify_skip_filename') && has_key(g:signify_skip_filename, a:path))
return