fix: undo inserting 'zv' when used via <C-O> in insert mode

This commit is contained in:
Alejandro 2026-03-09 11:21:32 -03:00
parent 65846025c1
commit b5b2192256

View file

@ -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(":\<C-U>call repeat#wrapped(%s, %d)\<CR>", string(a:command), a:count)
endfunction
nnoremap <silent> <Plug>(RepeatDot) :<C-U>if !repeat#run(v:count)<Bar>echoerr repeat#errmsg()<Bar>endif<CR>