diff --git a/autoload/sy/util.vim b/autoload/sy/util.vim index a6ca6c0..c866a14 100644 --- a/autoload/sy/util.vim +++ b/autoload/sy/util.vim @@ -41,3 +41,10 @@ function! sy#util#run_in_dir(dir, cmd) abort return ret endfunction + +" Function: #refresh_windows {{{1 +function! sy#util#refresh_windows() abort + let winnr = winnr() + windo if exists('b:sy') | call sy#start() | endif + execute winnr .'wincmd w' +endfunction diff --git a/doc/signify.txt b/doc/signify.txt index 7ab4238..4b6cd71 100644 --- a/doc/signify.txt +++ b/doc/signify.txt @@ -33,6 +33,7 @@ TOC *signify-contents* OPTIONS ........................ |signify-options| COMMANDS ....................... |signify-commands| MAPPINGS ....................... |signify-mappings| + FUNCTIONS ...................... |signify-functions| OBJECTS ........................ |signify-objects| COLORS ......................... |signify-colors| @@ -96,7 +97,7 @@ All available options:~ |g:signify_skip_filetype| |g:signify_skip_filename| |g:signify_update_on_bufenter| - |g:signify_update_on_focus| + |g:signify_update_on_focusgained| |g:signify_line_highlight| |g:signify_sign_add| |g:signify_sign_delete| @@ -209,11 +210,11 @@ Update signs when entering a buffer that was modified. NOTE: This also saves the buffer to disk! ------------------------------------------------------------------------------ - *g:signify_update_on_focus* + *g:signify_update_on_focusgained* > - let g:signify_update_on_focus = 0 + let g:signify_update_on_focusgained = 0 < -Update signs when Vim gains/loses focus. +Update signs when Vim gains focus. ------------------------------------------------------------------------------ *g:signify_line_highlight* @@ -307,6 +308,19 @@ Default mapping: gt Toggle line highlighting for lines containing changes. Default mapping: gh +============================================================================== +FUNCTIONS *signify-functions* + +Signify exposes some functions which you can use to customize its behavior. + +------------------------------------------------------------------------------ + *signify-#refresh_windows()* + +This function updates signs for all windows. For example, to update signs when +Vim loses focus, you use: +> + autocmd FocusLost * call sy#util#refresh_windows() +< ============================================================================== OBJECTS *signify-objects* diff --git a/plugin/signify.vim b/plugin/signify.vim index 7b2b257..0e244b9 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -30,8 +30,8 @@ augroup signify autocmd CursorHoldI * nested call s:save() endif - if get(g:, 'signify_update_on_focus') && !has('gui_win32') - autocmd FocusGained,FocusLost * call s:refresh_windows() + if get(g:, 'signify_update_on_focusgained') && !has('gui_win32') + autocmd FocusGained * call sy#util#refresh_windows() endif augroup END @@ -102,13 +102,6 @@ function! s:save() endif endfunction -" Function: refresh_windows {{{1 -function! s:refresh_windows() abort - let winnr = winnr() - windo if exists('b:sy') | call sy#start() | endif - execute winnr .'wincmd w' -endfunction - " Function: hunk_text_object {{{1 function! s:hunk_text_object(emptylines) abort if !exists('b:sy')