94 Commits

Author SHA1 Message Date
Andy Stewart
bed580ab8b Use git -C instead of cd 2024-07-13 06:20:56 +01:00
Andy Stewart
fe0e8a2630 Add comments 2023-11-11 10:56:40 +00:00
Andy Stewart
de86ff5c03 Fix GitGutterDiffOrig to handle file moves
See #872.
2023-11-10 12:12:24 +00:00
Andy Stewart
4e262693a5 Handle file moves for quickfix
Do not assume the new name (`fnamer`) is the same length as the old
name (`fnamel`).

Also use the new name rather than the old name when populating the
quickfix list.

See #872.
2023-11-10 12:03:07 +00:00
Andy Stewart
feffce19fc Handle file renames
See #872.
2023-11-09 12:16:26 +00:00
Nikita Kouevda
f7b97666ae Remove "file unknown in base" check
Instead of checking whether this file exists in `diff_base` and
returning early, we let `git show` fail, which still creates an empty
`from_file` for the subsequent `git diff` to use.

This mostly reverts 2ee95686c5, but we
keep the test case.
2023-09-01 13:10:30 -07:00
Andy Stewart
278b393e68 Avoid unnecessary concatenation
This is simply to avoid double spaces in the generated commands.  Double
spaces make no practical difference but look slightly inelegant.
2023-06-05 09:52:56 +01:00
Andy Stewart
6ebc0fd233 Extract function to reduce duplication 2023-06-05 09:50:17 +01:00
Andy Stewart
2ee95686c5 Handle file which does not exist in diff base
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.
2023-04-27 16:16:54 +01:00
Andy Stewart
719d4ec06a Set filetype in :GitGutterDiffOrig
Closes #833.
2022-05-04 13:32:24 +01:00
Andy Stewart
626541edeb Heeds git's "assume unchanged" bit
I.e. does not diff files which should be assumed unchanged.

See:

    git update-index --[no-]assume-unchanged -- <file>
    git ls-files -v

Closes #826.
2022-04-23 08:25:46 +01:00
Andy Stewart
d5bae10403 Add GitGutterDiffOrig command
Closes #827.
2022-04-15 14:13:51 +01:00
Andy Stewart
d845704e9e Extract common code into function 2022-02-02 11:07:24 +00:00
Andy Stewart
23a65f370b Fix enabling buffer when plugin disabled
Fixes #803.
2022-02-02 10:58:53 +00:00
Georgi Kirilov
832f7c6226 fix quickfix for combined diffs
The --cc option is issued for merge conflicts.
2021-08-30 12:59:41 +03:00
caojoshua
aad6acea5d When using loclist, only add hunks for current file. 2021-07-12 11:03:37 +01:00
Andy Stewart
c27bfab8c5 Make quickfix paths relative to current working directory
Closes #715.
2020-06-25 16:30:10 +01:00
Andy Stewart
faf2581f00 Remove duplicate args in GitGutterQuickFix 2020-06-22 10:25:46 +01:00
Andy Stewart
2b62481d38 Only diff against parent commit in Fugitive revision buffers
Fixes #695.
2020-04-18 17:13:15 +01:00
Balki
7c48aa1e72 Use config option gitgutter_diff_base in quickfix window 2020-03-27 13:40:24 +00:00
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