0

I have a mapping for m and a mapping for m/ in the same buffer, in Normal mode.

If I type m, is there a way to tell Vim to stop waiting for the 2nd character, and to just submit the current command as-typed?

I don't want to shorten the timeout or change any other "global" behavior. I just want to have the ability to tell Vim to stop waiting for more input and accept the current command.

7
  • Are you saying you do not want to use the mapping m/ at all? Why not just unmap it?
    – Mass
    Sep 14 at 1:20
  • @Mass I want to be able to selectively tell Vim not to wait for other keys in any particular sequence of key presses, not every sequence of key presses. Sep 14 at 2:23
  • There's no such operation. Your best bet is probably to reduce the time Vim waits for you to press another key before accepting the key(s) you've already pressed.
    – B Layer
    Sep 14 at 7:57
  • Possibly use the <nowait> modifier. But I am not sure, your m/ mapping will then still work. Sep 14 at 11:57
  • 1
    That's a good workaround @Biggybi. Sep 17 at 14:14
0

The existence of the m/ mapping REQUIRES that the m mapping needs to wait for the possibility of hitting the / key before the timeout expires.

There's no way around it. If you want the m mapping to immediately execute, then it makes no sense to also expect m/ to do anything.

Vim will immediately accept whatever you already entered if what you've already entered is unambiguous. You need to eliminate the m/ mapping to make your m mapping unambiguous.

Another alternative is to change your m mapping to include a second character. Hitting two characters can faster than waiting for the timeout.

0

This appears to be impossible in general using standard key mappings. There is no functionality to tell Vim to "accept whatever I already entered" for an arbitrary sequence of inputs, at the user's discretion (i.e. without baking it into a key mapping with <nowait> or changing the timeout).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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