Add User event "SignifySetup"

This commit is contained in:
Marco Hinz 2017-02-20 16:40:57 +01:00
parent 8fa3524a13
commit 01ec338fdb
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F
2 changed files with 16 additions and 8 deletions

View File

@ -441,17 +441,19 @@ via |hl-ErrorMsg|.
==============================================================================
AUTOCOMMAND *signify-autocommand*
If Sy detects changes to a version-controlled file, it will trigger the |User|
autocommand |{event}| with "Signify" as the autocommand |{pat}|. This allows
you to perform actions in response to Sy detecting differences.
User SignifySetup~
For example,
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 Signify call sy#sign#remove_all_signs(bufnr(''))
autocmd User SignifySetup autocmd! signify CursorHoldI
<
removes all the signs that Sy placed in the current buffer. This may be
useful if your want to use the values from `sy#repo#get_stats()` but do not
want to see the signs.
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|.

View File

@ -12,6 +12,8 @@ let g:loaded_signify = 1
let g:signify_locked = 0
let s:realtime = get(g:, 'signify_realtime') && has('patch-7.4.1967')
let s:has_doau_modeline = v:version > 703 || v:version == 703 && has('patch442')
" Init: autocmds {{{1
augroup signify
@ -80,3 +82,7 @@ function! s:save()
write
endif
endfunction
if exists('#User#SignifySetup')
execute 'doautocmd' (s:has_doau_modeline ? '<nomodeline>' : '') 'User SignifySetup'
endif