From b5b2192256c040970da36705ae6a43c8dc65ccb9 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Mon, 9 Mar 2026 11:21:32 -0300 Subject: [PATCH] fix: undo inserting 'zv' when used via in insert mode --- autoload/repeat.vim | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/autoload/repeat.vim b/autoload/repeat.vim index 364d311..8206ed1 100644 --- a/autoload/repeat.vim +++ b/autoload/repeat.vim @@ -123,10 +123,18 @@ function! repeat#errmsg() return s:errmsg endfunction +function! repeat#wrapped(command, count) + execute 'normal! ' . (a:count ? a:count : '') . a:command + if g:repeat_tick == b:changedtick + let g:repeat_tick = b:changedtick + endif + if &foldopen =~# 'undo\|all' + normal! zv + endif +endfunction + function! repeat#wrap(command,count) - let foldopen = &foldopen =~# 'undo\|all' ? 'zv' : '' - let preserve = g:repeat_tick == b:changedtick ? ":let g:repeat_tick = b:changedtick\r" : '' - return (a:count ? a:count : '') . a:command . preserve . foldopen + return printf(":\call repeat#wrapped(%s, %d)\", string(a:command), a:count) endfunction nnoremap (RepeatDot) :if !repeat#run(v:count)echoerr repeat#errmsg()endif