-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
Description
Maktaba should define a maktaba#mapping#MapUntilTimeout helper to be able to create short-lived mappings that only last until the 'timeout' period expires, so they'll handle certain keypresses only if they happen immediately after something else.
This allows you to define "ambiguous" mappings and prefixes intelligently so a mapping can take immediate action but "change its mind" and take further action if you keep pressing keys.
For example, I've defined this mapping in my vimrc to unfold one level if you press z> or all levels if you press z>>, but with the z> taking effect immediately after pressing it:
nnoremap z> zr:call maktaba#mapping#MapUntilTimeout('nnore', '>', 'zR')<CR>