From 62387b78e09daf98b7c1a18b996401771f7ed181 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 5 Dec 2013 13:36:01 +0900 Subject: [PATCH] Fix normal-mode repeat affected by visual-mode operator --- plugin/easy_align.vim | 8 +++++++- test/interactive.vader | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/plugin/easy_align.vim b/plugin/easy_align.vim index 52cd5bb..986f0fe 100644 --- a/plugin/easy_align.vim +++ b/plugin/easy_align.vim @@ -29,6 +29,8 @@ let g:loaded_easy_align_plugin = 1 command! -nargs=* -range -bang EasyAlign ,call easy_align#align('' == '!', 0, '', ) command! -nargs=* -range -bang LiveEasyAlign ,call easy_align#align('' == '!', 1, '', ) +let s:last_command = 'EasyAlign' + function! s:generic_easy_align_op(type, vmode, live) let sel_save = &selection let &selection = "inclusive" @@ -49,9 +51,13 @@ function! s:generic_easy_align_op(type, vmode, live) try if get(g:, 'easy_align_need_repeat', 0) - execute "'<,'>". g:easy_align_last_command + execute "'<,'>". s:last_command else '<,'>call easy_align#align('' == '!', a:live, vmode, '') + " Currently visual-mode operator is not repeatable + if !a:vmode + let s:last_command = g:easy_align_last_command + endif end silent! call repeat#set("\(EasyAlignRepeat)") finally diff --git a/test/interactive.vader b/test/interactive.vader index 737d354..d665b97 100644 --- a/test/interactive.vader +++ b/test/interactive.vader @@ -1545,6 +1545,23 @@ Expect: bbb = 3 aaaa = 4 +Do (Visual-mode operator is not repeatable and shouldn't affect normal-mode repeat): + \Aj= + 3G + Vj\\= + 7G + . + +Expect: + a = 1 + bb = 2 + ccc = 3 + dddd = 4 + + d = 1 + cc = 2 + bbb = 3 + aaaa = 4 ########################################################### Execute: Restore