Commit Graph

68 Commits

Author SHA1 Message Date
Andy Stewart
62ff20f979 Return early when pre-condition not met 2020-07-28 10:16:47 +01:00
Andy Stewart
63941de9f9 Distinguish no hunks at all from no further hunks
Closes #709.
2020-07-28 10:12:48 +01:00
Andy Stewart
51a03d4ae0 Add option for <Esc> to close non-floating preview window
Closes #718.
2020-06-23 15:18:25 +01:00
Andy Stewart
97a24e903a Reset any existing preview window
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.
2020-06-18 09:38:43 +01:00
Andy Stewart
e31e9bb35f Avoid E315 when populating Neovim floating preview window
Fixes #711.
2020-06-10 09:13:35 +01:00
Andy Stewart
9784226ba7 Account for wrapping when resizing preview window
Fixes #708.
2020-05-29 10:46:42 +01:00
Andy Stewart
425c7cf2e2 Maintain backward compatibility in hunk preview code
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.
2020-04-23 09:28:38 +01:00
Andy Stewart
3599736179 Fire GitGutterStage User event after staging
Closes #698.
2020-04-23 08:59:26 +01:00
qlem
9cdb90b1e1 fix #688 2020-04-01 17:33:05 +01:00
qlem
262f1b5c9a keep noautocmd and fire WinEnter with a doautocmd 2020-04-01 13:07:03 +01:00
qlem
9c7f819538 fix the behavior of the status line of the hunk preview windows 2020-04-01 13:07:03 +01:00
Andy Stewart
c337eef1b7 Make hunk commands noops when file not tracked by git
Fixes #680.
2020-02-24 15:42:05 +00:00
Andy Stewart
320b7a33e7 Fix preview and undo hunk for dos line endings 2019-10-14 10:10:46 +01:00
Andy Stewart
b94fab3070 Use matchaddpos() instead of text properties
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.
2019-09-26 15:08:56 +01:00
Andy Stewart
677a80c4ed Only show intra line highlights in Vim popups when supported 2019-09-24 11:25:48 +01:00
Andy Stewart
dfa6972b67 Add intra-line change highlighting for Vim popups 2019-09-24 11:07:29 +01:00
Andy Stewart
f980fab55c Do not enable syntax in Vim floating popup
Fixes #653
Closes #654
2019-09-23 10:33:17 +01:00
Andy Stewart
fdecc23368 Hunk previews highlight intra-line changes.
Closes #577.
2019-09-18 11:55:01 +01:00
Andy Stewart
0469b8435a Deprecate <Plug>... maps in favour of <Plug>(...) 2019-09-04 08:56:36 +01:00
Andy Stewart
43c82ce8fb Whitespace. 2019-09-03 13:53:52 +01:00
Andy Stewart
0804623cb7 Reset hunk previewing window's modified state. 2019-09-03 13:52:55 +01:00
Andy Stewart
558e51bd5c Avoid duplicate autocommands in previewing window. 2019-09-02 10:40:25 +01:00
Andy Stewart
c375aea57a Enable any write in hunk previewing window to stage. 2019-08-29 15:45:27 +01:00
Andy Stewart
8bafd08ef4 Support diffs relative to the working tree.
Closes #558.
2019-08-28 09:22:06 +01:00
Andy Stewart
afb8e03222 Do not run ex commands unnecessarily via normal mode. 2019-08-27 19:49:49 +01:00
Andy Stewart
67c8cca890 Support Vim's popup windows for hunk previews.
Note this prevents staging partial hunks via the previw window.
2019-08-27 16:56:30 +01:00
Andy Stewart
f0f56b9569 Use floating windows for hunk previews on Neovim. 2019-08-27 16:02:51 +01:00
Andy Stewart
0c3e7219b4 Extract operations on hunk preview window. 2019-08-27 11:52:50 +01:00
Andy Stewart
77fb3fd81e Enable :w in preview window to stage the hunk. 2019-08-21 10:27:23 +01:00
Andy Stewart
53996f5cd1 Use simpler syntax for zero-width positive lookbehind. 2019-08-15 11:58:14 +01:00
Andy Stewart
b036fcf527 Stage part of any hunk.
See #279.
2019-08-13 15:57:22 +01:00
Andy Stewart
a5ee9f2f11 Rename variables for clarity. 2019-08-13 15:47:34 +01:00
Andy Stewart
c9fd335246 Add comments. 2019-08-13 15:45:51 +01:00
Andy Stewart
773a5697f1 Warn user when git rejects patch. 2019-08-13 15:45:29 +01:00
Andy Stewart
50a7a9f6cb Ensure no extra blank line in hunk preview window.
Closes #640.
2019-08-13 13:06:58 +01:00
Andy Stewart
bc1d28db46 Allow staging part of an additions-only hunk.
See #279.
2019-08-12 17:19:05 +01:00
homestar
8985017094 Add g:gitgutter_preview_win_location option 2019-08-08 16:31:44 +01:00
Andy Stewart
5989eb882e Do not overwrite registers when undoing hunks.
Fixes #629.
2019-06-14 16:56:28 +01:00
Andy Stewart
dc3c0dcd2a Ensure git calls always use configured args for git.
See #628.
2019-06-14 12:52:13 +01:00
Daniel Hahler
8a4b9ccf52 Fix calls to repeat#set: remove trailing "<CR>" 2019-03-08 13:51:05 +00:00
Andy Stewart
ac787afa02 Add GitGutterFold command.
Closes #286, #571.
2019-01-14 11:48:24 +00:00
Andy Stewart
0597380f6b Prompt user to choose hunk when overlapping.
See #556.
2018-10-18 15:39:55 +01:00
Andy Stewart
89c34f74cb Display unambiguous sign when hunks overlap.
See #556.
2018-10-18 09:45:55 +01: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
380e7935b7 Make test flag more specific. 2018-03-08 11:47:08 +00:00
Andy Stewart
5db4a3a2a5 Make robust the replacement of temp file paths with actual paths.
The previous implementation meant the temp file paths were treated as
regular expressions, which was vulnerable to problems with backslashes
etc.

See #494.
2018-03-02 12:44:49 +00:00
Andy Stewart
fa85bd41d9 Pass filepath into s:fix_file_references() to make function pure. 2018-03-02 11:41:48 +00:00
Daniel Hahler
c325a8b6d3 s:fix_file_references: handle diff.mnemonicPrefix
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..
2018-02-22 09:49:31 +00:00
Patryk Czachurski
314e64673b Fixed call to current_hunk in hunk text object 2018-02-19 10:14:34 +00:00
Andy Stewart
8a7d00590b Restore support for vim-repeat in hunk ops. 2018-02-12 16:42:20 +00:00