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
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.
-
Note also that this is not limited to neovim and works in older versions of vim (7.4)– pereloOct 25, 2019 at 12:29