g3cko
g3cko

Reputation: 920

What mode is vim in when I press a single 'r' and is it possible to have a mapping here?

For a quick overview, I map <s-space> to <esc> so I can more easily cancel out of things without moving my hand to the escape key. For example, when I want out of insert mode, or to cancel something.

inoremap <esc> <nop> " to force me to stop using <esc>
cnoremap <esc> <nop>
nnoremap <s-space> <nop>
onoremap <s-space> <esc>
inoremap <s-space> <esc>

However, if I press 'r' vim is waiting for a character, and when I press <s-space>, I end up replacing with a space, instead of canceling the replace operation. Is it possible for mappings to work after pressing 'r' once, while waiting for a character?

Thanks!

Upvotes: 2

Views: 176

Answers (1)

Matthew Strawbridge
Matthew Strawbridge

Reputation: 20620

If you find you've accidentally pressed r, how about just tapping uu?

This will make the replacement but immediately undo it again, without you having to move your hands from the letter keys.

Upvotes: 2

Related Questions