Add support for lazy loading

This commit is contained in:
Marco Hinz 2014-10-24 11:39:05 +02:00
parent e4a428c0d7
commit a03bee658f
3 changed files with 7 additions and 13 deletions

View File

@ -12,9 +12,7 @@ function! sy#start() abort
return
endif
if !exists('b:sy_path')
let b:sy_path = resolve(expand('%:p'))
endif
let b:sy_path = resolve(expand('%:p'))
if &diff
\ || !filereadable(b:sy_path)
@ -105,7 +103,7 @@ endfunction
" Function: #toggle {{{1
function! sy#toggle() abort
if !exists('b:sy')
echomsg 'signify: I cannot sy empty buffers!'
call sy#start()
return
endif

View File

@ -70,11 +70,6 @@ endfunction
" Function: #line_toggle {{{1
function! sy#highlight#line_toggle() abort
if !exists('b:sy')
echomsg 'signify: I cannot detect any changes!'
return
endif
if get(g:, 'signify_line_highlight')
call sy#highlight#line_disable()
else
@ -83,3 +78,6 @@ function! sy#highlight#line_toggle() abort
call sy#start()
endfunction
" }}}
call sy#highlight#setup()

View File

@ -14,10 +14,8 @@ let g:signify_locked = 0
augroup signify
autocmd!
autocmd VimEnter * call sy#highlight#setup()
autocmd BufRead,BufEnter,SessionLoadPost * let b:sy_path = resolve(expand('<afile>:p'))
autocmd BufRead,BufWritePost * call sy#start()
autocmd BufDelete * call sy#stop()
autocmd BufRead,BufWritePost * call sy#start()
autocmd BufDelete * call sy#stop()
autocmd QuickFixCmdPre *vimgrep* let g:signify_locked = 1
autocmd QuickFixCmdPost *vimgrep* let g:signify_locked = 0