Implement #mapping#MapUntilTimeout
- Dominant language
- Vim Script
- Stars
- 588
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
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:
```vim
nnoremap z> zr:call maktaba#mapping#MapUntilTimeout('nnore', '>', 'zR')
```
Contributor guide
Assessment
This issue has not been assessed yet.