Commit Graph

43 Commits

Author SHA1 Message Date
Andy Stewart
a61ddf453c Extract method for clarity. 2013-03-08 11:45:13 +01:00
Andy Stewart
cf2db0df65 Define sign column highlights. Add colours and signs section. 2013-03-08 11:36:44 +01:00
Vaz Allen
7186f8bcad Highlighting customisation tweaks.
Highlight groups for signs:

- renamed highlight groups with `GitGutter` prefix, and following the
  naming style of the builtin groups `DiffAdd`, `DiffChange`, etc.

- using `highlight default link` to set default colours for signs.
  e.g. the plugin defines `GitGutterAddDefault` as green, and default
  (if `g:gitgutter_highlights`) links `GitGutterAdd` to it (which the
  user can customise).

Highlight groups for lines:

- added gitgutter-specific highlight groups for line highlighting
  (`GitGutterAddLine`, etc) so that this highlighting can be customised
  independent of `DiffAdd` et al (which these default link to).

- line highlighting toggling now only changes the linehl attribute.

  The `linehl` attribute is toggled in `s:update_line_highlights`,
  which separates concerns more clearly.  I'm thinking ahead to the
  possibility of the sign text being configurable, and thinking it will
  be DRYer to keep these things separate.  Maybe it's just aesthetic
  though.

Bonus: resolved "eugh" ;)
2013-03-08 11:14:56 +01:00
Andy Stewart
14563c3689 Ensure signs feature is present. 2013-03-07 20:00:58 +01:00
Andy Stewart
b6c5364436 Run GitGutter when focus is gained.
This updates the signs on the current file when you return to GUI vim.
For example, you make some changes in Vim, tab to your shell and commit
them, then tab back to Vim; at this point you want the signs to update
automatically for you.
2013-03-06 14:08:44 +01:00
Andy Stewart
177365691b Change public function names to match command names. 2013-03-06 13:55:19 +01:00
Tom Cammann
a67904e812 Change command names to follow GitGutterXxxx. 2013-03-06 13:51:59 +01:00
Andy Stewart
00a862285f Work with all shells, not just bash. 2013-03-06 12:11:38 +01:00
Drew Stokes
fd22bbbb08 Disable diff colors to fix file name grep. 2013-03-06 11:17:38 +01:00
Konstantin Kudryashov
34879ec3c8 Add ability to disable highlights registration
So we could tune up it in our custom colorschemes
2013-03-05 13:54:00 +01:00
Andy Stewart
c46cf29392 Extract methods for clarity. 2013-03-05 10:10:14 +01:00
Andy Stewart
9924c7ca1d Handle modifed-and-added/removed diffs. 2013-03-05 10:00:06 +01:00
Andy Stewart
518266d8c5 Fix typo. 2013-03-05 09:33:52 +01:00
Marco Hinz
e7dd1e0341 Escape ' characters in filepaths. 2013-03-04 12:40:20 +01:00
Andy Stewart
1ab2f4dfcc Expose hunks.
Make hunks available to any other plugins which might want to use them.
2013-03-01 09:21:02 +01:00
Andy Stewart
5a48d86dca Check for existence of signs before clearing.
This fixes a bug whereby opening Vim on a non-git tracked file, then
calling `:DisableGitGutter` or `:ToggleGitGutter`, tried to clear a
variable before it had been defined.
2013-03-01 09:01:09 +01:00
Andy Stewart
cd818c9d8e Add commands for convenience. 2013-02-28 10:08:06 +01:00
Andy Stewart
3ab2f38fbe Extract method to avoid repetition. 2013-02-28 09:59:29 +01:00
Tobias Pflug
04a72e9e3c Add functions to jump between diff hunks. 2013-02-28 09:56:41 +01:00
Andy Stewart
8ed5c48b63 Fix bug preventing configurable off-by-default. 2013-02-28 09:00:22 +01:00
Andy Stewart
e7247311f5 Add optional line highlighting.
This uses the `DiffAdd`, `DiffChange` and `DiffDelete` highlight groups.

Based on code by Tobias Pflug <tobias.pflug@gmail.com> (@gilligan).
2013-02-27 12:22:31 +01:00
Ron Damen
3caf7afd60 Allow user to toggle GitGutter off and on. 2013-02-27 11:39:09 +01:00
Ron Damen
29eb440cac Turn off and on without reloading 2013-02-27 11:37:09 +01:00
Andy Stewart
270613bd71 Ignore diff results which aren't actually hunks.
Some people have reported a failure whereby at least one `line` in the
diff results doesn't match the hunk regexp.  I believe, though cannot
say with certainty, that this is due to mismatching newline shenanigans.

However this theory doesn't explain how the failure could occur on a
file without changes, as reported by one person.  Furthermore I think
that the hunk results would have to have double \n characters to cause
this failure, which I don't think would ordinarily occur on Windows or
Unix.

Whatever the reason, this change copes with the situation.
2013-02-27 10:34:07 +01:00
Andy Stewart
0c16f257d6 Allow user to turn GitGutter off and on. 2013-02-26 09:35:04 +01:00
Andy Stewart
e989037f84 Don't read the filename unnecessarily. 2013-02-25 10:43:41 +01:00
Andy Stewart
c012575fd4 Add comment. 2013-02-25 10:38:19 +01:00
Andy Stewart
24e9d4bdcd Clarify code. 2013-02-25 10:34:58 +01:00
Andy Stewart
b5c7469a15 Move function so code reads better. 2013-02-25 10:22:24 +01:00
Andy Stewart
4df8b36f54 Add comment. 2013-02-25 10:20:20 +01:00
Andy Stewart
985bbbee73 Only clear signs for current file. 2013-02-25 10:19:49 +01:00
Andy Stewart
4a51f34d5b Set foldmethod to marker. 2013-02-25 09:45:58 +01:00
Andy Stewart
b308149c93 Don't run when entering a buffer; there's no need. 2013-02-25 09:40:56 +01:00
Andy Stewart
79fa8caa6e Push diff filtering down to shell.
This should make things a little more efficient on the basis of
minimising the amount of data flowing up.
2013-02-22 12:45:03 +01:00
Andy Stewart
4bd964090f Include augroup in public interface fold. 2013-02-22 09:57:50 +01:00
Andy Stewart
ac920417b8 Only act when there is a file to act on. 2013-02-22 09:57:21 +01:00
Andy Stewart
aab9bd5ad9 Don't clobber other people's signs. 2013-02-21 16:07:02 +01:00
Andy Stewart
0049a1e72c Update only GitGutter's signs. 2013-02-21 15:18:46 +01:00
Andy Stewart
aea72fbf0f Namespace the signs. 2013-02-21 14:57:59 +01:00
Andy Stewart
f0ad2a5b6d Separate hunk iteration from processing. 2013-02-21 14:48:20 +01:00
Andy Stewart
cda4597459 Run the git commands in each file's directory.
This allows vim-gitgutter to work whatever Vim's current directory is
and whichever repos the files are in.
2013-02-21 10:38:29 +01:00
Vincent
5fae75637c Avoid error on windows
In order to avoid an error "Invalid filename", this little fix get gitgutter working on windows with msysgit
2013-02-20 14:21:57 +01:00
Andy Stewart
843ee5aed6 First draft. 2013-02-20 10:53:23 +01:00