Trigger the User autocommand when Sy detects differences

This provides the hook needed for the request in mhinz/vim-signify#181
to disable signs but still get the stats about the detected changes.

Closes mhinz/vim-signify#181
This commit is contained in:
James McCoy 2016-03-31 10:47:33 -04:00
parent 9c0e901579
commit 3f0df1498c
2 changed files with 18 additions and 0 deletions

View File

@ -95,6 +95,8 @@ function! sy#start() abort
call sy#sign#process_diff(diff)
let b:sy.id_top = (g:id_top - 1)
silent doautocmd <nomodeline> User Signify
endfunction
" Function: #stop {{{1

View File

@ -32,6 +32,7 @@ TOC *signify-contents*
USAGE .......................... |signify-usage|
OPTIONS ........................ |signify-options|
COMMANDS ....................... |signify-commands|
AUTOCOMMAND .................... |signify-autocommand|
MAPPINGS ....................... |signify-mappings|
COLORS ......................... |signify-colors|
FAQ ............................ |signify-faq|
@ -402,6 +403,21 @@ a supported VCS, use this command.
It will show all tried commands and its output. Errors will be highlighted 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.
For example,
>
autocmd User Signify call sy#sign#remove_all_signs(bufnr(''))
<
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.
==============================================================================
MAPPINGS *signify-mappings*