zed
zed copied to clipboard
vim: Show 'j' from jk pre-emptively
Fixes: #29812 Fixes: #22538
Co-Authored-By: [email protected]
Release Notes:
- vim: Multi-key bindings in insert mode will now show the pending keystroke in the buffer. For example if you have
jkmapped to escape, pressingjwill immediately show aj.
will this also close https://github.com/zed-industries/zed/issues/22538?
I think so, yes!
cc @little-dude for testing
Hey, @ConradIrwin
I just tested this feature and although this works totally fine, the behavior looks a bit buggy
https://github.com/user-attachments/assets/bdf17b9c-7588-417a-9b36-c6e85f7341ae
As you can see in the clip, the cursor is placed before the j. It looks like the delayed key is inserted without "updating" the cursor position
Hah, funnily I changed it to match vim - we could do it the other way too though
in neovim is use better-escape.nvim which has exactly this behavior and imo it feels more "natural".
https://github.com/user-attachments/assets/a556a090-3907-475d-b4be-7d13fa0d0359
Hah, funnily I changed it to match vim - we could do it the other way too though
I'd agree with @domokopter. The behavior looks quite janky. Even if it does match how Vim behaves. j isn't too common a letter, but I still think it's better to make things look less janky when possible.
:+1: I'd happily merge a PR that makes it more zed-like if you want to give it a go.
I'll give it a shot. Could you let me know the section of the code base related to this? The same files changed in this PR?
Should just be in the observe_pending_keystrokes function added in this PR. You can see it does some edits and moves the cursor, it probably needs to do the opposite of what it does now.