k107
k107

Reputation: 16440

How can I remap the vim record macro key from 'q' to 'Q'?

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.

Upvotes: 14

Views: 4010

Answers (2)

dkiyatkin
dkiyatkin

Reputation: 654

I prefer this variant - ,q, where , is Leader key:

noremap <Leader>q q
noremap q <Nop>

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

Upvotes: 2

Ned Batchelder
Ned Batchelder

Reputation: 375574

You can remap Q to quit and q to no command in two command lines Like this:

nnoremap Q q
nnoremap q <Nop>

Upvotes: 18

Related Questions