mirror of
https://github.com/amix/vimrc
synced 2025-07-06 16:05:01 +08:00
Updated plugins
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
## vim-gitgutter
|
||||
|
||||
A Vim plugin which shows a git diff in the 'gutter' (sign column). It shows which lines have been added, modified, or removed. You can also preview, stage, and undo individual hunks; and stage partial hunks. The plugin also provides a hunk text object.
|
||||
A Vim plugin which shows a git diff in the sign column. It shows which lines have been added, modified, or removed. You can also preview, stage, and undo individual hunks; and stage partial hunks. The plugin also provides a hunk text object.
|
||||
|
||||
The signs are always up to date and the plugin never saves your buffer.
|
||||
|
||||
The name "gitgutter" comes from the Sublime Text 3 plugin which inspired this in 2013.
|
||||
|
||||
Features:
|
||||
|
||||
* Shows signs for added, modified, and removed lines.
|
||||
@ -33,6 +35,10 @@ Constraints:
|
||||
* Supports git only. If you work with other version control systems, I recommend [vim-signify](https://github.com/mhinz/vim-signify).
|
||||
* Relies on the `FocusGained` event. If your terminal doesn't report focus events, either use something like [Terminus][] or set `let g:gitgutter_terminal_reports_focus=0`. For tmux, `set -g focus-events on` in your tmux.conf.
|
||||
|
||||
Compatibility:
|
||||
|
||||
Compatible back to Vim 7.4, and probably 7.3.
|
||||
|
||||
|
||||
### Screenshot
|
||||
|
||||
@ -88,6 +94,10 @@ You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo
|
||||
|
||||
You cannot unstage a staged hunk.
|
||||
|
||||
After updating the signs, the plugin fires the `GitGutter` User autocommand.
|
||||
|
||||
After staging a hunk or part of a hunk, the plugin fires the `GitGutterStage` User autocommand.
|
||||
|
||||
|
||||
#### Activation
|
||||
|
||||
@ -308,31 +318,20 @@ let g:gitgutter_sign_allow_clobber = 1
|
||||
|
||||
#### Signs' colours and symbols
|
||||
|
||||
By default vim-gitgutter uses your colourscheme's `Diff*` highlight groups' foreground colours for the signs' foreground colours. For example, your `DiffAdd` foreground colour will be used for the `+` sign's foreground colour.
|
||||
If you or your colourscheme has defined `GitGutter*` highlight groups, the plugin will use those for the signs' colours.
|
||||
|
||||
The signs' background colours will all be set to the sign column's background colour.
|
||||
Otherwise it will use your colourscheme's `Diff*` highlight groups.
|
||||
|
||||
If you don't like the default colours, you can either fix your colourscheme's `Diff*` highlights or configure your own `GitGutter*` highlight groups. These groups are:
|
||||
Either way the signs' background colours will be set to the sign column's background colour.
|
||||
|
||||
If you don't like the colours, specify the ones you want in your vimrc (see `:help highlight-guifg` and `:help highlight-ctermfg`). For example, to get vim-gitgutter's original colours (based on git-diff's colours in my terminal):
|
||||
|
||||
```viml
|
||||
GitGutterAdd " an added line (default: links to DiffAdd)
|
||||
GitGutterChange " a changed line (default: links to DiffChange)
|
||||
GitGutterDelete " at least one removed line (default: links to DiffDelete)
|
||||
GitGutterChangeDelete " a changed line followed by at least one removed line (default: links to GitGutterChange)
|
||||
highlight GitGutterAdd guifg=#009900 ctermfg=2
|
||||
highlight GitGutterChange guifg=#bbbb00 ctermfg=3
|
||||
highlight GitGutterDelete guifg=#ff2222 ctermfg=1
|
||||
```
|
||||
|
||||
You can either set these with `highlight GitGutterAdd {key}={arg}...` or link them to existing highlight groups with, say, `highlight link GitGutterAdd MyDiffAdd`.
|
||||
|
||||
To get vim-gitgutter's original colours (based on git-diff's colours in my terminal):
|
||||
|
||||
```viml
|
||||
highlight GitGutterAdd guifg=#009900 guibg=<X> ctermfg=2 ctermbg=<Y>
|
||||
highlight GitGutterChange guifg=#bbbb00 guibg=<X> ctermfg=3 ctermbg=<Y>
|
||||
highlight GitGutterDelete guifg=#ff2222 guibg=<X> ctermfg=1 ctermbg=<Y>
|
||||
```
|
||||
|
||||
– where you would replace `<X>` and `<Y>` with the background colour of your `SignColumn` in the gui and the terminal respectively. For example, with the solarized colorscheme and a dark background, `guibg=#073642` and `ctermbg=0`.
|
||||
|
||||
To customise the symbols, add the following to your `~/.vimrc`:
|
||||
|
||||
```viml
|
||||
@ -399,6 +398,8 @@ By default buffers are diffed against the index. However you can diff against a
|
||||
let g:gitgutter_diff_base = '<commit SHA>'
|
||||
```
|
||||
|
||||
If you are looking at a previous version of a file with Fugitive (e.g. via `:0Gclog`), gitgutter sets the diff base to the parent of the current revision.
|
||||
|
||||
This setting is ignored when the diffs are relative to the working tree.
|
||||
|
||||
|
||||
@ -632,16 +633,6 @@ This plugin is for showing changes between the buffer and the index (and staging
|
||||
|
||||
Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column.
|
||||
|
||||
> Why are the colours in the preview window weird?
|
||||
|
||||
Probably because your colourscheme doesn't configure the `diff{Added,Changed,Removed}` highlight groups. Try this in `after/syntax/diff.vim`:
|
||||
|
||||
```viml
|
||||
highlight link diffAdded DiffAdd
|
||||
highlight link diffChanged DiffChange
|
||||
highlight link diffRemoved DiffDelete
|
||||
```
|
||||
|
||||
> What happens if I also use another plugin which uses signs (e.g. Syntastic)?
|
||||
|
||||
You can configure whether GitGutter preserves or clobbers other signs using `g:gitgutter_sign_allow_clobber`. Set to `1` to clobber other signs (default on Vim >= 8.1.0614 and NeoVim >= 0.4.0) or `0` to preserve them.
|
||||
|
Reference in New Issue
Block a user