1

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'

1

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.

| improve this answer | |
  • thank you, these solved my problem: onoremap ' ` onoremap ` ' nnoremap ' ` nnoremap ` ' vnoremap ' ` vnoremap ` ' – pdg Jun 8 '17 at 12:46
  • 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 '17 at 12:58

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