Advanced keybinding combo support to exit vim insert mode regardless of layouts and without impacting typing #40363
eugenesvk
started this conversation in
Config, Settings and Keymaps
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When you need to exit Vim's insert mode, you either press Escape, which is a very inconvenient key, so you'd have to use some other OS trick to move it closer.
Or you use some sequence like
jk, which is also bad because now you can't typejkliterally, which is especially bad if you use another language where these physical keys represent a more common combination used in actual words.A better solution would be to instead of having a "lazy sequence" like
jkwhich breaks typing to use a sequence of movements that you'll never type using the same keys:jfor 0.X seconds to exit (though this isn't instant, so not the best option)jand press+releasek(while typing you'll releasejbefore releasingk, so it's not a conflict). Think this is the least error-prone optionjandk(in any order, timing is key here, should be user configurable). Will require effort to set a low enough threshold to avoid conflicts with typingThis is what advanced rebinding solutions like home row mods with QMK use. But then those require external apps, and those apps don't know what mode Zed is in, so you have a conflict with normal mode where you don't want the mode exit effect to be work, and then you'd need to write a plugin to signal mode changes to them, so it's complicated...
Also if this existed internally, you could use all the cool context combos implemented in Zed for interesting features like
fand pressj/kin Insert mode to move cursor down/up (for quick movements so you don't need to even change modes. Or you could even use it in non-modal editing)fand pressj/kin Search field to go to next/previous matchfand pressj/kwhen top-level Menu is active to go donw/up in the menu list (and pressato activate the selected menu)zafor code folding) you could holdzand pressathen pressaagain without having to repeat the comboBeta Was this translation helpful? Give feedback.
All reactions