I am trying to bind my keys in such a way that if I press d, then a number, and then c it deletes that number of characters, like d, number, l would do.

So for example if I press d5c it would do d5l. I could just bind all combinations, but then it would not work for for example d15c.

What would be the best way to do this?

( I am running nvim btw, may that help )

  • Welcome to Vim :-) Do you have still something open in your question? How can we help you further? Otherwise maybe could you accept one of the solutions using the v button next to the arrow voting buttons. It allow the question to rest :-) Commented Apr 25 at 14:38

1 Answer 1


I would do:

onoremap c l

The important aspect here is that after hitting d Vim is in the Operator Pending mode.

You can control the mapping in Operator Pending mode using the onoremap or the omap commands.

  • 1
    Ah, thank you. This helps! I noticed the 'Operator Pending' text instead of the usual 'Insert', 'Normal', or 'Visual' in my statusline, but this explains what it is.
    – vosjedev
    Commented Apr 25 at 15:30
  • Thank you for the feedback :-) Commented Apr 25 at 15:43

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.