Expose sy#util#refresh_windows()

References #141.
This commit is contained in:
Alex Rodionov 2014-11-02 20:57:50 +06:00 committed by Marco Hinz
parent 4c3c10d1cb
commit de297820bc
3 changed files with 27 additions and 13 deletions

View File

@ -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

View File

@ -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: <leader>gt
Toggle line highlighting for lines containing changes.
Default mapping: <leader>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*

View File

@ -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')