- start the recording
qq
- do your stuff ...
- stop the recording
q
- open the
vimrc
file:e /path/to/vim/c
:reg q
→ prints the registers content - paste the macro in a function by moving the cursor to the right position, change to
NORMAL
mode, enter"qp
to paste the content from the register qfunction A() normal /\d <=== the macro endfunction
- run the macro when opening a file
vim -u /path/to/vimrc +":call A()" /mapth/to/file
Last active
April 24, 2022 14:12
-
-
Save roymanigley/91df8449975bef3ad14dc93b8a65e073 to your computer and use it in GitHub Desktop.
How to record a macro on VIM and reuse it in a function
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment