From a89a4d0760240e8b9ef6fd272b1f3f9da769d530 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 7 Jul 2024 15:08:09 -0400 Subject: [PATCH] Avoid stacktrace on undo in 'nomodifiable' buffer References: https://github.com/tpope/vim-repeat --- autoload/repeat.vim | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/autoload/repeat.vim b/autoload/repeat.vim index a7a6919..1144f60 100644 --- a/autoload/repeat.vim +++ b/autoload/repeat.vim @@ -125,16 +125,13 @@ endfunction function! repeat#wrap(command,count) let preserve = (g:repeat_tick == b:changedtick) - call feedkeys((a:count ? a:count : '').a:command, 'ntix') - if preserve - let g:repeat_tick = b:changedtick - endif + return (a:count ? a:count : '') . a:command . (preserve ? ":let g:repeat_tick = b:changedtick\r" : '') endfunction nnoremap (RepeatDot) :if !repeat#run(v:count)echoerr repeat#errmsg()endif -nnoremap (RepeatUndo) :call repeat#wrap('u',v:count) -nnoremap (RepeatUndoLine) :call repeat#wrap('U',v:count) -nnoremap (RepeatRedo) :call repeat#wrap("\C-R>",v:count) +nmap