mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-11 11:23:49 -05:00
Fix normal-mode repeat affected by visual-mode operator
This commit is contained in:
@@ -29,6 +29,8 @@ let g:loaded_easy_align_plugin = 1
|
|||||||
command! -nargs=* -range -bang EasyAlign <line1>,<line2>call easy_align#align('<bang>' == '!', 0, '', <q-args>)
|
command! -nargs=* -range -bang EasyAlign <line1>,<line2>call easy_align#align('<bang>' == '!', 0, '', <q-args>)
|
||||||
command! -nargs=* -range -bang LiveEasyAlign <line1>,<line2>call easy_align#align('<bang>' == '!', 1, '', <q-args>)
|
command! -nargs=* -range -bang LiveEasyAlign <line1>,<line2>call easy_align#align('<bang>' == '!', 1, '', <q-args>)
|
||||||
|
|
||||||
|
let s:last_command = 'EasyAlign'
|
||||||
|
|
||||||
function! s:generic_easy_align_op(type, vmode, live)
|
function! s:generic_easy_align_op(type, vmode, live)
|
||||||
let sel_save = &selection
|
let sel_save = &selection
|
||||||
let &selection = "inclusive"
|
let &selection = "inclusive"
|
||||||
@@ -49,9 +51,13 @@ function! s:generic_easy_align_op(type, vmode, live)
|
|||||||
|
|
||||||
try
|
try
|
||||||
if get(g:, 'easy_align_need_repeat', 0)
|
if get(g:, 'easy_align_need_repeat', 0)
|
||||||
execute "'<,'>". g:easy_align_last_command
|
execute "'<,'>". s:last_command
|
||||||
else
|
else
|
||||||
'<,'>call easy_align#align('<bang>' == '!', a:live, vmode, '')
|
'<,'>call easy_align#align('<bang>' == '!', a:live, vmode, '')
|
||||||
|
" Currently visual-mode operator is not repeatable
|
||||||
|
if !a:vmode
|
||||||
|
let s:last_command = g:easy_align_last_command
|
||||||
|
endif
|
||||||
end
|
end
|
||||||
silent! call repeat#set("\<Plug>(EasyAlignRepeat)")
|
silent! call repeat#set("\<Plug>(EasyAlignRepeat)")
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -1545,6 +1545,23 @@ Expect:
|
|||||||
bbb = 3
|
bbb = 3
|
||||||
aaaa = 4
|
aaaa = 4
|
||||||
|
|
||||||
|
Do (Visual-mode operator is not repeatable and shouldn't affect normal-mode repeat):
|
||||||
|
\<Space>Aj=
|
||||||
|
3G
|
||||||
|
Vj\<Enter>\<Enter>=
|
||||||
|
7G
|
||||||
|
.
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
a = 1
|
||||||
|
bb = 2
|
||||||
|
ccc = 3
|
||||||
|
dddd = 4
|
||||||
|
|
||||||
|
d = 1
|
||||||
|
cc = 2
|
||||||
|
bbb = 3
|
||||||
|
aaaa = 4
|
||||||
###########################################################
|
###########################################################
|
||||||
Execute:
|
Execute:
|
||||||
Restore
|
Restore
|
||||||
|
|||||||
Reference in New Issue
Block a user