Sometimes I accidentally enter vim's record macro mode by pressing 'q' (which I usually get out of by pressing q two more times.)
What are the commands to change the keybinding to start recording a macro from 'q' to 'Q'?
I can stop 'q' from doing anything by setting
nnoremap q <Nop>
but I'm not sure how to get 'Q' to be the record macro shortcut.
As you yank , delete , or create macros in vim, it automatically stores text into these registers. When you hit p paste it's simply pasting in the default register. You can also paste in any other register by hitting "qp where q is the register that you want to paste in.
Recording is a really useful feature of Vim. It records everything you type. You can then replay it simply by typing @ <letter> . Record search, movement, replacement...
To record a macro and save it to a register, type the key q followed by a letter from a to z that represents the register to save the macro, followed by all commands you want to record, and then type the key q again to stop the recording.
You can remap Q to quit and q to no command in two command lines Like this:
nnoremap Q q
nnoremap q <Nop>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With