Commit Graph

435 Commits

Author SHA1 Message Date
Andy Stewart
d4a3462df6 Extract function to calculate screen lines and cols
See #846.
2022-10-22 17:51:34 +01:00
Andy Stewart
24353971b9 Make height of floating preview window wrap-aware
Fixes #846.
2022-10-22 17:40:27 +01:00
Andy Stewart
f19b620319 Fix patch strings to use conventional format
See #841.
2022-08-24 14:29:47 +01:00
Andy Stewart
ded11946c0 Fix comparison to be case sensitive
Closes #836.
2022-05-24 09:24:40 +01:00
Andy Stewart
719d4ec06a Set filetype in :GitGutterDiffOrig
Closes #833.
2022-05-04 13:32:24 +01:00
Andy Stewart
988a6dbad9 Use a reliable regexp operator for lower case
It turns out =~ depends on 'ignorecase'.  Big sigh.
2022-04-25 20:41:43 +01:00
Andy Stewart
57000a73ab Use reliable regexp character class for lower case
It turns out [:lower:] does not always mean lower case (it depends
on 'ignorecase').  Sigh.
2022-04-25 20:26:21 +01:00
Andy Stewart
774add0c59 Improve testing of private functions 2022-04-25 13:47:08 +01:00
Andy Stewart
5dd8ab6211 Fix parsing of 'git ls-files -v' for filenames with spaces
Fixes #829.
2022-04-25 13:33:45 +01:00
Andy Stewart
2f359076bc Whitespace 2022-04-23 08:30:47 +01:00
Andy Stewart
626541edeb Heeds git's "assume unchanged" bit
I.e. does not diff files which should be assumed unchanged.

See:

    git update-index --[no-]assume-unchanged -- <file>
    git ls-files -v

Closes #826.
2022-04-23 08:25:46 +01:00
Andy Stewart
d5bae10403 Add GitGutterDiffOrig command
Closes #827.
2022-04-15 14:13:51 +01:00
Alexander Courtis
e433d5ddc1 #816 do not modify previewpopup when it does not exist 2022-02-19 13:37:19 +00:00
Andy Stewart
d845704e9e Extract common code into function 2022-02-02 11:07:24 +00:00
Andy Stewart
23a65f370b Fix enabling buffer when plugin disabled
Fixes #803.
2022-02-02 10:58:53 +00:00
Andy Stewart
54b94f98de Prevent 'previewpopup' from breaking hunk previews
See #809.
2022-02-02 10:01:06 +00:00
Andy Stewart
384bf003f6 Allow configuration of floating window appearance
Closes #807.
2022-02-02 09:23:45 +00:00
Andy Stewart
e9871cf952 Capitalise NONE for consistency
Although group names are case-insensitive:

- Vim's docs use NONE;
- the code already uses NONE elsewhere.
2022-02-02 08:49:44 +00:00
Mateusz Piotrowski
6039b37440 Always pass some group name to sign arguments
E.g., passing an empty group name to the sign argument linehl (e.g.,
"linehl=") causes the following error:

```
Error detected while processing /usr/home/0mp/.vim/plugged/vim-gitgutter/plugin/gitgutter.vim[96]..function gitgutter#highlight#define_signs[10]..<SNR>56_define_sign_line_highlights:
line    9:
E1249: Group name missing for linehl
```

This patch makes the those errors go away by passing "None" when no
group name is needed.
2022-02-02 08:49:12 +00:00
Georgi Kirilov
832f7c6226 fix quickfix for combined diffs
The --cc option is issued for merge conflicts.
2021-08-30 12:59:41 +03:00
naohiro ono
4adaa7adaa Make intra-highlights customizable 2021-08-06 16:13:14 +01:00
caojoshua
aad6acea5d When using loclist, only add hunks for current file. 2021-07-12 11:03:37 +01:00
Andy Stewart
68a8cb300c Close preview on escape: only map <Esc> while preview open
This only applies to floating preview windows on Neovim.

Handles the following way of closing the floating preview:

- <Esc>
- Moving cursor
- 2<C-W>c (where 2 is the floating window's window number)
- <C-W><C-W> to move into and out of the floating window

Closes #786.
2021-06-03 12:23:58 +01:00
Andy Stewart
2571c8f520 Enable is_preview_window_open() to handle floating windows
See #784.
2021-06-02 11:52:37 +01:00
Andy Stewart
5b4ec87517 Expose is-open and close hunk-preview-window functions
This allows custom maps for closing the hunk preview window.

See #784.
2021-06-02 11:49:42 +01:00
Andy Stewart
d13d58a35f Clear unwanted characters in nmap
See #784.
2021-06-02 11:44:18 +01:00
Andy Stewart
f4bdaa4e9c Remove useless comparison 2021-04-22 19:41:59 +01:00
Andy Stewart
66bafa5348 Update open preview on hunk jump
See #396, #779.
2021-04-22 15:42:45 +01:00
Andy Stewart
e288dd4733 Suppress echoing of preview window file name
The file name does not mean anything so it is unhelpful to show it.
Not showing it avoids the hit-enter prompt which can occur.
2021-04-22 15:37:28 +01:00
Vincent Cordobes
42ed714fb9 Capitalize warning messages 2021-04-22 12:03:06 +01:00
Vincent Cordobes
602a5ba19e Clean up warning messages 2021-04-22 12:03:06 +01:00
Andy Stewart
9756e95bd5 Fix resizing of existing non-floating hunk preview window
This bug was introduced by 9784226 in #708.  It had the effect of not
allowing an existing hunk preview window to increase in size for a
larger hunk (up to 'previewheight').

See #775.
2021-04-13 15:18:27 +01:00
Andy Stewart
24cc477895 Avoid cursor in unexpected window after Esc in preview
Thanks @andymass for the patch.

See #769.
2021-03-19 16:31:26 +00:00
Andy Stewart
64062dfe02 Simplify opening of preview window 2021-03-16 12:06:31 +00:00
Andy Stewart
f3145958dd Make statusline blank in hunk preview window
I would prefer to remove the statusline altogether in the hunk preview
window, making it consistent with the floating preview window.  However
I do not think that is possible; the best one can do is make it blank.
2021-03-15 17:00:33 +00:00
Andy Stewart
1283ec1670 Make error message useful 2021-02-22 14:15:46 +00:00
Andy Stewart
6019d43860 Ensure hunk summary is updated during a hunk op
Fixes #765.
2021-02-16 16:04:47 +00:00
acelya
2e3cd54ed6 Fix pwsh/powershell test when used with a parameters
Like `set shell=pwsh\ -NoLogo`.
2021-02-11 09:13:02 +00:00
Andy Stewart
f440ed04dd Enable <Esc> to close floating preview window
See #718.
2021-02-08 12:48:01 +00:00
obcat
0cbe0f392d Prevent hunk preview using preview window from changing alternate file 2021-02-06 11:37:12 +09:00
acelya
512e2999ed Force cmd.exe to be used by system() instead of pwsh or powershell on Windows 2020-12-11 16:13:05 +00:00
Andy Stewart
dfe55e2b92 Recreate temp directory if it gets deleted
Vim does not check the existence of its temp directory when generating
file names with tempname().  Therefore if, for some reason, the temp
directory gets deleted, Vim will continue to generate paths for file
names inside the directory.  Writes to these file paths will fail
(E482).

See #746, #433, #190, #147.
2020-11-25 12:42:00 +00:00
Andy Stewart
81963946ed Reuse tempfile base names
This reverts "Use fresh temp files for every diff" [1].  At the time I
did not realise that Vim never checks the existence of its temp
directory after creating it at startup; I thought that each call to
tempname() generated a fresh file on disk.  In fact tempname() simply
generates a string path.

Therefore there is no point calling tempname() for every diff.  Doing so
only serves to generate more files in the temp directory than necessary.

[1] dab840b153
2020-11-25 12:33:55 +00:00
obcat
987a33355e Show message like "Hunk 4 of 11" after hunk jumping 2020-11-05 16:43:52 +00:00
Andy Stewart
4477570033 Keep references to pending jobs to avoid premature deletion
This only applies to Vim.

See #735.
2020-10-30 11:52:56 +00:00
Andy Stewart
e480eb2b63 Use g:gitgutter_grep instead of grep in debug command
Closes #741.
2020-10-27 16:40:39 +00:00
Andy Stewart
94ee004087 Do not output shell related options in #debug() 2020-09-07 13:21:02 +01:00
Andy Stewart
82f3ea6a40 Fix typo in highlight group name
See #727.
2020-08-05 12:19:08 +01:00
Andy Stewart
642cef87f4 Treat cleared highlight groups as not set
Setting a colorscheme often clears all existing highlight groups.  When
the plugin subsequently sets up its colours, it sees that the GitGutter*
groups exist and leaves them alone - even though they have been cleared.

This change means cleared groups do get their colours set up again.

See #727.
2020-08-05 12:15:27 +01:00
Andy Stewart
62ff20f979 Return early when pre-condition not met 2020-07-28 10:16:47 +01:00