Both `:file` and `:saveas` rename the current file.
`:file` does not write the newly named file to disk, and keeps the same
buffer. It fires a single `BufFilePre` / `BufFilePost` pair of
autocommands:
`BufFilePre` buffer
`BufFilePost` buffer
`:saveas` does write the newly named file to disk, in a new buffer. It
fires two pairs of `BufFilePre` / `BufFilePost` autocommands:
`BufFilePre` original buffer
`BufFilePre` new buffer
`BufFilePost` original buffer
`BufFilePost` new buffer
In both cases the cached path needs to be cleared.
See #860, #551.
Fixes#865.
If g:gitgutter_diff_base has been set and the file being processed does
not exist in that branch/commit, ensure that every line is marked as
added - this is how git-diff behaves.
Fixes#855.
For example consider:
-The cat in the hat.
+The ox in the box.
Before this change the highlights would be:
-The cat in the hat.
^^^^^^^^^^^^^^
+The ox in the box.
^^^^^^^^^^^^^
After this change the highlights are:
-The cat in the hat.
^^^ ^^^
+The ox in the box.
^^ ^^^
Another example; before:
-The quick brown fox jumped
+The (quick) brown (fox) jumped
^^^^^^^^^^^^^^^^^^^
And after:
-The quick brown fox jumped
+The (quick) brown (fox) jumped
^ ^ ^ ^
On Vims that support it, signs are placed in the "gitgutter" group with
a priority set by g:gitgutter_sign_priority.
Closes#544.
Closes#576.
Closes#627.
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.
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.
The previous implementation meant the temp file paths were treated as
regular expressions, which was vulnerable to problems with backslashes
etc.
See #494.