3

I want to swap ' with ` for all combinations of commands in normal mode. I have tried the following:

nnoremap ' `
nnoremap ` '

It works for commands like '', ``, but failed for d'', y'', etc.

related question: Map 'Jump to mark line' to 'Jump to mark position'

0

1 Answer 1

3

You used nnoremap which means the mapping will only work in normal mode. d and y leave you in operator pending mode. Adding the following should solve these cases:

onoremap ' `
onoremap ` '

I'm not entirely sure whether this will have any undesired side effects though.

2
  • thank you, these solved my problem: onoremap ' ` onoremap ` ' nnoremap ' ` nnoremap ` ' vnoremap ' ` vnoremap ` '
    – pdg
    Jun 8, 2017 at 12:46
  • 1
    If you also want to remap in visual mode you might consider using noremap which maps normal, visual, select and operator-pending modes.
    – Octaviour
    Jun 8, 2017 at 12:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.