Since we don't switch the window anymore, we can't simply refer to b:sy as we
used to do while Sy worked only synchronously.
Now we provide the buffer number to each job and the exit handler gets a pointer
to the b:sy of that buffer and passes it to all the subsequent functions.
References #209, #210.
For each new buffer sy#repo#detect() gets run. That function invokes callbacks
for all VCS from g:signify_vcs_list.
If no callback finds a valid repo, sy#set_signs() is never called and the VCS
type of the newly registered buffer keeps its initial value: "unknown".
The next time Sy gets run in that buffer, Sy will disable itself, so that all
subsequent times it gets run it will never even attempt to get a diff.
If a buffer was added to a repo that was initialized after Sy registered that
buffer, it will remain inactive.
In those cases, :SignifyEnable will purge the cache for the current buffer and
start all over.
The <nomodeline> flag for :doautocmd was implemented in 7.3.438. Certain
LTS distros, e.g. Ubuntu 12.04, come with even older Vim versions,
though.
Silently ignore the flag in such cases.
Closes https://github.com/mhinz/vim-signify/issues/185
sy#stop() is called by the BufDelete autocmd so b: variables may not
correspond to the buffer actually being deleted. Instead, we must use
<abuf> to determine which buffer is being deleted and pass that into
sy#stop().
There are some ripple effects, causing sy#sign#remove_all_signs to also
gain a buffer number argument.
Signed-off-by: James McCoy <vega.james@gmail.com>
Prior to this patch a VCS was only detected by checking if a potential
diff was empty or not. Now the combination of return value and diff is
checked, so it detects an underlying VCS properly even when there are no
changes.
This can save many useless calls to the wrong version control systems.
Simple test:
- open a version-controlled file without any changes
- :SyDebug should show the correct VCS now (instead of 'unknown')
Closes#82.