Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement #mapping#MapUntilTimeout #221

Open
dbarnett opened this issue Mar 21, 2020 · 0 comments · May be fixed by #222
Open

Implement #mapping#MapUntilTimeout #221

dbarnett opened this issue Mar 21, 2020 · 0 comments · May be fixed by #222

Comments

@dbarnett
Copy link
Contributor

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>
@dbarnett dbarnett self-assigned this Mar 21, 2020
dbarnett added a commit that referenced this issue Mar 23, 2020
dbarnett added a commit that referenced this issue Mar 23, 2020
@dbarnett dbarnett linked a pull request Mar 23, 2020 that will close this issue
dbarnett added a commit that referenced this issue Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant