Vim - how to record a macro 

To record a macro in Vim:

when in command mode


now is recording

perform steps

q to stop recording (you must be in command mode, not insert mode)

to use macro (again you must be in command mode)

@ m (without the space)

(m is the macro identifier and can be any other letter)

to perform macro 3 times

3@ m


[Tip: think ahead and make sure to, for instance, move to the next line so you can perform the macro twenty times without interfering]

Vim - how to record a macro 

@dublinux Macros make you feel outrageously powerful, be careful haha!

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!