zed
zed copied to clipboard
Key mapping "k j" to Escape kills performance for the normal use of the "k" (up arrow) in normal mode of vim.
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
Wanted to have the k j shortcut for escape to get out of insert mode. There is an example code snippet for keymap.json in the docs (https://zed.dev/docs/key-bindings) under the heading "Remapping keys." Using this as a template, I used the following line in keymap.json:
[
{
"bindings": {
"k j": ["workspace::SendKeystrokes", "escape"]
}
}
]
With this line of code, the k j sequence does indeed work sending vim into command mode, but when in command mode, the normal operation of the k key (up arrow) is so slow as to be unusable.
I then happened to notice in the vim.json file in git and saw this line in the file:
"context": "Editor && vim_mode == insert",
I added this to the orginal line in keymap.json so with this:
[
{
"context": "Editor && vim_mode == insert",
"bindings": {
"k j": ["workspace::SendKeystrokes", "escape"]
}
}
]
The k key now operates normally in command mode. So depending on how one might look at it, it coiuld be construed as either a bug in the code with a work around or a bug in the documentation.
Version 0.130.7 on Apple Silicon with Sonoma 14.4.1.
Environment
Version 0.130.7 on Apple Silicon with Sonoma 14.4.1.
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.
No response