So, I was trying to write a Vim macro and the macro @p
I registered below includes a cc
shortcuts which deletes a line. The macro is as follows.
" macro @p
qp
cc{<ESC>j@eA,<ESC>j@ejcc},<ESC>
q
When I run the macro @p
itself, it works just fine.
" macro @q
qq
@pj
q
However, when I registered another macro @q
that uses macro @p
, and try to repeat macro @q
until the end of file by using :999@q
, it says
E42: No errors: cc
and I have no idea why this isn't working.
I realize this has to do with Quick fix command, and found that there is :cc
command in quickfix.txt
. I doubt that my problem derives from here.(Because the shortcut for deleting line in Vim is the same as the shortcut for quick fix as cc
.
Is Quick fix the reason why I get the E42: No errors: cc
?
How can I fix the problem? Just so you know, I am using MAC OS and neovim.
When you do:
the macro
@q
is expanded, so you are actually doing:in which the macro
@p
is also expanded, so you are actually doing:(and then there is the macro
@e
that is missing from your question, so you eventually end up doing something else we can't really know).At this point it should be obvious that the normal mode
cc
from@p
is executed as command-line mode:999cc
, which throws an error because you don't have a quickfix list with at least 999 entries.The problem is thus that you are executing a normal mode macro in command-line mode. Doing
999@q
in normal mode (note the missing:
) should fix your problem.