zed
zed copied to clipboard
vim mode: Ctrl-w l will allow me to enter AI pane, but cannot go back this way
Summary
vim mode: Ctrl-w l will allow me to enter AI pane, but cannot go back this way
Description
Steps to reproduce:
- set vim mode
- open file and AI pane
- move to AI pane with Ctrl-w l
- Ctrl-w j - does nothing...
Expected Behavior: Ctrl-w j should move me again to editor.
Actual Behavior: you cannot go back same way, ie.: Ctrl-w j - Ctrl-w seems to not working at all in AI pan
Zed Version and System Specs
Zed: v0.188.5 (Zed) OS: Linux X11 debian 12 Memory: 62.6 GiB Architecture: x86_64 GPU: Intel(R) HD Graphics 530 (SKL GT2) || Intel open-source Mesa driver || Mesa 22.3.6
and in general - ctrl-w as vim shortcut for buffer management is inconsistent - I expect it to be everywhere, but sometimes ctrl-w just closes winodow (ie.: type :, then zlog, and you can close this window just by pressing ctrl-w) , sometimes it waits for rest of vim command
AI panel editor starts in insert mode, while shortcuts like ctrl-w j are defined for the normal mode. You can override this by adding this to your keymap.json:
{
"context": "MessageEditor > Editor && vim_mode == insert",
"bindings": {
"ctrl-w ctrl-h": ["workspace::SendKeystrokes", "escape ctrl-w h"],
"ctrl-w h": ["workspace::SendKeystrokes", "escape ctrl-w h"]
// Define for similar shortcuts
}
}
Defining actions directly is even cleaner:
{
"context": "MessageEditor > Editor && vim_mode == insert",
"bindings": {
"ctrl-w ctrl-h": "workspace::ActivatePaneLeft",
"ctrl-w h": "workspace::ActivatePaneLeft"
// and so on
}
}
Thank you! Unfortunately context "MessageEditor > Editor && vim_mode == insert" has no effect, but after changing it to: "MessageEditor > Editor" shortcut seems to work. But this is not something user expects when using vim mode. It seems like fast solution (hack?) to problem. It is acceptable - but maybe there should be info about that in docs? Ie.: what to paste into keymap.json to let ctrl-w window command of vim mode to work?
Glad that it worked!
Due to a recent change (#31915), the message editor now opens in Vim's insert mode. In this mode, ctrl-w behaves differently -- it's used to delete the previous word. That's why ctrl-w h doesn't work there by default.
However, if you switch to normal mode, ctrl-w h works as expected, matching Vim's usual behavior.
Enabling ctrl-w h directly in insert mode is a personal preference that sacrifices ctrl-w. I'm not sure if this override is common enough to be mentioned in the docs. Hopefully, anyone interested can find this GitHub issue!
I'm going to close this issue for now as it seems to be solved, and general ctrl-w h/j/k/l consistency is another topic.