mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Enable . command to work with staging/reverting hunks.
This commit is contained in:
@@ -109,6 +109,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`.
|
||||||
|
|
||||||
|
The `.` command will work with both these if you install [https://github.com/tpope/vim-repeat](repeat.vim).
|
||||||
|
|
||||||
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:
|
||||||
|
|
||||||
```viml
|
```viml
|
||||||
|
|||||||
@@ -164,6 +164,8 @@ function! gitgutter#stage_hunk()
|
|||||||
|
|
||||||
" refresh gitgutter's view of buffer
|
" refresh gitgutter's view of buffer
|
||||||
silent execute "GitGutter"
|
silent execute "GitGutter"
|
||||||
|
|
||||||
|
silent! call repeat#set("\<Plug>GitGutterStageHunk", -1)<CR>
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -181,6 +183,8 @@ function! gitgutter#revert_hunk()
|
|||||||
|
|
||||||
" reload file
|
" reload file
|
||||||
silent edit
|
silent edit
|
||||||
|
|
||||||
|
silent! call repeat#set("\<Plug>GitGutterRevertHunk", -1)<CR>
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user