mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-10 20:43:47 -05:00
Use "undo" instead of "revert" for discarding a hunk.
"Undo" is a better name than "revert" because: - "revert" sounds like it has something to do with `git-revert` but they are entirely different; - "undo" is consistent with vim's "undo": discarding changes and going back to the original. Maintain backwards compatibility and add deprecation warnings. Closes #306.
This commit is contained in:
16
README.mkd
16
README.mkd
@@ -1,6 +1,6 @@
|
||||
## vim-gitgutter
|
||||
|
||||
A Vim plugin which shows a git diff in the 'gutter' (sign column). It shows whether each line has been added, modified, and where lines have been removed. You can also stage and revert individual hunks.
|
||||
A Vim plugin which shows a git diff in the 'gutter' (sign column). It shows whether each line has been added, modified, and where lines have been removed. You can also stage and undo individual hunks.
|
||||
|
||||
Features:
|
||||
|
||||
@@ -8,7 +8,7 @@ Features:
|
||||
* Neovim: runs the diffs asynchronously.
|
||||
* Ensures signs are always as up to date as possible (but without running more than necessary).
|
||||
* Quick jumping between blocks of changed lines ("hunks").
|
||||
* Stage/revert/preview individual hunks.
|
||||
* Stage/undo/preview individual hunks.
|
||||
* Diffs against index (default) or any commit.
|
||||
* Handles line endings correctly, even with repos that do CRLF conversion.
|
||||
* Optional line highlighting.
|
||||
@@ -61,7 +61,7 @@ If you are on Windows you may find the command prompt pops up briefly every time
|
||||
|
||||
When you make a change to a file tracked by git, the diff markers should appear automatically. The delay is governed by vim's `updatetime` option; the default value is 4 seconds but I suggest reducing it to around 250ms (add `set updatetime=250` to your vimrc).
|
||||
|
||||
You can jump between hunks with `[c` and `]c`. You can preview, stage, and revert hunks with `<leader>hp`, `<leader>hs`, and `<leader>hr` respectively.
|
||||
You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo hunks with `<leader>hp`, `<leader>hs`, and `<leader>hu` respectively.
|
||||
|
||||
You cannot currently unstage a staged hunk.
|
||||
|
||||
@@ -112,20 +112,20 @@ nmap ]h <Plug>GitGutterNextHunk
|
||||
nmap [h <Plug>GitGutterPrevHunk
|
||||
```
|
||||
|
||||
You can stage or revert an individual hunk when your cursor is in it:
|
||||
You can stage or undo an individual hunk when your cursor is in it:
|
||||
|
||||
* stage the hunk with `<Leader>hs` or
|
||||
* revert it with `<Leader>hr`.
|
||||
* undo it with `<Leader>hu`.
|
||||
|
||||
See the FAQ if you want to unstage staged changes.
|
||||
|
||||
The `.` command will work with both these if you install [repeat.vim](https://github.com/tpope/vim-repeat).
|
||||
|
||||
To set your own mappings for these, for example if you prefer the mnemonics hunk-add and hunk-undo:
|
||||
To set your own mappings for these, for example if you prefer the mnemonics hunk-add and hunk-revert:
|
||||
|
||||
```viml
|
||||
nmap <Leader>ha <Plug>GitGutterStageHunk
|
||||
nmap <Leader>hu <Plug>GitGutterRevertHunk
|
||||
nmap <Leader>hr <Plug>GitGutterUndoHunk
|
||||
```
|
||||
|
||||
And you can preview a hunk's changes with `<Leader>hp`. You can of course change this mapping, e.g:
|
||||
@@ -273,7 +273,7 @@ To disable all key mappings:
|
||||
let g:gitgutter_map_keys = 0
|
||||
```
|
||||
|
||||
See above for configuring maps for hunk-jumping and staging/reverting.
|
||||
See above for configuring maps for hunk-jumping and staging/undoing.
|
||||
|
||||
|
||||
#### Use a custom `grep` command
|
||||
|
||||
Reference in New Issue
Block a user