google / google/vim-maktaba

Implement #mapping#MapUntilTimeout

Open
#221 0 comments 0 reactions 1 assignee Claimed by @dbarnett View on GitHub
enhancement in-progress
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.