mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Add a note about unstaging staged changes.
This commit is contained in:
20
README.mkd
20
README.mkd
@@ -110,6 +110,8 @@ You can stage or revert an individual hunk when your cursor is in it:
|
|||||||
* stage the hunk with `<Leader>hs` or
|
* stage the hunk with `<Leader>hs` or
|
||||||
* revert it with `<Leader>hr`.
|
* revert it with `<Leader>hr`.
|
||||||
|
|
||||||
|
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).
|
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-undo:
|
||||||
@@ -281,6 +283,24 @@ Add `let g:gitgutter_highlight_lines = 1` to your `~/.vimrc`.
|
|||||||
|
|
||||||
### FAQ
|
### FAQ
|
||||||
|
|
||||||
|
> Why can't I unstage staged changes?
|
||||||
|
|
||||||
|
Unstaging staged hunks is feasible but not quite as easy as it sounds. There are three relevant versions of a file at any one time:
|
||||||
|
|
||||||
|
1. The version at HEAD in the repo.
|
||||||
|
2. The version staged in the index.
|
||||||
|
3. The version in the working tree, in your vim buffer.
|
||||||
|
|
||||||
|
`git-diff` without arguments shows you how 3 and 2 differ; this is what vim-gitgutter shows too.
|
||||||
|
|
||||||
|
`git-diff --staged` shows you how 2 and 1 differ.
|
||||||
|
|
||||||
|
Let's say your are looking at a file in vim which has some unstaged changes. Now you stage a hunk, either via vim-gitgutter or another means. The hunk is no longer marked in vim-gitgutter because it is the same in 3 and 2.
|
||||||
|
|
||||||
|
Now you want to unstage that hunk. To see it, you need the difference between 2 and 1. For vim-gitgutter to shows those differences, it would need to show you 2 instead of 3 in your vim buffer. But 2 is virtual so vim-gitgutter would need to handle it without touching 3.
|
||||||
|
|
||||||
|
I intend to implement this but I can't commit to any deadline.
|
||||||
|
|
||||||
> Why are the colours in the sign column weird?
|
> Why are the colours in the sign column weird?
|
||||||
|
|
||||||
Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column.
|
Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column.
|
||||||
|
|||||||
Reference in New Issue
Block a user