Restore g:signify_cursorhold_{normal,insert}

References #230.
This commit is contained in:
Marco Hinz 2017-02-25 22:06:54 +01:00
parent 63efffcae7
commit ce7779198b
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F
2 changed files with 54 additions and 34 deletions

View File

@ -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 <leader>gt SignifyToggle
nnoremap <leader>gh SignifyToggleHighlight
nnoremap <leader>gr SignifyRefresh

View File

@ -7,16 +7,11 @@ 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 s:has_doau_modeline = v:version > 703 || v:version == 703 && has('patch442')
" Init: autocmds {{{1
augroup signify
autocmd!
@ -24,24 +19,38 @@ augroup signify
autocmd QuickFixCmdPost *vimgrep* let g:signify_locked = 0
autocmd BufWritePost * call sy#start()
autocmd CursorHold,CursorHoldI * nested if &autowrite | call s:save() | endif
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
if get(g:, 'signify_update_on_bufenter')
autocmd BufEnter * nested call s:save()
endif
if s:realtime || get(g:, 'signify_update_on_focusgained')
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')
" Fix 'no signs at start' race.