-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
vim: Add support for temporary normal mode (ctrl-o) within insert mode #19454
Conversation
Thanks for this! I am amazed how little code gets such a large % of this feature right. If you'd like to pair with me on getting this over the line feel free to book time here: https://calendly.com/conradirwin/pairing. I did some looking into how vim works, thoughts below: We can't rely on any We could possibly narrow it down to make it more robust, but I think we should instead try and keep the detection a little more explicit. It looks like there are roughly four main categories of things that might happen after
We can detect each differently:
Edge cases in the current implementation I think we should fix and add tests for:
There are a few other feature interactions to think about:
The final thing to do is to update the mode indicator to show "(insert)" before the mode name :D. |
Thanks for the lengthy response! Schedueled a pair-session the 5th, sadly couldn't find a time that fit me sooner but on the other hand it will give me more time to look into the current edge cases as well as getting more familiar with the codebase. Will iterate on the current implementation in the meanwhile, thanks again :) |
8a3750d
to
3bde3c6
Compare
This commit adds the action as well as the temp_mode bool to the Vim struct.
Temporary normal mode will now be exited after one normal motion.
Temporary normal will now exit when the mode is switched (unless its a visual mode).
A prefix will now be prepended to the mode indicator when temporary normal mode is activated.
81afa62
to
72f736e
Compare
@ConradIrwin Added a visual test (which was good because it doesn't work after yesterdays changes). Will look at it later and see if I can figure out what's wrong but my best guess is that the second ctrl-o is somehow cancelled. (When testing I had to run ctrl-o twice to get back into temporary normal mode). |
7f78181
to
f89ef10
Compare
c84324a
to
6ce6045
Compare
@ConradIrwin Was able to fix both the visual test (that I added) and the failing replay test (it was due to blocking repeating replays/repeats). All tests are passing now. |
Support has been added for the ctrl-o command within insert mode. Ctrl-o is used to partially enter normal mode for 1 motion to then return back into insert mode.
Release Notes:
ctrl-o
in insert mode to enter temporary normal mode