diff --git a/doc/signify.txt b/doc/signify.txt index 52295c9..955fea9 100644 --- a/doc/signify.txt +++ b/doc/signify.txt @@ -73,9 +73,6 @@ By default, Sy is rather conservative and only updates signs when opening a new buffer or writing it. If you want more agressive sign updating, have a look at |g:signify_realtime|. -Moreover, if you want to update signs after 'updatetime' (using the |CursorHold| -and |CursorHoldI| events), set 'autowrite'. - Use |signify-:SignifyList| to list all buffers managed by Sy and their current state. @@ -146,6 +143,8 @@ Other options:~ |g:signify_sign_changedelete| |g:signify_sign_show_count| |g:signify_sign_show_text| + |g:signify_cursorhold_normal| + |g:signify_cursorhold_insert| |g:signify_difftool| |g:signify_fold_context| @@ -200,7 +199,11 @@ With this option enabled, signs update on: |BufEnter| (opening or switching to another buffer) |WinEnter| (opening or switching to another window) |BufWritePost| (saving a buffer) - |FocusGained| (OS window containing Vim got focus) + |CursorHold| (disable via |g:signify_cursorhold_normal|) + |CursorHoldI| (disable via |g:signify_cursorhold_insert|) + |FocusGained| (disable via |g:signify_update_on_focusgained|) + +You can check the autocmds yourself: `:au signify` NOTE: Running Sy on all these events would block too often for older Vim versions, thus this option requires Vim 7.4.1967+, which is the minimum @@ -288,7 +291,9 @@ NOTE: This also saves the buffer to disk! *g:signify_update_on_focusgained* > let g:signify_update_on_focusgained = 0 < -Update signs when Vim gains focus. +Update signs when the window holding Vim gains focus. + +NOTE: This works for all GUIs and even a few terminal emulators. ------------------------------------------------------------------------------ *g:signify_line_highlight* > @@ -344,6 +349,18 @@ yourself: |signify-colors|. If you want no sign column at all and use Vim 7.4.2201+, use |'signcolumn'|. +------------------------------------------------------------------------------ + *g:signify_cursorhold_normal* + *g:signify_cursorhold_insert* > + let g:signify_cursorhold_normal = 0 + let g:signify_cursorhold_insert = 0 +< +Additionally trigger sign updates in normal or insert mode after 'updatetime' +miliseconds without any keypresses. This fires only once between keypresses, +thus not every 'updatetime' miliseconds. + +NOTE: This also saves the buffer to disk! + ------------------------------------------------------------------------------ *g:signify_difftool* > let g:signify_difftool = 'gnudiff' @@ -446,17 +463,12 @@ User SignifySetup~ This event fires at the end of `plugin/signify.vim`, in case you want to change any of the default autocmds, commands, or mappings. - Example: If 'autowrite' is set, Sy runs on |CursorHold| and |CursorHoldI|. - If you don't want to run it in insert mode, remove the autocmd for it: -> - autocmd User SignifySetup autocmd! signify CursorHoldI -< User Signify~ This event fires when Sy detects changes in a version-controlled file. NOTE: Autocmds don't nest by default. If you use any command that triggers new -events, make sure to add "nested": |autocmd-nested|. +events, make sure to use |autocmd-nested|. ============================================================================== MAPPINGS *signify-mappings* @@ -599,12 +611,11 @@ EXAMPLE *signify-example* An example configuration for Sy: > let g:signify_vcs_list = [ 'git', 'hg' ] + let g:signify_cursorhold_insert = 1 + let g:signify_cursorhold_normal = 1 let g:signify_update_on_bufenter = 0 let g:signify_update_on_focusgained = 1 - " update signs after 'updatetime' - set autowrite - nnoremap gt SignifyToggle nnoremap gh SignifyToggleHighlight nnoremap gr SignifyRefresh diff --git a/plugin/signify.vim b/plugin/signify.vim index dab3ea9..e2f28da 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -7,40 +7,49 @@ if exists('g:loaded_signify') || !has('signs') || &compatible endif " Init: values {{{1 - -let g:loaded_signify = 1 -let g:signify_locked = 0 -let s:realtime = get(g:, 'signify_realtime') && has('patch-7.4.1967') -let s:save_on_bufenter = get(g:, 'signify_update_on_bufenter') - +let g:loaded_signify = 1 +let g:signify_locked = 0 let s:has_doau_modeline = v:version > 703 || v:version == 703 && has('patch442') " Init: autocmds {{{1 - augroup signify autocmd! autocmd QuickFixCmdPre *vimgrep* let g:signify_locked = 1 autocmd QuickFixCmdPost *vimgrep* let g:signify_locked = 0 - autocmd BufWritePost * call sy#start() - autocmd CursorHold,CursorHoldI * nested if &autowrite | call s:save() | endif + autocmd BufWritePost * call sy#start() - if s:realtime - if !s:save_on_bufenter + if get(g:, 'signify_realtime') && has('patch-7.4.1967') + autocmd WinEnter * call sy#start() + if get(g:, 'signify_update_on_bufenter') + autocmd BufEnter * nested call s:save() + else autocmd BufEnter * call sy#start() endif - autocmd WinEnter * call sy#start() + if get(g:, 'signify_cursorhold_normal', 1) + autocmd CursorHold * nested call s:save() + endif + if get(g:, 'signify_cursorhold_insert', 1) + autocmd CursorHoldI * nested call s:save() + endif + if get(g:, 'signify_update_on_focusgained', 1) + autocmd FocusGained * SignifyRefresh + endif else autocmd BufRead * call sy#start() - endif - - if s:save_on_bufenter - autocmd BufEnter * nested call s:save() - endif - - if s:realtime || get(g:, 'signify_update_on_focusgained') - autocmd FocusGained * SignifyRefresh + if get(g:, 'signify_update_on_bufenter') + autocmd BufEnter * nested call s:save() + endif + if get(g:, 'signify_cursorhold_normal') + autocmd CursorHold * nested call s:save() + endif + if get(g:, 'signify_cursorhold_insert') + autocmd CursorHoldI * nested call s:save() + endif + if get(g:, 'signify_update_on_focusgained') + autocmd FocusGained * SignifyRefresh + endif endif if has('gui_running') && has('win32')