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

Refactor Mode API and implement v_CTRL-O #1078

Merged
merged 16 commits into from
Jan 10, 2025

Conversation

citizenmatt
Copy link
Member

This PR implements v_CTRL-O. That is, pressing <C-O> in Select mode will switch to Visual for the duration of a single command. This can be a motion, in which case we switch back to Select, or an operator, which usually removes the selection and so switches to Normal.

The implementation led to refactoring Mode, specifically how to represent the mode to return to. Adding a ReturnTo.SELECT singleton object would require updates to various when statements that need to convert ReturnTo to a Mode, and there are some transitions to Select that don't make sense, and would either require guessing the selection type, or throwing a runtime error. It is simpler and cleaner to just use Mode as the "return to" type.

This PR also updates the text in the "show mode" widget to show the pending modes, e.g. "(insert) NORMAL", "(replace) VISUAL" and so on.

@citizenmatt citizenmatt changed the title Refractor Mode and implement v_CTRL-O Refactor Mode API and implement v_CTRL-O Jan 2, 2025
@AlexPl292
Copy link
Member

Yay, this looks cool! Thank you!

@AlexPl292 AlexPl292 merged commit 0b30876 into JetBrains:master Jan 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants