tpope / vim-repeat

repeat.vim: enable repeating supported plugin maps with "."
http://www.vim.org/scripts/script.php?script_id=2136
2.59k stars 81 forks source link

Status messages turn into stack traces. #38

Open orlp opened 9 years ago

orlp commented 9 years ago

Let's say we entered a non-existing pattern and press n. This produces a simple clean status message:

E486: Pattern not found: \vfoobar

However if we'd do the same through vim-repeat (:call repeat#set("n")<CR>.) we get an ugly stack trace:

Error detected while processing function repeat#run:
line   17:
E486: Pattern not found: \vfoobar
Press ENTER or type command to continue

Reproduction steps:

$ wget https://raw.githubusercontent.com/tpope/vim-repeat/master/autoload/repeat.vim
$ vim -u NONE
:set nocompatible
:source repeat.vim
/foobar
:call repeat#set("n")
.
tpope commented 9 years ago

n is a motion, not a change. . would never repeat an n on its own. Why are you passing it to repeat#set()?

orlp commented 9 years ago

This is a minimalized example. I stumbled upon this because I am using n within a bigger mapping that changes the match the cursor is on and move to the next match, or moves to the next match if the cursor is currently not on a match and do nothing else. This is a demo:

quick-replace demo

This is a regression by the way, for example vim-repeat at this commit didn't have this issue. I haven't confirmed yet whether this is the latest commit where it worked properly, still working on narrowing it down.

orlp commented 9 years ago

I did some more experimenting, and it seems that this commit introduced this bug.