From a03bee658f3c45590c0b3108c9e4579dc1bba922 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Fri, 24 Oct 2014 11:39:05 +0200 Subject: [PATCH] Add support for lazy loading --- autoload/sy.vim | 6 ++---- autoload/sy/highlight.vim | 8 +++----- plugin/signify.vim | 6 ++---- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/autoload/sy.vim b/autoload/sy.vim index ee3ee75..5b20c0b 100644 --- a/autoload/sy.vim +++ b/autoload/sy.vim @@ -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 diff --git a/autoload/sy/highlight.vim b/autoload/sy/highlight.vim index 256553f..5f6cbb5 100644 --- a/autoload/sy/highlight.vim +++ b/autoload/sy/highlight.vim @@ -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() diff --git a/plugin/signify.vim b/plugin/signify.vim index 432abdf..a8d8bec 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -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(':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