Commit Graph

74 Commits

Author SHA1 Message Date
Andy Stewart
0e509fb0ac Set diff base when viewing file versions with Fugitive
When you look at previous versions of a file, e.g. with Fugitive's
:0Gclog, gitgutter will set the diff base to the current version's
parent so that diff markers appear as expected.

Thannks to @rcreasi for the idea and initial implementation.
2020-03-12 10:38:58 +00:00
Andy Stewart
8e368ae8d1 Extract has_repo_path() function 2020-02-24 15:16:51 +00:00
Andy Stewart
a75fd77a78 Do not run diff unnecessarily 2020-02-24 14:33:22 +00:00
Richard Robbins
d36686e6a5 Add g:gitgutter_use_location_list option 2019-11-22 13:25:40 +02:00
Andy Stewart
76aa5920db Handle no prefix in GitGutterQuickFix
Fixes #649.
2019-09-19 12:26:38 +01:00
Andy Stewart
0469b8435a Deprecate <Plug>... maps in favour of <Plug>(...) 2019-09-04 08:56:36 +01:00
Andy Stewart
88d396f1b4 Add :GitGutterQuickFix command.
It loads all hunks into the quickfix list.

Closes #617.
2019-08-28 11:59:19 +01:00
Andy Stewart
8bafd08ef4 Support diffs relative to the working tree.
Closes #558.
2019-08-28 09:22:06 +01:00
Andy Stewart
afe94ede1b Do not use a dummy sign to keep the sign column open.
This removes the g:gitgutter_sign_column_always option.

Vim 7.4.2201 introduced the |signcolumn| option to configure when the
signcolumn is visible, building in behaviour which the plugin provided
manually.

Although it would be good to maintain this feature for older Vims, the
complexity added by the code outweighs the benefit of backward
compatibility.
2019-08-16 12:06:28 +01:00
Andy Stewart
71bbe88525 Distinguish normal and visual modes in map check.
Fixes #642.
2019-08-13 19:22:04 +01:00
Andy Stewart
bc1d28db46 Allow staging part of an additions-only hunk.
See #279.
2019-08-12 17:19:05 +01:00
Andy Stewart
c75c83df53 Ensure maps set on all buffers for vim -o/-O.
Fixes #634.
2019-07-26 10:27:58 +01:00
Andy Stewart
07b60b584e Update signs when file renamed via :saveas
Fixes #551.
2019-06-04 12:37:59 +01:00
Andy Stewart
a7650790ea Work around older Vims not accepting arguments for function().
Fixes #618.
2019-05-31 07:17:36 +01:00
Andy Stewart
6affbc96f1 Invert boolean conditions for clarity. 2019-05-29 14:37:16 +01:00
Andy Stewart
222b1a2fde Extract setting of path. 2019-05-29 14:37:16 +01:00
Andy Stewart
9488098c8c Separate setting maps from setting repo path. 2019-05-29 14:37:16 +01:00
Andy Stewart
064a3d6b10 Move #init_buffer() into #process_buffer(). 2019-05-29 14:36:53 +01:00
Andy Stewart
2dce8e032b Add commands to enable/disable/toggle GitGutter per buffer. 2019-01-08 12:47:10 +00:00
Andy Stewart
622193a625 Enable diffing against the working tree.
Previously gitgutter could only diff the buffer against the index.  This
change enables diffing against the working tree, which will be useful
for stashing.
2018-10-12 15:49:25 +01:00
Andy Stewart
6076c96786 Only set up maps once per buffer. 2018-07-06 10:15:00 +01:00
John Drouhard
b2be779ced Clear the tick on hidden buffers when gitgutter#all(1) is called.
This should allow hidden buffers to recalculate their diff when loaded
after a FocusGained event fires.
2018-07-05 15:25:58 +03:00
Andy Stewart
f167c3312b Make maps buffer-local. 2018-05-02 16:02:43 +01:00
Andy Stewart
37bdd03d17 Do not deactivate gitgutter when &diff is set.
In #303 there was a request to deactivate gitgutter when &diff is set,
although no reason was given initially.  Then it was reported that
gitgutter showed signs, in the wrong place, during Fugitive's Gdiff.

However I cannot reproduce signs showing in Gdiff's index buffer.  And
the signs in the working tree buffer are correct.

Furthermore the commit which deactivated gitgutter (85f6e136) had the
side-effect of breaking `:redir` and clearing Vim's startup message
(see #500).

Therefore since that change had no benefit, and a couple of drawbacks,
it makes sense to undo it.

Closes #500.
2018-03-16 18:49:22 +00:00
Andy Stewart
c3bad229db Use built-in uniq() when available. 2018-02-22 10:32:21 +00:00
Andy Stewart
87097d8923 Fix bugs in s:uniq().
I can't believe I got this wrong.

Fixes #485.
2018-02-22 10:17:28 +00:00
Andy Stewart
8f6bbc9855 Extract uniq function. 2018-02-21 12:06:42 +00:00
Daniel Hahler
d78184e646 Use processed-dict, uniq() might not be available 2018-02-21 11:54:15 +00:00
Daniel Hahler
6c2def1075 Use sort+uniq with tabpagebuflist to remove duplicates 2018-02-21 11:54:15 +00:00
Andy Stewart
457f35e444 Ensure a re-activated buffer runs a diff.
See #303.
2018-02-19 10:59:39 +00:00
Andy Stewart
85f6e136bd Turn off gitgutter for any buffer with a vimdiff window.
Closes #303.
2018-02-14 11:10:59 +00:00
Andy Stewart
933af37935 Replace v:t_string with backward-compatible equivalent.
v:t_string was introduced in Vim 7.4.2071.

Closes #464.
2018-02-13 09:37:45 +00:00
Andy Stewart
1452900ffd Check buffer is active before init. 2018-02-12 15:34:49 +00:00
Andy Stewart
5bfe5b9209 Big refactor.
- 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.
2018-02-12 14:25:11 +00:00
Andy Stewart
14dd430533 DRY buffer local namespace prefix. 2017-02-22 10:51:12 +00:00
Andy Stewart
1bbf892eba Use custom functions for plugin buffer-local variables. 2017-02-22 10:43:52 +00:00
Andy Stewart
9639f28037 Prevent undo-hunk scrolling window.
The previous implementation assumed that CTRL-Y and CTRL-E could scroll
by negative counts, i.e. in the opposite direction.  It turns out they
cannot: they treat negative counts as positive ones and always scroll in
the same direction.

This meant that undoing a hunk in the top half of the screen caused the
screen to scroll.

Closes #394.
2016-12-16 10:36:30 +00:00
Thomas Larrieu
1742a8f568 Replace "normal" command with "normal!"
We do not want to use user defined mappings
2016-10-27 21:35:39 +02:00
Andy Stewart
b1734a3916 Remove unnecessary space concatenation. 2016-10-18 10:14:21 +01:00
Andy Stewart
e113f07d0b Avoid autocmd side-effects when jumping to/from preview window.
Fixes #379.
2016-10-18 10:12:30 +01:00
Andy Stewart
55b556f7a2 Dedup buffer lists to avoid unnecessary work. 2016-10-10 12:52:05 +01:00
Andy Stewart
b5f23e9867 Use known shell for hunk staging, previewing, undoing.
Forgot to do this in 377c71d.

Closes #352.
2016-06-27 10:55:26 +01:00
Andy Stewart
f8da1fd6db Preserve screen line position when undoing a hunk.
Closes #346.
2016-05-23 10:31:17 +01:00
Andy Stewart
f5a5234f22 Allow configuration of git executable. 2016-05-16 13:47:14 +01:00
Andy Stewart
ba6e104848 Always use bash on unix.
Vim is single-threaded so we can make life easier by using a known shell
and restoring the original one afterwards.
2016-05-16 12:00:06 +01:00
Andy Stewart
cae4f72aa1 Abort functions at first error. 2016-05-13 14:14:41 +01:00
Andy Stewart
264d7f3a66 Only use "<nomodeline>" when available. 2016-05-13 09:48:43 +01:00
Andy Stewart
ea5d4cbeaf Don't process modelines after triggering autocommand.
Closes #334.
2016-05-10 15:54:01 +01:00
Joel D. Elkins
27f99c4a4d Fire autocommand after processing buffer. 2016-05-06 16:26:24 +01:00
Andy Stewart
e607a997ce Asynchronous diffs in Vim. 2016-04-29 09:50:57 +01:00