Good thing you got the accepted answer, I just mentioned another trick for writing a macro, so you can have q: in the macro:
You can press :ctrl-f , or if you really love q: you can:
eg:
let @q='5j5kq:<cv><up><cv><enter>j'
5j5k does nothing, for example.
200@q will execute the last command for the next 200 lines. If your last command passes some arguments, for example, the current line number or the current line (text) to the function. he will work too.
If you want to edit the command line in a macro, you need to press the key sequence before <cv><enter> .
for <cv><up><cv><enter> , you really need to enter such text, not plain text.
but, from my point of view, these tricks are not needed for ordinary tasks.
source share