Commit Graph

436 Commits

Author SHA1 Message Date
Andy Stewart
ce4e3d7c9a Add test for sign column. 2014-11-13 15:36:23 +01:00
Andy Stewart
6d91198859 Drop extension for bash script. 2014-11-13 15:32:15 +01:00
Andy Stewart
d7a1785b94 Add test for reverting hunks. 2014-11-13 15:30:48 +01:00
Andy Stewart
e5add67b03 Use clearer file extensions for test files. 2014-11-13 15:27:52 +01:00
Andy Stewart
1f2bb48be5 Add test for hunk staging. 2014-11-13 15:21:37 +01:00
Andy Stewart
dd054534a0 Allow multiple expectations per test. 2014-11-13 15:21:19 +01:00
Andy Stewart
86cde1a919 Add basic test stats. 2014-11-13 14:46:10 +01:00
Andy Stewart
d24686e1bc Extract name manipulation. 2014-11-13 14:41:26 +01:00
Andy Stewart
7d0492e509 Add section on limitations of current tests. 2014-11-13 14:30:51 +01:00
Andy Stewart
4ad4c97bb2 DRY quitting vim after each test. 2014-11-13 14:28:48 +01:00
Andy Stewart
b9f4173f7c Refactor tests to be isolated. 2014-11-13 12:32:42 +01:00
Andy Stewart
a82bc509a9 Ignore test output. 2014-11-12 16:55:00 +01:00
Andy Stewart
09134a5138 Add basic tests. 2014-11-12 16:52:58 +01:00
Andy Stewart
b0e9efa11c Make realtime diff use git-diff.
The only reason the realtime diff used `diff` instead of `git-diff`
previously was that I couldn't figure out how to do it in a way that
worked on Windows as well as Unix.
2014-11-11 10:14:38 +01:00
Andy Stewart
39f0119096 Whitespace. 2014-10-17 09:24:52 +02:00
Andy Stewart
067160c86b Remove obsolete comment. 2014-10-17 09:24:47 +02:00
Andy Stewart
e5eb9e6ecf Fix staging of hunks coming after deleted lines.
Previously vim-gitgutter generated context-free patches and applied
those to the index.  However when staging a hunk situated after any
deleted lines, the line numbers on the patch were out by the number
of lines deleted, and without any context git would apply the patch
to the wrong part of the file in the index.

This commit ensure patches are generated with 1 line of context,
allowing git to adjust the line numbers appropriately and apply the
patch to the right location.

More lines of context would help git more to adjust line numbers; but
the more context we have the more we group together hunks we would
like to treat separately.
2014-10-16 11:50:20 +02:00
Andy Stewart
1e8201963c Ensure closing preview window deletes previewed buffer. 2014-09-23 10:03:14 +02:00
Andy Stewart
198faa119a Report updatetime option in debugging buffer. 2014-09-22 14:39:38 +02: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
Andy Stewart
a2aa2b1100 Avoid Windows command prompt popups when possible.
Before this commit some Windows users saw the command prompt pop
up briefly, and/or the taskbar flicker, every time the plugin ran.

Now the plugin will use xolox's vim-shell and vim-misc, if they are
available and we are on Windows, to execute external commands.  Xolox's
clever plugins avoid the command prompt popup and taskbar flicker.

Windows users with those plugins installed can opt out by setting a
variable in their vimrc.

Many thanks to @suxpert for the initial code.
2014-06-19 10:45:40 +02:00
Andy Stewart
7ac9d059f8 Add note about updatetime. 2014-06-17 09:50:29 +02:00
Andy Stewart
64ad9e46a5 Specify UTF-8 to avoid problems with overscore character. 2014-06-11 18:49:12 +02:00
Andy Stewart
c9595f22e8 Fix bug where custom highlights were lost. 2014-06-04 11:00:53 +02:00
Andy Stewart
c6e5cf49f2 Show sign on first line when line(s) deleted at start of file.
This time with silly mistake fixed.
2014-06-02 09:20:51 +02:00
Andy Stewart
d1e66b71f9 Revert "Show sign on first line when line(s) deleted at start of file."
Signs aren't shown for deleted lines which aren't at the start of the
file.

This reverts commit 0fd18d66f6.
2014-05-31 16:57:15 +02:00
Andy Stewart
0fd18d66f6 Show sign on first line when line(s) deleted at start of file. 2014-05-30 17:03:54 +02:00
Chris Faulkner
833b8a439f Use proper regex when fetching SignColumn colors.
The previous regex would incorrectly match null characters in some cases.
2014-05-21 20:47:33 -07:00
Andy Stewart
208e301903 Document the sign column's presence with line highlights. 2014-05-20 10:08:28 +02:00
Andy Stewart
ceeba75239 Fix independent toggling of signs in sign column and line highlights.
Note that line highlighting requires signs to be placed (because the
line highlight is simply an attribute of a sign).  If the user doesn't
want to see signs in the sign column, but does want line highlighting,
then we make the signs in the sign column invisible.

If neither the signs in the sign column nor the line highlights are
needed (presumably the user just looks at the hunks stats) then we can
remove all signs, at which point Vim removes the sign column...unless
the "sign column always" option is set.
2014-05-19 15:50:51 +02:00
Andy Stewart
0759c96770 Rename function for clarity. 2014-05-19 14:44:58 +02:00
Andy Stewart
d44c51456a Fix typo in function definition. 2014-05-07 14:10:13 +02:00
Andy Stewart
37883739d9 Update broken link to my portfolio. 2014-05-07 14:05:05 +02:00
Adam Monsen
7908defa0c README: adapt to Vundle interface change
"Bundle" is now "Plugin"

https://github.com/gmarik/Vundle.vim/blob/master/doc/vundle.txt#L345-L369
2014-04-15 08:47:18 -07:00
Andy Stewart
a4347c57ea When disabling, disable across all buffers. 2014-04-14 15:24:25 +02:00
Christian Wellenbrock
47ffb2e30b Follow linked highlight groups to find background colors 2014-04-07 13:35:47 +02:00
Christian Wellenbrock
7e7ccea694 Use bg values from SignColumn for GitGutter{Add,Change,Delete}Default 2014-04-06 00:07:06 +02:00
Andy Stewart
ba0f5930e5 Optimise removal of all signs where possible. 2014-03-24 10:26:36 +01:00
Andy Stewart
0ca3f7e3cd Add hunk previewing. 2014-03-18 13:50:22 +01:00
Andy Stewart
9c66906d56 Move logic out of main plugin file. 2014-03-17 11:27:31 +01:00
Andy Stewart
eee8ba4cff Refactor hunk functionality. 2014-03-17 10:48:05 +01:00
Andy Stewart
fd98657d2f Handle vim versions lacking gettabvar(). 2014-03-14 09:35:54 +01:00
Andy Stewart
a1a29b87ee Use cross-platform way to exit with success.
`exit 0` works across all shells (as far as I know).
2014-02-27 09:42:00 +01:00
Andy Stewart
e9db45e36d Escape grep's argument. 2014-02-26 16:47:47 +01:00
Andy Stewart
aeec864d8d Suppress non-zero exit codes for diff.
Exactly as we do for `grep`.
2014-02-26 16:44:39 +01:00
Andy Stewart
7e8d2fb5a6 Use minimal file paths.
Since we start all external commands by cd'ing to the current file's
directory, we can use the file's name instead of its full path.

The exception is `git show :FILE` where we must use a path relative to
the repo root for maximum git compatibility.  It turns out `git
rev-parse` takes a `--show-prefix` argument which makes our relative
path calculation far simpler.

Minimising files paths has these benefits:

- Easier to inspect the generated commands.
- Less opportunity for escaping problems.
- Eliminates possible mismatches betwen absolute paths generated by git
  and absolute paths generated by Vim (crops up with msys/msys2 on
  Windows).

Thanks to @suxpert for helping with this.
2014-02-26 11:52:38 +01:00
Andy Stewart
973c19e1d5 Don't pester user if their Vim is too old for realtime updates. 2014-02-20 11:56:50 +01:00
Jonathan Warner
dff7bc8736 Wrap compound commands in parentheses.
This fixes a problem on Windows where non-git-tracked files caused an
error in Vim instead of returning normally with a non-zero exit code.
2014-02-20 11:26:50 +01:00
Andy Stewart
f291db08c7 Disable realtime updates when Vim older than 7.3.105. 2014-02-14 12:59:39 +00:00