I want to end up in insert mode after a macro. Is there a way to do that?
Yes! You can stop recording a macro using Ctrl+O, q (Ctrl+O is a sequence to enter a single Normal-mode command from Insert mode, see :help i_CTRL-O
.) This will result In a macro that, when replayed, will leave you in Insert mode, after inserting any characters you have inserted as part of recording it.
Can macros be edited?
Yes. Macros are simply stored into regular Vim registers, so any operations you do on Vim registers can be used to edit macros.
For example, if you have a macro @a
that finds the next occurrence of "foo"
and replaces it with $
and you would like to update that macro to also issue an a
command to start appending after the $
, you can use:
:let @a .= 'a'
See :help :let-@
for using the :let
command to modify registers and :help expr-.
for the .
string concatenation operator (used as .=
here to assign back to the same register.)