From 6b8e908cc927047d4e3d9b179d112dddd586da09 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Wed, 14 Jan 2015 10:40:43 +0100 Subject: [PATCH] Enable `.` command to work with staging/reverting hunks. --- README.mkd | 2 ++ autoload/gitgutter.vim | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/README.mkd b/README.mkd index 4632944..72df88d 100644 --- a/README.mkd +++ b/README.mkd @@ -109,6 +109,8 @@ You can stage or revert an individual hunk when your cursor is in it: * stage the hunk with `hs` or * revert it with `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: ```viml diff --git a/autoload/gitgutter.vim b/autoload/gitgutter.vim index 6116a95..a37a584 100644 --- a/autoload/gitgutter.vim +++ b/autoload/gitgutter.vim @@ -164,6 +164,8 @@ function! gitgutter#stage_hunk() " refresh gitgutter's view of buffer silent execute "GitGutter" + + silent! call repeat#set("\GitGutterStageHunk", -1) endif endfunction @@ -181,6 +183,8 @@ function! gitgutter#revert_hunk() " reload file silent edit + + silent! call repeat#set("\GitGutterRevertHunk", -1) endif endfunction