For default sign colours.
It seems the Diff* highlight groups are generally designed for line
highlighting so they have background colours which differ from the main
background colour. While desirable for line highlights, this isn't what
we want for the signs.
This change makes the plugin default to using the highlight groups
defined by the colorscheme instead of hardcoding its own foreground
colours.
If you liked the previous colours you can restore them by adding these
lines to your vimrc:
highlight GitGutterAdd guifg=#009900 guibg=<X> ctermfg=2 ctermb=<Y>
highlight GitGutterChange guifg=#bbbb00 guibg=<X> ctermfg=3 ctermb=<Y>
highlight GitGutterDelete guifg=#ff2222 guibg=<X> ctermfg=1 ctermb=<Y>
– where you should replace <X> and <Y> are the background colour of your
SignColumn in the gui and the terminal respectively.
For example, with the solarized colorscheme and a dark background,
guibg=#073642 and ctermbg=0.
Closes#545, #560.
The previous commit switched use of writefile() to binary mode so that
we could prevent a newline being added to a completely empty buffer.
Evidently, however, binary mode has side effects (see #567) so this
commit returns to non-binary mode - with a simpler fix for completely
empty files.
Unfortunately this implementation does not work for noeol files - see
the failing test - because writefile() does not take account of
'nofixeol' (unlike :write). This is suboptimal but acceptable because
noeol files are not be encountered often.
See #567.
An empty, unchanged file was considered to be changed (a new line
added).
This patch fixes s:write_buffer to use binary mode with `writefile` to
not append a newline always, and does so manually for non-empty buffers,
according to &endofline, &binary and &fixendofline.
This is taken out of Neomake, and tested there in
https://github.com/neomake/neomake/blob/091d148b/tests/utils.vader#L713-L759.
Until this commit the err callback closed the channel to prevent the close
callback from being invoked, because the close callback invoked the out
handler (which we don't want when the job was unsuccessful).
This mostly worked but if closing the channel took too long, which it
seemed it could when dealing with large files, the close callback could
be called in the meantime.
This commit removes the unreliable code. The parent commit ensured that
the close callback only calls the out handler when the job succeeded, so
we no longer need to try to prevent the close callback from being
called.
The diffing part of the plugin diffs two files which are written afresh
each time. When the same buffer was processed twice in quick
succession, the second process to write a file could write it before the
first process had finished reading it. This manifested as the "from"
file being read as empty, causing diff to report that all the lines in
the file had been added.
This commit adds a counter to disambiguate successive temporary files.
This prevents git-ls-files from escaping "unusual" characters in
pathnames. When this happened, gitgutter would feed the escaped name
back to git-show but git-show would not recognise it.
This commit makes git-ls-files use the -z option to output pathnames
verbatim. These pathnames also become null terminated so we have to
ensure we remove the null terminator too.
Closes#562.
Previously gitgutter could only diff the buffer against the index. This
change enables diffing against the working tree, which will be useful
for stashing.
Use a default with `getbufvar` to not get an empty string.
Fixes:
> Error detected while processing function <SNR>163_on_stderr_nvim[1]..<lambda>10[1]..gitgutter#utility#setbufvar:
> line 1:
> E712: Argument of get() must be a List or Dictionary
I can trigger it using https://github.com/AndrewRadev/linediff.vim when
closing the windows / the tab.
Likely triggered with/through Neomake.
On FocusGained the current tab is force-updated. If there are any other
tabs, we want to make sure they are also force-updated when the user
next switches to them. To do this we set a flag which is read and
cleared on TabEnter.
See #525.