When opening vim with multiple files, e.g. via `vim -o file1 file2`, Vim
fires a `BufEnter` event for each file. However the effective buffer
number (`<abuf>`) is always 1, instead of being each buffer's number in
turn, so we end up processing the first buffer n times instead of each
of n buffers once.
This commit is a brute force workaround to ensure all buffers are
processed if there is more than one.
Closes#428.
Before this change the TabEnter/BufEnter logic was intertwined with
the logic for BufWritePost,FileChangedShellPost.
Separating the concerns fixes a minor bug where a TabEnter-BufEnter
combination led to the plugin not updating the diff the first time the
buffer was written.
"Undo" is a better name than "revert" because:
- "revert" sounds like it has something to do with `git-revert` but they
are entirely different;
- "undo" is consistent with vim's "undo": discarding changes and going
back to the original.
Maintain backwards compatibility and add deprecation warnings.
Closes#306.
Reverts feature introduced in 5c23cadf57
In order to use an escaped grep, please replace
`g:gitgutter_escape_grep=1` with:
let g:gitgutter_grep_command = '\grep --color=never -e'
Most colorschemes (e.g. solarized) don't give any thought to the
SignColumn highlight group so generally the sign column is ugly.
With this change vim-gitgutter defaults to making the sign column look
like the line number column.
Solarized users no longer need `highlight clear SignColumn` in their
vimrc :)
To stop vim-gitgutter from overriding the SignColumn highlight, add this
to your vimrc:
let g:gitgutter_override_sign_column_highlight = 0
Also don't pass buffer number to functions when they can look it up
themselves.
Using buffer numbers also eliminates any ambiguity which might arise
from symbolic links, where you have potentially two names for a file.
Thanks to @Z1MM32M4N for work on this (see #209).
Before this commit some Windows users saw the command prompt pop
up briefly, and/or the taskbar flicker, every time the plugin ran.
Now the plugin will use xolox's vim-shell and vim-misc, if they are
available and we are on Windows, to execute external commands. Xolox's
clever plugins avoid the command prompt popup and taskbar flicker.
Windows users with those plugins installed can opt out by setting a
variable in their vimrc.
Many thanks to @suxpert for the initial code.
This avoids shelling out twice per buffer: once to check whether git
knows about the file and once to perform the diff. Now we simply do
both in one external call.
Profiling showed external calls to git taking ~20ms. This doesn't seem
too bad but it adds up.