Commit Graph

64 Commits

Author SHA1 Message Date
Andy Stewart
222b1a2fde Extract setting of 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
Andy Stewart
2dce8e032b Add commands to enable/disable/toggle GitGutter per buffer. 2019-01-08 12:47:10 +00:00
Andy Stewart
c2651aefbd Do not pass a default value to getbufvar().
That was introduced in Vim 7.3.831 but there are a few Vims older than
that still around.

See:
af1e674155 (commitcomment-31431773)
2018-11-26 16:46:51 +00:00
Andy Stewart
947737c76f Handle non-ASCII paths.
This prevents git-ls-files from escaping "unusual" characters in
pathnames.  When this happened, gitgutter would feed the escaped name
back to git-show but git-show would not recognise it.

This commit makes git-ls-files use the -z option to output pathnames
verbatim.  These pathnames also become null terminated so we have to
ensure we remove the null terminator too.

Closes #562.
2018-11-17 11:24:36 +00:00
Daniel Hahler
af1e674155 Fix gitgutter#utility#setbufvar for nonexistent buffers
Use a default with `getbufvar` to not get an empty string.

Fixes:

> Error detected while processing function <SNR>163_on_stderr_nvim[1]..<lambda>10[1]..gitgutter#utility#setbufvar:
> line    1:
> E712: Argument of get() must be a List or Dictionary

I can trigger it using https://github.com/AndrewRadev/linediff.vim when
closing the windows / the tab.
Likely triggered with/through Neomake.
2018-10-11 11:30:26 +01:00
John Kurkowski
f363799550 Support files with a leading -
Git treats anything past the `--` as filenames.
2018-05-05 23:05:31 -07:00
Daniel Hahler
22c3fc0bf5 gitgutter#utility#setbufvar: ensure bufnr is a number with setbufvar
Otherwise you might get "E93: More than one match for X" if there is a
buffer with "X" in its name besides buffer number X.
2018-05-02 08:06:48 -07:00
Andy Stewart
5481318fc1 Prevent infinite loop when running non-async on Windows.
Closes #505.
2018-04-11 09:56:43 +01:00
Andy Stewart
37bdd03d17 Do not deactivate gitgutter when &diff is set.
In #303 there was a request to deactivate gitgutter when &diff is set,
although no reason was given initially.  Then it was reported that
gitgutter showed signs, in the wrong place, during Fugitive's Gdiff.

However I cannot reproduce signs showing in Gdiff's index buffer.  And
the signs in the working tree buffer are correct.

Furthermore the commit which deactivated gitgutter (85f6e136) had the
side-effect of breaking `:redir` and clearing Vim's startup message
(see #500).

Therefore since that change had no benefit, and a couple of drawbacks,
it makes sense to undo it.

Closes #500.
2018-03-16 18:49:22 +00:00
Andy Stewart
2f736d58b4 Backward compatibility for nvim-0.1.7.
NeoVim 0.1.7 does not support the `function()` function accepting an
optional argument list.

Fixes #496.
2018-03-14 11:43:36 +00:00
Chayoung You
538e07882a Handle files in different drive on Windows 2018-03-06 03:07:42 -08:00
Andy Stewart
b87aacbbfe Do not treat win32unix as Windows.
This reverts 16568f4815 which was, I believe now, mistaken.

See #471.
2018-03-06 10:55:47 +00:00
Daniel Hahler
41b951e64e Fix gitgutter#utility#warn_once: use echom
This a) logs the message to be seen in `:mess` and b) avoids the
hit-ENTER prompt (which is likely caused by the message not being
logged and Vim deciding that you need to see it then).

So a) fixes b).
2018-03-01 10:11:03 +00:00
Daniel Hahler
4931dd1a82 Conditionally define s:vimdiff
This optimizes it a bit since the `exists()` is not called always.
2018-02-21 11:46:36 +00:00
Daniel Hahler
18f6d0ffe1 gitgutter#utility#setbufvar: skip unnecessary setbufvar
An existing dict gets returned by reference, so changing it does not
need a call to `setbufvar` afterwards.
2018-02-21 11:39:42 +00:00
Andy Stewart
16568f4815 Add win32unix to OS check. 2018-02-16 15:40:02 +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
0c94dd0235 Handle UNC paths.
Fixes #328.
2018-02-15 14:52:10 +00:00
Andy Stewart
85f6e136bd Turn off gitgutter for any buffer with a vimdiff window.
Closes #303.
2018-02-14 11:10:59 +00:00
Andy Stewart
850e947509 Add backward compatibility for lambda.
Lambdas were introduced in Vim 7.4.2044.
2018-02-13 10:02:54 +00:00
Andy Stewart
7f14cd142c Pass bufnr into warn_once function.
Fixes #465.
2018-02-13 09:32:38 +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
1c034be0d3 Store buffer local variables in a single dictionary.
This reduces the footprint in the buffer variable namespace to a single
key.
2017-02-22 11:28:25 +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
Scott Sanders
77aa7ea225 Negate the shell_error value during return 2017-01-09 09:43:04 -05:00
Scott Sanders
33cceff0fc Use call to execute this shell command 2017-01-09 09:42:44 -05:00
Scott Sanders
ce8b5a4086 Detect git version >= 1.7.2 without a messy regex 2016-12-30 16:41:38 -05:00
Andy Stewart
0d455a7af7 Only restore shell if previously saved. 2016-10-19 14:17:03 +01:00
Andy Stewart
a693c0d326 Ensure nested calls do not overwrite value of original shell.
See #379.
2016-10-19 10:00:11 +01:00
Andy Stewart
55b556f7a2 Dedup buffer lists to avoid unnecessary work. 2016-10-10 12:52:05 +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
43e7c1f542 Set &shellredir when changing shell.
See #365.
2016-09-06 10:36:09 +01:00
Xavier Guérin
377c71d982 Use /bin/sh as default shell.
- /bin/bash is not part of OpenBSD.
- We need only a POSIX shell, not bash specifically.

Closes #340.
2016-05-20 11:13:45 +01:00
Andy Stewart
f5a5234f22 Allow configuration of git executable. 2016-05-16 13:47:14 +01:00
Andy Stewart
ba6e104848 Always use bash on unix.
Vim is single-threaded so we can make life easier by using a known shell
and restoring the original one afterwards.
2016-05-16 12:00:06 +01:00
Andy Stewart
cae4f72aa1 Abort functions at first error. 2016-05-13 14:14:41 +01:00
Andy Stewart
3ffd67d905 Extract stringify function. 2016-04-29 10:02:15 +01:00
Andy Stewart
e607a997ce Asynchronous diffs in Vim. 2016-04-29 09:50:57 +01:00
Andy Stewart
4bed1da648 Add simple logging. 2016-04-25 13:19:50 +01:00
Andy Stewart
cc77f32b5b Only use "-c name=value" when git supports it.
Closes #319.
2016-04-20 12:16:06 +01:00
Andy Stewart
78d83c7056 Improve rejection of unsuitable buffers. 2016-03-29 18:17:31 +01:00
Andy Stewart
3ed80d959d Whitespace. 2016-03-07 09:06:30 +00:00
Andy Stewart
f05fda98b2 Fix problem affecting neovim's omnicompletion.
Before this change, neovim's omnicompletion would always insert the
first completion option without allowing the user to choose any other.

Thanks to @lvht, @chemzqm, and @Shougo for help with this.

Closes #310, #311.
2016-03-07 09:02:56 +00:00
Andy Stewart
18b7836168 Neovim: run diffs asynchronously. 2016-02-09 10:11:41 +00:00
Andy Stewart
3a810a9afc Make the 'exceeded max signs' warning less intrusive.
- Only show it once per buffer.
- Redraw before echo to avoid the hit-enter prompt.

See #259.
2016-01-13 16:05:18 +00:00
somini
1067294cdc Specify help files correctly
This makes so that editing helpfiles directly triggers the gutters,
while keeping the default behaviour of editing help buffers (opened
with `:help stuff`) doesn't.
2015-08-26 10:43:01 +02:00