I use ci', va" pretty often, I would like to map text-object keys like " ' to more accessible keys like m, n since writing cin, vam is much easier than ci' va".

I tried the following

vmap am a"
vmap im i"

omap am a"
omap im i"

vmap an a'
vmap in i'

omap an a'
omap in i'

But it doesn't seem to work. How can I achieve this?

  • Wait! Your keybindings do work for me. Are you sure your vim instance has taken the keybindings? What does :map am outputs?
    – 3N4N
    Sep 24, 2022 at 15:11
  • @kadekai It works when I only map one key like :omap am a" but for some reason it doesn't work when I map both m and n. I guess I need to read more manual pages
    – ytkimirti
    Sep 24, 2022 at 16:39

1 Answer 1

xnoremap im :<C-u>normal! T"vt"<CR>
onoremap im :normal vi"<CR>
xnoremap in :<C-u>normal! T'vt'<CR>
onoremap in :normal vi'<CR>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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