Commit Graph

59 Commits

Author SHA1 Message Date
Andy Stewart
fd7fb6cd15 Fix bug where GitGutter wasn't called on buffer write.
This affected people with the default configuration but not those where
`BufEnter` was turned off.

This problem was introduced by the last commit.
2013-03-19 09:12:21 +01:00
Andy Stewart
7f1c104f9f Fix autocommands so GitGutter doesn't run twice on file read. 2013-03-18 16:09:40 +01:00
Andy Stewart
677dac451d Add opt-out configuration for BufEnter and FocusGained. 2013-03-15 10:53:31 +01:00
Andy Stewart
04be163a3e Fix bug for GitGutterEnable. 2013-03-15 10:20:43 +01:00
Andy Stewart
d40fd44904 Fix bug when calling GitGutterDisable immediately.
When opening Vim without editing any file, calling GitGutterDisable
would fail because `s:file` was undefined at that point.  The fix breaks
what encapsulation there is, but has the virtue of working.
2013-03-15 10:18:30 +01:00
Andy Stewart
f52625be83 Fix bug where vim-gitgutter tried to run for non-files. 2013-03-15 10:00:09 +01:00
Andy Stewart
c48829586e Update signs across all buffers on FocusGained. 2013-03-14 15:41:45 +01:00
Andy Stewart
3f107f97da Make always-showing-the-sign-column opt-in.
This is consistent with Vim's default behaviour.
2013-03-14 09:34:25 +01:00
Andy Stewart
15ee31acf4 Handle non-English locales. 2013-03-13 14:55:22 +01:00
Andy Stewart
fe2b4ec869 Place a dummy sign to keep sign column.
The sign column automatically appears when there is at least one sign
and disappears when there are none.  There's a small gap between
when vim-gitgutter removes its signs and adds new ones; during that gap
the sign column can flicker.

By adding a dummy sign before removing the real signs, we force the sign
column to remain.
2013-03-13 11:30:24 +01:00
Nick Andryshak
1f04008485 Improve fix to Windows gVim infinite shell loop. 2013-03-12 16:25:18 +01:00
Lewis Franklin
a09e085b51 Prevent infinite loop on Windows gVim. 2013-03-12 16:19:50 +01:00
Andy Stewart
6889f9918e Remove accidentally-committed maps. 2013-03-12 16:03:37 +01:00
Andy Stewart
64e9fac7df Enable prev/next hunk commands to take a count. 2013-03-12 15:57:57 +01:00
Andy Stewart
3979c4f7b6 Easier customisation. 2013-03-08 13:19:25 +01:00
Andy Stewart
861e417886 Construct variable on one line for clarity. 2013-03-08 12:48:48 +01:00
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