Commit Graph

694 Commits

Author SHA1 Message Date
Andy Stewart
a194e9da01 When git cannot be found only warn if plugin enabled
This enables the plugin to be loaded on systems without git, without
emitting any warnings.

See #702.
2020-04-27 14:09:56 +01:00
Andy Stewart
011fca3f02 Only use '/d' flag for 'cd' in DOS shell
Closes #678.
2020-04-27 10:38:35 +01:00
Andy Stewart
ea14301cb4 Default to not limiting number of signs on newer Vims
The limit on the maximum number of signs was introduced when Vim's sign
drawing code was much slower than it is now.

See #681.
2020-04-27 10:09:22 +01:00
Andy Stewart
70855aa93d Enable turning off limit on maximum number of signs
Setting the variable to a known value (-1) is neater than an arbitrary
high number.

See #681.
2020-04-27 10:02:03 +01:00
Andy Stewart
f411d8680e Do not override existing diff* highlight groups
See #701.
2020-04-25 20:00:24 +01:00
Andy Stewart
3fb9a59a06 Handle existing GitGutter* highlight groups which are links
Fixes #701.
2020-04-25 13:51:29 +01:00
Andy Stewart
8a380e2f90 Ensure good diff syntax highlighting in preview
Specifically, make it match the signs' foreground colours; and clear the
backgrounds so the GitGutter{Add,Delete}IntraLine highlights' "reverse"
colours work properly.
2020-04-25 13:33:05 +01:00
Andy Stewart
3cb5cbfd18 Revert preview window diff colours 2020-04-25 11:38:46 +01:00
Andy Stewart
f34ce3aa6b Set default diff colours for the preview window
Some colourschemes forget this.
2020-04-25 11:27:58 +01:00
Andy Stewart
8db2fc5da0 Set correct background on existing GitGutter* highlight groups
Previously if the user or the colourscheme had already defined
GitGutter* highlight groups, the plugin would leave their backgrounds
alone.  This pushed the responsibility for figuring out and specifying
the correct backgrounds onto the user or colourscheme maintainer.

With this change the plugin now sets the correct background on existing
GitGutter* highlight groups.

Also, the documentation was simplified so it is clearer how to set your
own colours for the signs.
2020-04-25 11:17:34 +01:00
Andy Stewart
6b46098b2a Remove unnecessary word 2020-04-24 09:22:06 +01:00
Andy Stewart
f118eb8077 Add note about compatibility 2020-04-24 09:21:48 +01:00
Andy Stewart
dab840b153 Use fresh temp files for every diff
Originally the plugin used fresh temp files for every diff.  But it
wrote to those files with `:write` which made Vim's buffer numbers
increase unnecessarily (see #297) so the plugin changed to reuse the
same temp files each time (see a871d857).

However this has the problem that after Vim has been open for a while,
e.g. a few days, the operating system can clean up the temp directory
holding those temp files.  The next time the plugin runs a diff, Vim
throws an error because it cannot write to the temp files because their
directory has disappeared (see #395, #433).

In the meantime the plugin changed how it writes the temp files to
use `writefile()` (see 4e911819).  This removed the problem of rapidly
increasing buffer numbers.

Now the buffer number problem has gone, the plugin can revert to using
fresh temp files each time.
2020-04-23 16:47:03 +01:00
Andy Stewart
425c7cf2e2 Maintain backward compatibility in hunk preview code
win_getid() was introduced in Vim 7.4.1557.  The code uses it to
remember the id of the preview window.  In newer Vims or Neovim this
could be a floating window but pre-7.4.1557 it can only be an ordinary
preview window.  And in that case we only need the preview window's
buffer number.

This commit uses the buffer number when win_getid() isn't available.

Fixes #683.
2020-04-23 09:28:38 +01:00
Andy Stewart
9e99a78271 Document the reason for the name gitgutter 2020-04-23 09:02:22 +01:00
Andy Stewart
3599736179 Fire GitGutterStage User event after staging
Closes #698.
2020-04-23 08:59:26 +01:00
Andy Stewart
2b62481d38 Only diff against parent commit in Fugitive revision buffers
Fixes #695.
2020-04-18 17:13:15 +01:00
Andy Stewart
5f6048da13 Bypass sticky type checking on older Vims
Until Vim 7.5.1546 the type of a variable could not be changed.

Fixes #693.
2020-04-14 15:42:07 +01:00
Andy Stewart
b7db78b258 Simplify getting and setting buffer variables
This also avoids the getbufvar(bufnr, '') pattern which is subject to a
Vim bug in certain versions.

Closes #691.
2020-04-03 14:50:15 +01:00
qlem
9cdb90b1e1 fix #688 2020-04-01 17:33:05 +01:00
qlem
262f1b5c9a keep noautocmd and fire WinEnter with a doautocmd 2020-04-01 13:07:03 +01:00
qlem
9c7f819538 fix the behavior of the status line of the hunk preview windows 2020-04-01 13:07:03 +01:00
Balki
7c48aa1e72 Use config option gitgutter_diff_base in quickfix window 2020-03-27 13:40:24 +00:00
Andy Stewart
0e509fb0ac Set diff base when viewing file versions with Fugitive
When you look at previous versions of a file, e.g. with Fugitive's
:0Gclog, gitgutter will set the diff base to the current version's
parent so that diff markers appear as expected.

Thannks to @rcreasi for the idea and initial implementation.
2020-03-12 10:38:58 +00:00
Andy Stewart
c337eef1b7 Make hunk commands noops when file not tracked by git
Fixes #680.
2020-02-24 15:42:05 +00:00
Andy Stewart
8e368ae8d1 Extract has_repo_path() function 2020-02-24 15:16:51 +00:00
Andy Stewart
669357bb92 Fix #repo_path() return value when path not set
This change makes it an empty string, as documented, not 0.
2020-02-24 15:10:55 +00:00
Andy Stewart
a75fd77a78 Do not run diff unnecessarily 2020-02-24 14:33:22 +00:00
Daniel Hahler
da2c785221 Set scriptencoding for file with utf8 BOM 2020-02-13 11:25:10 +00:00
Daniel Wyatt
2ef4f7e7b2 Use known shell for git_supports_command_line_config_override. 2020-01-22 09:00:31 +00:00
Andy Stewart
9add23a492 Document how to get diff stats in statusline
Closes #674.
2020-01-15 11:50:47 +00:00
Andy Stewart
0946c53cfc Clarify line number highlights require sign column.
See #669.
2020-01-06 14:13:29 +00:00
Andy Stewart
91bd300021 Document 'updatetime' also controlling writing of swap files.
See #672.
2020-01-06 11:52:07 +00:00
Andy Stewart
1c53af9a0d Listen to FugitiveChanged autocmd
Closes #666.
2019-12-03 15:27:08 +00:00
Andy Stewart
c31581c25b More idiomatic line number navigation 2019-11-25 12:14:38 +00:00
Andy Stewart
bced2175f8 Add snippet for cycling hunks in current buffer.
Thanks @andys8 :)

Closes #667.
2019-11-25 12:12:49 +00:00
Richard Robbins
fa8d0feb41 Update README.md with g:gitgutter_use_location_list info 2019-11-22 13:25:40 +02:00
Richard Robbins
d36686e6a5 Add g:gitgutter_use_location_list option 2019-11-22 13:25:40 +02:00
tamago324
b97acf2c8a Fix typo in doc 2019-11-20 13:14:38 +02:00
Morgan Terry
af20a9fcff Fix example mappings 2019-10-24 13:11:11 +03:00
Andy Stewart
5c73edb3c2 Fix write_buffer() to not add extra line for dos fileformat 2019-10-15 10:14:10 +01:00
Andy Stewart
ed978c40eb Fix dos undo test 2019-10-15 10:14:00 +01:00
Andy Stewart
7e1ca55646 Fix test names 2019-10-15 10:13:02 +01:00
Andy Stewart
af4aded958 Add blank line to end of dos fixture 2019-10-14 17:38:49 +01:00
Andy Stewart
320b7a33e7 Fix preview and undo hunk for dos line endings 2019-10-14 10:10:46 +01:00
Andy Stewart
1725c13add Simplify installation instructions 2019-10-01 10:39:23 +01:00
Andy Stewart
236ced01c7 Clarify that plugin compares buffer not working tree 2019-09-30 13:26:40 +01:00
Andy Stewart
c656fc94d2 Add FAQ on diff highlight groups 2019-09-30 13:26:17 +01:00
Andy Stewart
0bcd8c5b9c Update signs if linenrs highlighted
Fixes #656.
2019-09-30 13:20:43 +01:00
Andy Stewart
32fb9895b7 Do not clear signs when disabling signs if linenrs highlighted 2019-09-30 13:20:17 +01:00