-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Allow keys to be mapped to sequences of commands #589
Conversation
One design question I have (that I'm not sure we actually need to resolve in this PR) is how things like this should interact with the undo system. Specifically, if I bind a sequence of edit commands to a key, I think I would probably expect that to get pushed onto the undo stack as a single item. The same applies to e.g. custom commands written in a plugin or in a future possibly-lisp-based config file. (Edit: and also macros. And there may be further things that just aren't coming to mind at the moment.) Again, we may not actually need to resolve this question in this PR. Commands sequences are only intended as a stop-gap solution anyway, so I think it's okay if there's a little jank to them. But I wanted to raise the question anyway since it's at least related. |
@cessen Yeah, I agree that it should be added to undo history as a single entry. But how would I go about doing that? |
Since this is a stop-gap solution, I don't know if it's actually important to figure out before merging this PR. I mainly mentioned it just to plant the thought. |
Okay, so other than that, I think there's only this left before this PR is ready? |
If we were to address the undo behaviour, would it work to have |
I would skip the undo behavior right now but this should be doable by either composing into a previous transaction in history, or accumulating changes before calling append_changes_to_history in a similar vein to insert mode. |
Can you add an usage example to |
This allows the user to use keymappings like this in
config.toml
in order to bind to a sequence of commands: