1

Is there a way to trigger a certain short mapping i.e. \c without waiting to see if there is a longer one that starts with the same characters (effectively disabling all other overlapping mappings)?

1 Answer 1

5

Yes, you can use the <nowait> modifier. See here, copied from the documentation:

                        *:map-<nowait>* *:map-nowait*
When defining a buffer-local mapping for "," there may be a global mapping
that starts with ",".  Then you need to type another character for Vim to know
whether to use the "," mapping or the longer one.  To avoid this add the
<nowait> argument.  Then the mapping will be used when it matches, Vim does
not wait for more characters to be typed.  However, if the characters were
already typed they are used.

Note: this is not limited to buffer-local mappings, but it might effectively disable all the longer mappings, so use with care.

1
  • Note also that this is not limited to neovim and works in older versions of vim (7.4)
    – perelo
    Oct 25, 2019 at 12:29

Your Answer

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

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