Commit Graph

26 Commits

Author SHA1 Message Date
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
Andy Stewart
1be63d780c Use warn function instead of plain echo. 2015-03-10 12:10:17 +01:00
Maximilian Antoni
275d598196 Echo message if no next/previous hunk is available
Gives some feedback when hunk navigation does nothing.
2015-03-10 11:25:10 +01:00
Andy Stewart
186dada663 Warn when cursor not in a hunk. 2015-03-05 12:19:02 +01:00
Andy Stewart
c6ed14c662 Finer granularity for staging/reverting hunks. 2015-03-05 11:09:18 +01:00
Andy Stewart
067160c86b Remove obsolete comment. 2014-10-17 09:24:47 +02:00
Andy Stewart
e5eb9e6ecf Fix staging of hunks coming after deleted lines.
Previously vim-gitgutter generated context-free patches and applied
those to the index.  However when staging a hunk situated after any
deleted lines, the line numbers on the patch were out by the number
of lines deleted, and without any context git would apply the patch
to the wrong part of the file in the index.

This commit ensure patches are generated with 1 line of context,
allowing git to adjust the line numbers appropriately and apply the
patch to the right location.

More lines of context would help git more to adjust line numbers; but
the more context we have the more we group together hunks we would
like to treat separately.
2014-10-16 11:50:20 +02:00
Andy Stewart
fed2dbad34 Move every function into gitgutter namespace.
This makes profiling much easier.
2014-06-26 11:09:29 +02:00