Stage part of any hunk.

See #279.
This commit is contained in:
Andy Stewart
2019-08-13 15:57:22 +01:00
parent a5ee9f2f11
commit b036fcf527
4 changed files with 147 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ Features:
* Never saves the buffer.
* Quick jumping between blocks of changed lines ("hunks").
* Stage/undo/preview individual hunks.
* Stage partial hunks.
* Provides a hunk text object.
* Diffs against index (default) or any commit.
* Allows folding all unchanged text.
@@ -187,11 +188,18 @@ You can stage or undo an individual hunk when your cursor is in it:
* stage the hunk with `<Leader>hs` or
* undo it with `<Leader>hu`.
You can stage part of an additions-only hunk by:
To stage part of an additions-only hunk by:
* either visually selecting the part you want and staging with your mapping, e.g. `<Leader>hs`;
* or using a range with the `GitGutterStageHunk` command, e.g. `:42,45GitGutterStageHunk`.
To stage part of any hunk:
* preview the hunk, e.g. `<Leader>hp`;
* move to the preview window, e.g. `:wincmd P`;
* delete the lines you do not want to stage;
* stage the remaining lines, e.g. `<Leader>hs` or `:GitGutterStageHunk`.
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).