-
-
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
Issue with [keys.insert]
mappings such as j = { f = "normal_mode" }
#2612
Comments
I guess the solution would be when the next key doesn't match the keybind, instead of inserting it you check again to see if it's the start of another key combination? |
That might work but I like the current system where a key not found in a pending key sequence cancels the sequence (see here). Kakoune has an interesting way of approaching this: https://github.com/mawww/kakoune/wiki/Avoid-the-escape-key#jk-to-escape. It maps |
In vim, this type of exiting insert mode has a timeout. So, while there's a short (but configurable) inconvenience if you want to end your insertion on 'j', it's at least possible. I was a bit surprised to find that helix's helpful little keymap sequence hint window just persists indefinitely, waiting for the next key. fwiw, this is my first day with helix and I am truly delighted so far. |
This was the first (and only major) problem I've hit with Helix so far. Wonder if anyone has viable solutions for it? If the text your editing in insert mode ends with the first letter of your jj/jk/fd/kj/whatever, what do you do? E.g., I have
|
Glad to not be the only one with this issue. I use The key bound to the command get inserted in the document but if the next key executes a command then that key is removed and the command executed |
Previously, I used Neovim to use |
Have you tried nested binding like this? [keys.insert] #ⓘ
'j' = {f='normal_mode','j'={'f'=[':insert-output /bin/echo -n j','move_char_right','normal_mode']}}
# 'hij' + 'jf' cleanly exits after typing 'hij' instead of typing an extra jf
# the char movement was needed because otherwise you end up 1 char left with insert and with append-output at the end of the line you get an insert at the wrong line (though this is missing a proper text insertion API, check #2797)
that's also bad The proper way to do this type of switching is like this:
(as implemented in https://github.com/NeoVintageous/NeoVintageous) See this short demo modelInsertExit.movAlthough an even better solution would be to have an on-hold functionality since you'd not use that in regular typing, so you don't have this conflict in the first place, then you could have a clean
just like you can have the same with other modes (though this suggestion was unfortunately shot down #1494) |
Another workaround is to use a good keyboard remapping tool (like Karabiner on a Mac) to implement the workaround I use for the lack of on-hold functionality: basically, make some key like i
However, this is limited by:
(you can also do it for a key chord like jf, but I think it's more bug-prone due to the aforementioned limitations) Mac example: [keys.insert] #ⓘ
'A-}' = 'normal_mode' # some unused inconvenient shortcut, ideally free in any mode Goku Karabiner config snippet :applications {:wezterm ["^com\\.github\\.wez\\.wezterm$"]}
:main [
{:des " 🠿i⃣ ⟶ Normal Mode ⇧⎇] (@WezTerm instead of @Helix)" :rules [:wezterm
[:i nil nil
{:alone {:key :i :halt true} :delayed{:canceled[:i]} :held{:key :⇧⎇】 :repeat false}
:params{:alone 254 :held 255 :delay 255} }]
]}
] |
Is there any opposition from the maintainers to having proper support for this? It's a dealbreaker for me to use Helix, but I'm happy to try to implement it if it's desired. |
Summary
I'm using
jf
to exit insert mode. When I insert anything that ends withj
(notjj
) and try to exit insert mode withjf
I end up insertingjf
and remain ininsert
mode. To overcome this I usually end up pressing escape key twice to exit insert mode which is not ideal.Reproduction Steps
context:
I'm using
jf
to exit insert mode.I tried this:
hij
and exit insert mode withjf
I expected this to happen:
hij
and end up in normal modeInstead, this happened:
hijjf
and end up ininsert
modeHelix log
No response
Platform
Linux
Terminal Emulator
gnome terminal
Helix Version
helix 22.03 (d4e45fd)
The text was updated successfully, but these errors were encountered: