In normal mode (in Vim) if the cursor is on a number, hitting Ctrl–A increments the number by 1. Now I want to do the same thing, but from the command line. Specifically, I want to go to certain lines whose first character is a number, and increment it, i.e., I want to run the following command:
:g/searchString/ Ctrl-A
I tried to store Ctrl–A in a macro (say a), and using :g/searchString/ @a, but I get an error:
E492: Not an editor command ^A
Any suggestions?
You have to use
normalto execute normal mode commands in command mode:Note that you have to press Ctrl–VCtrl–A to get the
^Acharacter.