Commit Graph

168 Commits

Author SHA1 Message Date
Daniel Hahler
2fe748b48f plugin/gitgutter.vim: use command! to allow for reloading 2018-03-01 10:06:56 +00:00
Andy Stewart
33c4c4a685 Enable update on FocusGained for gVim.
This was prevented to avoid an infinite loop on gVim (see #42).
However that was 5 years ago and this no longer seems to be a problem
(even running synchronously).
2018-02-28 16:56:26 +00:00
Andy Stewart
c39a5c240a Add g:gitgutter_terminal_reports_focus to enable FocusGained workaround.
See #490.
2018-02-28 15:09:36 +00:00
Andy Stewart
2a3ab77f10 Access tab variable directly instead of via {g,s}ettabbar().
Fewer function calls and better backward compatibility.
2018-02-27 11:37:38 +00:00
Andy Stewart
816fc98ff2 Swap order of if/else so it reads better. 2018-02-22 11:09:05 +00:00
Andy Stewart
61a5e0143e Do not warn user when default grep cannot be found.
This restores the behaviour that was accidentally changed in 5bfe5b9.
2018-02-22 11:06:34 +00:00
Andy Stewart
9325986457 Remove deprecated command GitGutterRevertHunk. 2018-02-21 12:23:02 +00:00
Andy Stewart
38a7789be9 Finish when pre-requisites not fulfilled. 2018-02-19 14:04:49 +00:00
Andy Stewart
13361da09e Only use overbar sign when UI supports it.
Thanks @h3xx.

Closes #471.
2018-02-16 13:06:23 +00:00
Andy Stewart
a8af1853bd Remove long-standing deprecation warning. 2018-02-12 16:21:10 +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
dc73a81bfe Deprecate g:gitgutter_sign_column_always for &signcolumn. 2017-08-02 15:47:04 +01:00
Andy Stewart
c92f61acdc Ensure that all buffers are processed at startup.
When opening vim with multiple files, e.g. via `vim -o file1 file2`, Vim
fires a `BufEnter` event for each file.  However the effective buffer
number (`<abuf>`) is always 1, instead of being each buffer's number in
turn, so we end up processing the first buffer n times instead of each
of n buffers once.

This commit is a brute force workaround to ensure all buffers are
processed if there is more than one.

Closes #428.
2017-07-26 09:36:29 +01:00
Tyler Brazier
b803a28f47 External commands (:!) update the gutter
Fixes #418
2017-04-28 20:13:09 -05:00
Andy Stewart
fd4fa5bed7 When switching tabs wait for BufEnter before running.
This ensures we process the correct buffers.

See #413.
2017-04-25 14:33:10 +01:00
Andy Stewart
297678a08d Ensure BufWritePost,FileChangedShellPost always process buffer.
Before this change the TabEnter/BufEnter logic was intertwined with
the logic for BufWritePost,FileChangedShellPost.

Separating the concerns fixes a minor bug where a TabEnter-BufEnter
combination led to the plugin not updating the diff the first time the
buffer was written.
2016-10-11 10:02:21 +01:00
Andy Stewart
68f6fa3453 Whitespace. 2016-10-10 12:42:07 +01:00
Andy Stewart
4f9c5b0f3e Use 'sh' as shell instead of configurable '/bin/sh'.
sh isn't always at /bin/sh, e.g. on Android or Termux, but it is always
on the path.

See #360.
2016-09-30 10:28:29 +01:00
Andy Stewart
402257f920 Enable configuration of path to sh (default /bin/sh).
See #360.
2016-09-16 14:22:13 +01:00
Andy Stewart
867e013a62 Improve guard for missing-git warning again. 2016-05-16 16:29:40 +01:00
Andy Stewart
55d8247848 Fix guard for missing-git warning. 2016-05-16 13:50:27 +01:00
Andy Stewart
f5a5234f22 Allow configuration of git executable. 2016-05-16 13:47:14 +01:00
Andy Stewart
9db8f638db Make hunk summary window-aware.
Closes #331.
2016-05-16 12:21:06 +01:00
Andy Stewart
cae4f72aa1 Abort functions at first error. 2016-05-13 14:14:41 +01:00
Andy Stewart
4bed1da648 Add simple logging. 2016-04-25 13:19:50 +01:00
Andy Stewart
e48824cd1d Provide a hunk text object. 2016-04-21 14:08:14 +01:00
Andy Stewart
b3db866aab Use "undo" instead of "revert" for discarding a hunk.
"Undo" is a better name than "revert" because:

- "revert" sounds like it has something to do with `git-revert` but they
  are entirely different;
- "undo" is consistent with vim's "undo": discarding changes and going
  back to the original.

Maintain backwards compatibility and add deprecation warnings.

Closes #306.
2016-04-21 11:40:27 +01:00
Andy Stewart
530bf68fca Add option to disable asynchronous diffs.
Closes #318.
2016-04-21 10:29:11 +01:00
Andy Stewart
75eee3e407 Enable diffing against any commit.
Closes #309.
2016-04-20 11:19:34 +01:00
Dan Church
3131bdcbb8 Remove feature gitgutter_escape_grep
Reverts feature introduced in 5c23cadf57

In order to use an escaped grep, please replace
`g:gitgutter_escape_grep=1` with:

    let g:gitgutter_grep_command = '\grep --color=never -e'
2016-01-28 15:01:37 +00:00
Ilya Radchenko
bcb601acd2 Allow GitGutter* commands to be followed by other commands
See the related discussion here: https://github.com/scrooloose/syntastic/issues/1593
2015-11-07 10:05:43 -05:00
Andy Stewart
339f8ba079 Provide fallback sign for when a Vim cannot handle overbar. 2015-05-08 11:08:19 +02:00
Andy Stewart
07d7c9d478 Override SignColumn highlight group by default.
Most colorschemes (e.g. solarized) don't give any thought to the
SignColumn highlight group so generally the sign column is ugly.

With this change vim-gitgutter defaults to making the sign column look
like the line number column.

Solarized users no longer need `highlight clear SignColumn` in their
vimrc :)

To stop vim-gitgutter from overriding the SignColumn highlight, add this
to your vimrc:

    let g:gitgutter_override_sign_column_highlight = 0
2015-03-31 16:23:55 +02:00
Andy Stewart
dfe985a1a6 Use buffer numbers instead of buffer names.
Also don't pass buffer number to functions when they can look it up
themselves.

Using buffer numbers also eliminates any ambiguity which might arise
from symbolic links, where you have potentially two names for a file.

Thanks to @Z1MM32M4N for work on this (see #209).
2014-11-14 12:55:40 +01:00
Andy Stewart
39f0119096 Whitespace. 2014-10-17 09:24:52 +02:00
Andy Stewart
83ace2014a Suppress signs when there are more than 500. 2014-07-21 16:36:16 +02:00
Andy Stewart
fed2dbad34 Move every function into gitgutter namespace.
This makes profiling much easier.
2014-06-26 11:09:29 +02:00
Andy Stewart
a2aa2b1100 Avoid Windows command prompt popups when possible.
Before this commit some Windows users saw the command prompt pop
up briefly, and/or the taskbar flicker, every time the plugin ran.

Now the plugin will use xolox's vim-shell and vim-misc, if they are
available and we are on Windows, to execute external commands.  Xolox's
clever plugins avoid the command prompt popup and taskbar flicker.

Windows users with those plugins installed can opt out by setting a
variable in their vimrc.

Many thanks to @suxpert for the initial code.
2014-06-19 10:45:40 +02:00
Andy Stewart
64ad9e46a5 Specify UTF-8 to avoid problems with overscore character. 2014-06-11 18:49:12 +02:00
Andy Stewart
c6e5cf49f2 Show sign on first line when line(s) deleted at start of file.
This time with silly mistake fixed.
2014-06-02 09:20:51 +02:00
Andy Stewart
d1e66b71f9 Revert "Show sign on first line when line(s) deleted at start of file."
Signs aren't shown for deleted lines which aren't at the start of the
file.

This reverts commit 0fd18d66f6.
2014-05-31 16:57:15 +02:00
Andy Stewart
0fd18d66f6 Show sign on first line when line(s) deleted at start of file. 2014-05-30 17:03:54 +02:00
Andy Stewart
0ca3f7e3cd Add hunk previewing. 2014-03-18 13:50:22 +01:00
Andy Stewart
9c66906d56 Move logic out of main plugin file. 2014-03-17 11:27:31 +01:00
Andy Stewart
eee8ba4cff Refactor hunk functionality. 2014-03-17 10:48:05 +01:00
Andy Stewart
fd98657d2f Handle vim versions lacking gettabvar(). 2014-03-14 09:35:54 +01:00
Andy Stewart
973c19e1d5 Don't pester user if their Vim is too old for realtime updates. 2014-02-20 11:56:50 +01:00
Andy Stewart
f291db08c7 Disable realtime updates when Vim older than 7.3.105. 2014-02-14 12:59:39 +00:00
Andy Stewart
37491628f4 Add debug command. 2014-02-03 14:13:05 +01:00
Andy Stewart
072846e945 Don't place/unplace dummy sign unnecessarily. 2014-01-27 14:15:19 +01:00