107 Commits

Author SHA1 Message Date
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
Andy Stewart
2d32a2965a Improve hunk previewing.
- 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.
2018-02-12 16:32:43 +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
Sudo Nice
1e60667322 Open folds on hunk jumping 2017-11-01 11:58:34 +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
8576f00548 Make hunks buffer-local. 2017-02-21 16:40:18 +00:00
Andy Stewart
f15a67ff51 Get buffer variable's default value in a backward-compatible way.
getbufvar() gained a default value in v7.3.831.  The change here handles
default values in older Vims (pre 7.2 at least).
2016-05-18 08:47:52 +01:00
Andy Stewart
9db8f638db Make hunk summary window-aware.
Closes #331.
2016-05-16 12:21:06 +01:00
Andy Stewart
ef6fd3a986 Store a buffer's hunk summary in a buffer local variable. 2016-05-16 12:07:20 +01:00
Andy Stewart
cae4f72aa1 Abort functions at first error. 2016-05-13 14:14:41 +01:00
Andy Stewart
e48824cd1d Provide a hunk text object. 2016-04-21 14:08:14 +01:00