diff --git a/plugin/easy_align.vim b/plugin/easy_align.vim index a25dd21..52cd5bb 100644 --- a/plugin/easy_align.vim +++ b/plugin/easy_align.vim @@ -55,7 +55,6 @@ function! s:generic_easy_align_op(type, vmode, live) end silent! call repeat#set("\(EasyAlignRepeat)") finally - unlet! g:easy_align_need_repeat let &selection = sel_save endtry endfunction @@ -68,14 +67,22 @@ function! s:live_easy_align_op(type, ...) call s:generic_easy_align_op(a:type, a:0, 1) endfunction +function! s:easy_align_repeat() + try + let g:easy_align_need_repeat = 1 + normal! . + finally + unlet! g:easy_align_need_repeat + endtry +endfunction + nnoremap (EasyAlign) :set opfunc=easy_align_opg@ vnoremap (EasyAlign) :call easy_align_op(visualmode(), 1) nnoremap (LiveEasyAlign) :set opfunc=live_easy_align_opg@ vnoremap (LiveEasyAlign) :call live_easy_align_op(visualmode(), 1) " vim-repeat support -nnoremap (EasyAlignRepeat) :let g:easy_align_need_repeat = 1. -vnoremap (EasyAlignRepeat) :let g:easy_align_need_repeat = 1gv. +nnoremap (EasyAlignRepeat) :call easy_align_repeat() " Backward-compatibility (deprecated) nnoremap (EasyAlignOperator) :set opfunc=easy_align_opg@