Commit Graph

320 Commits

Author SHA1 Message Date
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
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
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
cbaa22e38c Use sign functions, groups, and priority, where available.
On Vims that support it, signs are placed in the "gitgutter" group with
a priority set by g:gitgutter_sign_priority.

Closes #544.
Closes #576.
Closes #627.
2019-08-16 16:21: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
f6f425e4cf Do not use a dummy sign to prevent sign column flicker.
In fe2b4ec869 (from 2013) the plugin
started using a dummy sign to prevent the sign column briefly
disappearing then reappearing when updating signs.

Since then Vim has vastly improved its handling of signs and the sign
column no longer flickers like this.
2019-08-16 11:55:01 +01:00
Andy Stewart
53996f5cd1 Use simpler syntax for zero-width positive lookbehind. 2019-08-15 11:58:14 +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
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
609b2170bf Merge branch 'master' of ssh://github.com/airblade/vim-gitgutter
* 'master' of ssh://github.com/airblade/vim-gitgutter:
  Fix #639: Use more careful way to enable `numhl`
2019-08-12 17:20:02 +01:00
Andy Stewart
bc1d28db46 Allow staging part of an additions-only hunk.
See #279.
2019-08-12 17:19:05 +01:00
delphinus
f2bf8376ae Fix #639: Use more careful way to enable numhl
The development versions of v0.3.2 also report `has('nvim-0.3.2')` to be
true even if they do not support the `numhl` feature. So here it catches
and ignores the possible errors.
2019-08-12 12:08:47 +01:00
Dan Aloni
9bf988bd1d Add g:gitgutter_sign_allow_clobber to control clobbering.
I.e. how gitgutter handles non-gitgutter signs.

See #565, #627.

Co-authored-by: Andy Stewart <boss@airbladesoftware.com>
2019-08-10 07:29:15 +01:00
delphinus
67b3ed65e3 Enable to toggle numhl 2019-08-08 16:40:35 +01:00
delphinus
78876150ae Add logic for sign with numhl 2019-08-08 16:40:35 +01:00
homestar
8985017094 Add g:gitgutter_preview_win_location option 2019-08-08 16:31:44 +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
91471746fe Avoid asynchronous job while vim is starting.
An asynchronous job at startup evidently triggers a Vim (not NeoVim)
rendering bug in some terminals and/or with certain colorschemes.

Terminals reported to be affected: libvte-based ones such as
gnome-terminal, xfce4-terminal, lxterminal, kitty.

Terminals reported to be unaffected: xterm, urxvt.

Closes #619.
2019-07-01 11:24:45 +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
Andy Stewart
07b60b584e Update signs when file renamed via :saveas
Fixes #551.
2019-06-04 12:37:59 +01:00
Jonny Bylsma
25f3c56335 Make conditional style consistent with codebase 2019-06-04 11:42:20 +01:00
Jonny Bylsma
8696c880df In get_hl(), discard returned synIDattr values of -1 2019-06-04 11:42:20 +01:00
Daniel Hahler
a4e8d3f188 gitgutter#utility#getbufvar: handle not existing buffer 2019-06-03 11:58:08 +01:00
Daniel Hahler
d7777b325a gitgutter#utility#getbufvar: handle not existing buffer
`getbufvar(a:buffer, '')` returns '' then, resulting in an error.
2019-06-03 11:55:54 +01:00
Daniel Hahler
9f21e3dbba Simplify getting highlight fg/bg 2019-06-03 11:32:09 +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
Daniel Hahler
50932df59a Simplify async callbacks for setting repo path. 2019-05-29 13:06:05 +01:00
Daniel Hahler
8a4b9ccf52 Fix calls to repeat#set: remove trailing "<CR>" 2019-03-08 13:51:05 +00:00
Daniel Hahler
7201afe8d1 s:on_stderr_nvim: do not call err handler for [''] 2019-03-08 13:47:54 +00:00
Andy Stewart
fd834e48ee Combine Diff* foreground colours with SignColumn's background.
For default sign colours.

It seems the Diff* highlight groups are generally designed for line
highlighting so they have background colours which differ from the main
background colour.  While desirable for line highlights, this isn't what
we want for the signs.
2019-02-04 14:45:58 +00:00
Andy Stewart
afa4f2ddf0 Use the Diff* highlight groups by default.
This change makes the plugin default to using the highlight groups
defined by the colorscheme instead of hardcoding its own foreground
colours.

If you liked the previous colours you can restore them by adding these
lines to your vimrc:

highlight GitGutterAdd    guifg=#009900 guibg=<X> ctermfg=2 ctermb=<Y>
highlight GitGutterChange guifg=#bbbb00 guibg=<X> ctermfg=3 ctermb=<Y>
highlight GitGutterDelete guifg=#ff2222 guibg=<X> ctermfg=1 ctermb=<Y>

– where you should replace <X> and <Y> are the background colour of your
SignColumn in the gui and the terminal respectively.

For example, with the solarized colorscheme and a dark background,
guibg=#073642 and ctermbg=0.

Closes #545, #560.
2019-01-25 17:27:08 +00:00
Andy Stewart
bea21f4162 Extract variable for clarity. 2019-01-15 13:36:05 +00:00
Andy Stewart
8f6c4cb88c Minor refactor. 2019-01-15 11:40:04 +00:00