How to convert a vim macro from "q" to "Q"?

Sometimes I accidentally enter vim recording macro mode by pressing 'q' (which I usually exit by pressing q two more times.)

What are the commands to change the key binding to start recording a macro from 'q' to 'Q'?

I can stop q from anything by setting

nnoremap q <Nop> 

but I'm not sure how to get "Q" as a shortcut to a macro entry.

+7
source share
2 answers

You can reassign Q to exit and q without a command in two command lines. For example:

 nnoremap Q q nnoremap q <Nop> 
+9
source

I prefer this option - ,q , where , there is a Leader :

 noremap <Leader>qq noremap q <Nop> 

Q in normal mode performs a standard function, switches to "Ex" mode.

+1
source

All Articles