-
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
Unexpected keymap befaviour in vim mode (exit insert mode on 'jk' 'jj') #14725
Comments
vybukhivka
added
admin read
Pending admin review
bug
[core label]
triage
Maintainer needs to classify the issue
labels
Jul 18, 2024
Merged
ConradIrwin
added a commit
that referenced
this issue
Jul 22, 2024
Simplify key dispatch code. Previously we would maintain a cache of key matchers for each context that would store the pending input. For the last while we've also stored the typed prefix on the window. This is redundant, we only need one copy, so now it's just stored on the window, which lets us avoid the boilerplate of keeping all the matchers in sync. This stops us from losing multikey bindings when the context on a node changes (#11009) (though we still interrupt multikey bindings if the focus changes). While in the code, I fixed up a few other things with multi-key bindings that were causing problems: Previously we assumed that all multi-key bindings took precedence over any single-key binding, now this is done such that if a user binds a single-key binding, it will take precedence over all system-defined multi-key bindings (irrespective of the depth in the context tree). This was a common cause of confusion for new users trying to bind to `cmd-k` or `ctrl-w` in vim mode (#13543). Previously after a pending multi-key keystroke failed to match, we would drop the prefix if it was an input event. Now we correctly replay it (#14725). Release Notes: - Fixed multi-key shortcuts not working across completion menu changes ([#11009](#11009)) - Fixed multi-key shortcuts discarding earlier input ([#14445](#14445)) - vim: Fixed `jk` binding preventing you from repeating `j` ([#14725](#14725)) - vim: Fixed `escape` in normal mode to also clear the selected register. - Fixed key maps so user-defined mappings take precedence over builtin multi-key mappings ([#13543](#13543)) - Fixed a bug where overridden shortcuts would still show in the Command Palette
Fixed by #14942 which will land in preview tomorrow an stable next week |
notpeter
added
vim
and removed
triage
Maintainer needs to classify the issue
admin read
Pending admin review
labels
Jul 24, 2024
CharlesChen0823
pushed a commit
to CharlesChen0823/zed
that referenced
this issue
Jul 29, 2024
Simplify key dispatch code. Previously we would maintain a cache of key matchers for each context that would store the pending input. For the last while we've also stored the typed prefix on the window. This is redundant, we only need one copy, so now it's just stored on the window, which lets us avoid the boilerplate of keeping all the matchers in sync. This stops us from losing multikey bindings when the context on a node changes (zed-industries#11009) (though we still interrupt multikey bindings if the focus changes). While in the code, I fixed up a few other things with multi-key bindings that were causing problems: Previously we assumed that all multi-key bindings took precedence over any single-key binding, now this is done such that if a user binds a single-key binding, it will take precedence over all system-defined multi-key bindings (irrespective of the depth in the context tree). This was a common cause of confusion for new users trying to bind to `cmd-k` or `ctrl-w` in vim mode (zed-industries#13543). Previously after a pending multi-key keystroke failed to match, we would drop the prefix if it was an input event. Now we correctly replay it (zed-industries#14725). Release Notes: - Fixed multi-key shortcuts not working across completion menu changes ([zed-industries#11009](zed-industries#11009)) - Fixed multi-key shortcuts discarding earlier input ([zed-industries#14445](zed-industries#14445)) - vim: Fixed `jk` binding preventing you from repeating `j` ([zed-industries#14725](zed-industries#14725)) - vim: Fixed `escape` in normal mode to also clear the selected register. - Fixed key maps so user-defined mappings take precedence over builtin multi-key mappings ([zed-industries#13543](zed-industries#13543)) - Fixed a bug where overridden shortcuts would still show in the Command Palette
kevmo314
pushed a commit
to kevmo314/zed
that referenced
this issue
Jul 29, 2024
Simplify key dispatch code. Previously we would maintain a cache of key matchers for each context that would store the pending input. For the last while we've also stored the typed prefix on the window. This is redundant, we only need one copy, so now it's just stored on the window, which lets us avoid the boilerplate of keeping all the matchers in sync. This stops us from losing multikey bindings when the context on a node changes (zed-industries#11009) (though we still interrupt multikey bindings if the focus changes). While in the code, I fixed up a few other things with multi-key bindings that were causing problems: Previously we assumed that all multi-key bindings took precedence over any single-key binding, now this is done such that if a user binds a single-key binding, it will take precedence over all system-defined multi-key bindings (irrespective of the depth in the context tree). This was a common cause of confusion for new users trying to bind to `cmd-k` or `ctrl-w` in vim mode (zed-industries#13543). Previously after a pending multi-key keystroke failed to match, we would drop the prefix if it was an input event. Now we correctly replay it (zed-industries#14725). Release Notes: - Fixed multi-key shortcuts not working across completion menu changes ([zed-industries#11009](zed-industries#11009)) - Fixed multi-key shortcuts discarding earlier input ([zed-industries#14445](zed-industries#14445)) - vim: Fixed `jk` binding preventing you from repeating `j` ([zed-industries#14725](zed-industries#14725)) - vim: Fixed `escape` in normal mode to also clear the selected register. - Fixed key maps so user-defined mappings take precedence over builtin multi-key mappings ([zed-industries#13543](zed-industries#13543)) - Fixed a bug where overridden shortcuts would still show in the Command Palette
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check for existing issues
Describe the bug / provide steps to reproduce it
I've been using neovim for a while, and get used to exit insert mode on 'j k' keymap. So this was the first thing I setup in zed, but I met a problem here. Typing 'j' in insert mode makes zed waiting for me to continue the keymap, without adding 'j' to the file, which is important. I would like zed to behave like vim here, vim also waits for me to execute the keymap, but it adds a character i pressed to the editor as well + it will remove last 'j' i typed before 'j k'. for example: when i type "hjjk" i expect to have 'hj' added to file and exit insert mode
here is the recoding of me typing "hjjjj" + jk in neovim and zed.
in bottom right corner of zed you can see 'jjjj' next to the -- INSERT -- when i type
keymap.json:
{ "context": "Editor && vim_mode == insert && !menu", "bindings": { "j k": ["vim::SwitchMode", "Normal"] } },
Environment
Zed: 0.144.3
OS: Sonoma 14.4.1
Memory: 16gb
Architecture: apple silicon (m1 macbook pro)
If applicable, add mockups / screenshots to help explain present your vision of the feature
Screen_Recording_2024-07-18_at_10.44.55.mov
If applicable, attach your Zed.log file to this issue.
No response
The text was updated successfully, but these errors were encountered: