Commit Graph

524 Commits

Author SHA1 Message Date
Billy
efa1ead770 Typo fix. 2016-09-09 09:05:41 +01:00
Andy Stewart
43e7c1f542 Set &shellredir when changing shell.
See #365.
2016-09-06 10:36:09 +01:00
Filip Szymański
26c6b549f2 Use "ch_info()" to get channel id 2016-07-12 19:05:32 +02:00
Andy Stewart
b5f23e9867 Use known shell for hunk staging, previewing, undoing.
Forgot to do this in 377c71d.

Closes #352.
2016-06-27 10:55:26 +01:00
Luke Farrar
c8fa0b3349 Move -r to start of args for non-GNU folk. 2016-06-21 10:28:56 +01:00
Luke Farrar
88e26c0fdf Fix manual install commands. 2016-06-21 10:28:56 +01:00
Andy Stewart
d19e86d249 Update FAQ in README. 2016-06-21 09:57:39 +01:00
Andy Stewart
09b9144002 Remove obsolete troubleshooting step.
Forgot to do this in 377c71d.
2016-06-09 10:34:52 +01:00
Andy Stewart
cfbca4455c Enable async diffs in gVim 7.4.1850+. 2016-06-09 10:30:48 +01:00
Andy Stewart
6ac5039600 Don't try to realtime-diff an untracked file. 2016-06-09 10:01:32 +01:00
Andy Stewart
f8da1fd6db Preserve screen line position when undoing a hunk.
Closes #346.
2016-05-23 10:31:17 +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
90c558b1dc Expand installation instructions. 2016-05-18 16:35:04 +01:00
Christian Persson
b3979e7736 Fix typo in table of contents 2016-05-18 15:33:23 +01:00
Andy Stewart
f15a67ff51 Get buffer variable's default value in a backward-compatible way.
getbufvar() gained a default value in v7.3.831.  The change here handles
default values in older Vims (pre 7.2 at least).
2016-05-18 08:47:52 +01:00
Andy Stewart
867e013a62 Improve guard for missing-git warning again. 2016-05-16 16:29:40 +01:00
Andy Stewart
55d8247848 Fix guard for missing-git warning. 2016-05-16 13:50:27 +01:00
Andy Stewart
f5a5234f22 Allow configuration of git executable. 2016-05-16 13:47:14 +01:00
Andy Stewart
9db8f638db Make hunk summary window-aware.
Closes #331.
2016-05-16 12:21:06 +01:00
Andy Stewart
ef6fd3a986 Store a buffer's hunk summary in a buffer local variable. 2016-05-16 12:07:20 +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
1937f06498 Avoid potential shell (un)quoting problems in NeoVim.
See neovim/neovim#4746 for a discussion.
2016-05-16 10:36:27 +01:00
Andy Stewart
053581db5c MacVim GUI 7.4.1832+ supports async diffs. 2016-05-16 10:10:11 +01:00
Andy Stewart
cae4f72aa1 Abort functions at first error. 2016-05-13 14:14:41 +01:00
Andy Stewart
264d7f3a66 Only use "<nomodeline>" when available. 2016-05-13 09:48:43 +01:00
Andy Stewart
882073f4b5 Restrict async diffing in Vim to terminal Vim.
MacVim in GUI mode and gVim don't process the callbacks reliably (or at
all) yet.
2016-05-12 10:22:43 +01:00
Andy Stewart
ea5d4cbeaf Don't process modelines after triggering autocommand.
Closes #334.
2016-05-10 15:54:01 +01:00
Andy Stewart
169e08a718 Apply signs to correct buffer when using Vim async. 2016-05-10 15:33:44 +01:00
Andy Stewart
0e490ec830 Require Vim 7.4.1826 for async Vim. 2016-05-09 16:57:43 +01:00
Andy Stewart
72d100517a Update vim callback handlers in light of vim change.
Vim 7.4.1810 stopped sending DETACH to the out_cb handler to mark the
end of the job's stdout.  Instead we add a close_cb handler which does
what the out_cb handler used to do upon receiving DETACH.
2016-05-09 16:54:34 +01:00
Tommy Allen
a4e75dd074 Apply signs to correct buffer when using Neovim async 2016-05-09 12:16:09 +01:00
Andy Stewart
d5806ea44c Check existence of function 2016-05-09 12:14:30 +01:00
Andy Stewart
f03a1a1f02 Document the autocmd. 2016-05-06 16:32:29 +01:00
Joel D. Elkins
27f99c4a4d Fire autocommand after processing buffer. 2016-05-06 16:26:24 +01:00
Andy Stewart
db6a253d68 Disable async for vim pending vim segfault fix.
References:

- #332
- https://groups.google.com/d/topic/vim_dev/n0jeRog4DI0/discussion
2016-05-05 10:28:16 +01:00
Andy Stewart
65e3ff8994 Fix Markdown link. 2016-04-29 10:25:21 +01:00
Andy Stewart
3ffd67d905 Extract stringify function. 2016-04-29 10:02:15 +01:00
Andy Stewart
13c2943959 Add timestamps to log. Log channel traffic. 2016-04-29 10:02:15 +01:00
Andy Stewart
ae434ce89e Run tests in nvim as well as vim. 2016-04-29 09:50:57 +01:00
Andy Stewart
e607a997ce Asynchronous diffs in Vim. 2016-04-29 09:50:57 +01:00
Andy Stewart
a13478c7d6 Move comment and adjust whitespace for clarity. 2016-04-25 14:19:22 +01:00
Andy Stewart
4bed1da648 Add simple logging. 2016-04-25 13:19:50 +01:00
Andy Stewart
52d1167d7d Give up when job id is problematic. 2016-04-25 10:30:24 +01:00
Andy Stewart
5ed00d1bd3 Restore original jobstart invocation.
This reverts 16e69e6 and 103acc7 from #322.  These changes turned out to
stop the plugin working with zsh and neovim.

Fixes #324.
2016-04-22 20:39:35 +01:00
Andy Stewart
d282c33789 Fix new-line signs for untracked repo files with square brackets.
Before the plugin tries to diff a file, it checks whether git is
tracking the file.  If git isn't tracking the file, it stops there and
doesn't display any signs.  If git is tracking the file, the plugin
remembers so next time it can skip the check.

When I introduced asynchronous diffing for NeoVim (18b78361), I made a
refactoring mistake which caused the plugin on second and subsequent
runs [to always think git is tracking a file][1].

The non-realtime diffs – the ones you get when you save a buffer –
basically run `git diff FILE`.  With an untracked file git returns
nothing and exits successfully.  So although the plugin erroneously
thinks git is tracking the file, it gets an error-free, empty diff back
and so removes any and all signs.  Which means that the bug doesn't make
any difference.

However the realtime diffs write the buffer's contents to a temporary
file, and write the file as staged in the index to a temporary file,
then run `git diff FILE1 FILE2`.  To write the staged version of the
file we use `git show :FILE > TMPFILE`.

When `FILE` isn't known to git, `git show :FILE` exits with an error.
Unless, that is, [the filename contains square brackets and you're using
git v2.5.0+][2], in which case git exits successfully with empty output.

So if you're using git v2.5.0+, and you're editing an untracked file in
a repository, and the filename contains square brackets, the plugin will
think: git is tracking the file; the realtime diff is successful; the
file in the index is empty; so every line in the the working copy must
be an addition; hence a `+` sign on every line.

[1]: 18b7836168/autoload/gitgutter/diff.vim (L119-L121)
[2]: http://comments.gmane.org/gmane.comp.version-control.git/285686

Closes #325.
2016-04-22 15:04:32 +01:00
Andy Stewart
65025c9f31 Fix test to edit the correct file. 2016-04-22 11:45:40 +01:00
Andy Stewart
035ea9260c Add section on extensions to README. 2016-04-21 15:57:07 +01:00
Andy Stewart
e48824cd1d Provide a hunk text object. 2016-04-21 14:08:14 +01:00
Andy Stewart
b3db866aab Use "undo" instead of "revert" for discarding a hunk.
"Undo" is a better name than "revert" because:

- "revert" sounds like it has something to do with `git-revert` but they
  are entirely different;
- "undo" is consistent with vim's "undo": discarding changes and going
  back to the original.

Maintain backwards compatibility and add deprecation warnings.

Closes #306.
2016-04-21 11:40:27 +01:00
Greg Werbin
103acc7a23 Support both spaces and quotes in &shell
Pass the git command to `jobstart()` as a string, not a list.
`jobstart()` does some kind of internal black magic to parse strings
like `'"/usr/bin/env bash" -l'`, whereas it would be impossible to pass
in an equivalent argument using a list.
2016-04-21 10:54:41 +01:00