Commit Graph

147 Commits

Author SHA1 Message Date
Andy Stewart
fa85bd41d9 Pass filepath into s:fix_file_references() to make function pure. 2018-03-02 11:41:48 +00:00
Andy Stewart
05e538e553 Remove irrelevant comment. 2018-03-01 10:24:08 +00:00
Daniel Hahler
85d762fff6 Improve warning message for max-signs-exceeded 2018-03-01 10:11:03 +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
Andy Stewart
0055e97bac Use '-c "core.safecrlf=false"' to avoid unhelpful line ending warnings.
See #486.
2018-02-28 19:17:31 +00:00
Andy Stewart
293b633d79 Add --no-pager to git-show and git-diff.
I needed these to get output from the commands on Windows.
2018-02-28 16:45:39 +00:00
Andy Stewart
e512d3a6fc Make the process_hunks() function public.
This is so other plugins, e.g. vim-signature, may use it.

Closes #489.
2018-02-26 08:58:27 +00:00
Andy Stewart
b27ee4d602 Rename variable for clarity. 2018-02-22 16:23:17 +00:00
Daniel Hahler
c325a8b6d3 s:fix_file_references: handle diff.mnemonicPrefix
An alternative would be to run `git` with no user config always, i.e.
setting `GIT_CONFIG_NOSYSTEM` and `HOME=/dev/null` (different for
Windows then) in its environment.  Maybe there's an easier way / single
option for this..
2018-02-22 09:49:31 +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
Daniel Hahler
a046b5ace1 Improve GitGutter User autocommand: context/unsilent
This provides `g:gitgutter_hook_context` during the hook's execution and
removes the `:silent`, but uses `exists()` instead.

The bufnr might be necessary to know in the User autocommand, e.g. to
clear some cache.
Not using`:silent` is good practice in general to not hide (wanted)
output and errors etc.
2018-02-21 11:23:02 +00:00
Andy Stewart
d86ac1353f Avoid race conditions when processing multiple buffers asynchronously.
Fixes #472.
2018-02-19 12:56:22 +00:00
Patryk Czachurski
314e64673b Fixed call to current_hunk in hunk text object 2018-02-19 10:14:34 +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
4e911819be Write buffer using writefile() instead of :write.
This is to avoid side effects caused by switching to the buffer to be
written and back again.

It also means that the plugin can process any buffer without having to
make it the current buffer.

Using the lower level writefile() function means we have to deal with
line endings.  It might also mean we have to deal with (file) encodings
but I hope not...

See #463, #466.
2018-02-13 10:22:36 +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
8a7d00590b Restore support for vim-repeat in hunk ops. 2018-02-12 16:42:20 +00:00
Andy Stewart
2d32a2965a Improve hunk previewing.
- Treat &previewheight as a maximum height.
- Make preview window shrink to fit the hunk.
- Resize preview window each time.
- Make preview window readonly and nomodifiable.

Based on code by @somini.  Thanks!

See #451.
2018-02-12 16:32:43 +00:00
Andy Stewart
d137753182 Handle &write option being off (e.g. vim -m FILE).
See #407.
2018-02-12 16:19:01 +00:00
Andy Stewart
8da5b64868 Avoid autocmds when switching buffers to write temp file. 2018-02-12 16:02:03 +00:00
Andy Stewart
3a052e4777 More idiomatic execute. 2018-02-12 15:52:34 +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
932ffaca09 Ensure we write correct buffer.
Fixes #454.
2018-01-29 15:30:25 +00:00
Sudo Nice
1e60667322 Open folds on hunk jumping 2017-11-01 11:58:34 +00:00
Andy Stewart
579f0a5006 Make async callbacks backward compatible for nvim < 0.2.0 2017-10-23 10:08:43 +01:00
Andy Stewart
54209a0199 Simplify async implementation. 2017-10-16 09:22:55 +01:00
Andy Stewart
438bff6a63 Whitespace. 2017-10-16 09:22:55 +01:00
Lucas Hoffmann
f2ff2321cd Fix small typo in highlight group name 2017-10-16 08:37:47 +02:00
Andy Stewart
f16cf539a2 Turn off grep colour when GREP_OPTIONS switches it on.
Closes #415.
2017-04-20 12:37:52 +01:00
Andy Stewart
9ecce5a269 Do not use --color=never flag for grep.
See #410.
2017-04-03 13:30:23 +01:00
Andy Stewart
092369c19c Use plain grep instead of extended grep.
See #410.
2017-04-03 13:23:50 +01: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
Andy Stewart
8576f00548 Make hunks buffer-local. 2017-02-21 16:40:18 +00:00
Andy Stewart
80375e6b8b Ensure git uses source and destination prefixes when staging.
See #313.
2017-02-20 13:51:36 +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
7b81a8a226 Specify job command as a string on Windows.
Specifying the command as a list seems to be less reliable.

See #377.
2016-12-23 11:20:17 +00:00
James McCoy
e231bbc24a Declare nvim's callback as a dict function
neovim/neovim#5529 merged support for Vim's partial functions, which
made nvim more strict about dictionary functions.  This means the
implicit self variable isn't available unless a function is annoted as a
dict function or defined as part of a dictionary.

Closes #392
2016-12-12 22:30:30 -05:00
Andy Stewart
ee481585d7 Modernise tests.
Use Vim's built-in assert_*() functions and vim-contest test runner.
2016-10-27 12:15:43 +02:00
__
64a445bb53 Vim: explicitly check for job support. 2016-10-20 17:01:11 +01: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