Commit Graph

50 Commits

Author SHA1 Message Date
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
Andy Stewart
62462a25a7 Minor refactor. 2015-08-17 09:45:31 +02:00
Manuel Johannes Messner
0ca15c8ad2 Add support for fish shell
The `&&` and the `||` operators aren't available in fish.
The equivalents are `; and` and `; or`.
Also single parentheses are used for command substitution.
The fish equivalents are `begin` and `end`.
But they aren't needed here.
2015-08-17 09:29:15 +02:00
Andy Stewart
2e98692278 Do not process help files. 2015-07-14 14:44:35 +02:00
Andy Stewart
937930e647 Fix regex to eliminate false positives in match. 2015-04-21 10:10:18 +02:00
Andy Stewart
8345c35770 Stop early when file is in .git directory. 2015-03-23 11:36:34 +01:00
Andy Stewart
1a7f1c5bf6 Fix typo with variable scope. 2015-03-10 12:11:04 +01:00
Andy Stewart
11b6813b94 Use echo instead of echom.
No need to save the warnings in the messages list.
2015-03-10 12:10:32 +01:00
Eli Young
d613f0f3b2 Remove buffer_contents function
This was only used for realtime diffs, which now write to a temporary
file.
2015-03-04 10:55:32 +01:00
Eli Young
0cb1e41b23 Use a temporary file for buffer for realtime diffs
`git diff` doesn't perform EOL conversion on stdin, causing it to
mistakenly flag every line as having changed when the working tree uses
a different EOL than the blobs. Writing the buffer to a temporary file
and diffing against that avoids this issue.

Fixes #232.
2015-03-04 10:55:31 +01:00
Andrea Cedraro
88c7916d2f Use system() with silent to avoid visual artifact 2014-11-30 17:54:24 +01:00
Andy Stewart
a114088f22 Support symlinked files.
Adds support for when a symlink file <target> points to another file
<source>, where <srouce> is a file under Git version control.

Thanks to @Z1MM32M4N for work on this (see #209).
2014-11-14 14:16:40 +01: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
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