Commit Graph

246 Commits

Author SHA1 Message Date
Andy Stewart
44bb472bac Add changed indicator for closed folds
Closes #655.
2019-09-27 16:50:14 +01:00
Andy Stewart
6b08e1425b Include accumulated prefix offsets when recursing 2019-09-26 16:57:27 +01:00
Andy Stewart
09bc754efc Fix splitting on a string not a pattern 2019-09-26 16:56:19 +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
ba049e707a Add note 2019-09-24 18:38:54 +01:00
Andy Stewart
45347c9a4b Add comment 2019-09-24 18:38:36 +01:00
Andy Stewart
f2ea4f7034 Fix missing empty string when LCS at one end 2019-09-24 18:38:12 +01:00
Andy Stewart
3405ad72b6 Handle edge case in common prefix calculation 2019-09-24 18:33:12 +01:00
Andy Stewart
ccd4972d23 Fix off-by-one error in LCS calculation 2019-09-24 17:10:26 +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
9231bda97f Enable intra-line highlights to handle multiple regions
For example consider:

    -The cat in the hat.
    +The ox in the box.

Before this change the highlights would be:

    -The cat in the hat.
         ^^^^^^^^^^^^^^
    +The ox in the box.
         ^^^^^^^^^^^^^

After this change the highlights are:

    -The cat in the hat.
         ^^^        ^^^
    +The ox in the box.
         ^^        ^^^

Another example; before:

    -The quick brown fox jumped
    +The (quick) brown (fox) jumped
         ^^^^^^^^^^^^^^^^^^^

And after:

    -The quick brown fox jumped
    +The (quick) brown (fox) jumped
         ^     ^       ^   ^
2019-09-24 10:26:31 +01:00
Andy Stewart
68e735b92c Improve intra-line change highlighting
Handle two insertions and two deletions.
2019-09-23 15:59:37 +01:00
Andy Stewart
ae9edf0602 Fix non-empty suffix condition 2019-09-23 13:19:49 +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
12bb0e9634 Do not write EOL after last line when no EOL present
See #650.
2019-09-19 12:20:42 +01:00
Andy Stewart
92deed378d Add cterm value for intra-line highlights 2019-09-18 15:54:21 +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
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
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
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
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