When previewing a hunk we re-use any existing preview window. However
we need to reset it for our purposes in case it was used in an
incompatible way before.
See #713.
win_getid() was introduced in Vim 7.4.1557. The code uses it to
remember the id of the preview window. In newer Vims or Neovim this
could be a floating window but pre-7.4.1557 it can only be an ordinary
preview window. And in that case we only need the preview window's
buffer number.
This commit uses the buffer number when win_getid() isn't available.
Fixes#683.
matchaddpos() has better backward compatibility than text properties. I
only used text properties inside Vim popups because I did not think
there was a way to use matchaddpos(), but then I found a way.
Previously gitgutter could only diff the buffer against the index. This
change enables diffing against the working tree, which will be useful
for stashing.
The previous implementation meant the temp file paths were treated as
regular expressions, which was vulnerable to problems with backslashes
etc.
See #494.
An alternative would be to run `git` with no user config always, i.e.
setting `GIT_CONFIG_NOSYSTEM` and `HOME=/dev/null` (different for
Windows then) in its environment. Maybe there's an easier way / single
option for this..
- Treat &previewheight as a maximum height.
- Make preview window shrink to fit the hunk.
- Resize preview window each time.
- Make preview window readonly and nomodifiable.
Based on code by @somini. Thanks!
See #451.
- Hunk stage/undo/preview no longer saves the buffer.
- Hunk undo no longer makes locations go out of sync.
- Grep can be opted out of (grep output with ansi escapes is number one cause
of issues).
- Replaced g:gitgutter_grep_command with g:gitgutter_grep.
- Always runs git-diff the same way instead of in two possible ways.
- Separated detection of git tracking from diffing.
- Simplified path handling.
- Removed support for xolox shell: Windows taskbar does not flash with async
jobs.
- Removed g:gitgutter_{eager,realtime}.
- Simplified implementation generally.