workspace: Add ctrl-w x support for vim#42792
Merged
ConradIrwin merged 2 commits intozed-industries:mainfrom Dec 2, 2025
Merged
workspace: Add ctrl-w x support for vim#42792ConradIrwin merged 2 commits intozed-industries:mainfrom
ctrl-w x support for vim#42792ConradIrwin merged 2 commits intozed-industries:mainfrom
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @mfroeh on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
Contributor
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
mfroeh
commented
Nov 15, 2025
crates/workspace/src/workspace.rs
Outdated
| /// Swaps the current pane with the one below. | ||
| SwapPaneDown, | ||
| // Swaps the current pane with the first available adjacent pane (searching in order: below, above, right, left) and activates that pane. | ||
| SwapPaneDefault, |
Contributor
Author
There was a problem hiding this comment.
not really sure about this name, happy to change this to any suggestion
ctrl-w x support for vim
Member
|
Nice! Thank you. Went with |
someone13574
pushed a commit
to someone13574/zed
that referenced
this pull request
Dec 16, 2025
Adds support for the vim CTRL-W x keybinding, which swaps the active pane with the next adjacent one, prioritizing column over row and next over previous. Upon swap, the pane which was swapped with is activated (this is the vim behavior). See also https://github.com/vim/vim/blob/ca6a260ef1a4b4ae94bc71c17cbabf8f12bf0f8c/runtime/doc/windows.txt#L514C1-L521C24 Release Notes: - Added ctrl-w x keybinding in Vim mode, which swaps the active window with the next adjacent one (aligning with Vim behavior) **Vim behavior** https://github.com/user-attachments/assets/435a8b52-5d1c-4d4b-964e-4f0f3c9aca31 https://github.com/user-attachments/assets/7aa40014-1eac-4cce-858f-516cd06d13f6 **Zed behavior** https://github.com/user-attachments/assets/2431e860-4e11-45c6-a3f2-08f1a9b610c1 https://github.com/user-attachments/assets/30432d9d-5db1-4650-af30-232b1340229c Note: There is a discrepancy where in Vim, if vertical and horizontal splits are mixed, swapping from a column with a single window does not work (see the vertical video), whilst in Zed it does. However, I don't see a good reason as to why this should not be supported and would argue that it makes more sense to keep the clear priority swap behavior, instead of adding a workaround to supports such cases. --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for the vim CTRL-W x keybinding, which swaps the active pane with the next adjacent one, prioritizing column over row and next over previous. Upon swap, the pane which was swapped with is activated (this is the vim behavior).
See also https://github.com/vim/vim/blob/ca6a260ef1a4b4ae94bc71c17cbabf8f12bf0f8c/runtime/doc/windows.txt#L514C1-L521C24
Release Notes:
Vim behavior
vim-horizontal.mp4
vim-vertical.mp4
Zed behavior
zed-horizontal.mp4
zed-vertical.mp4
Note: There is a discrepancy where in Vim, if vertical and horizontal splits are mixed, swapping from a column with a single window does not work (see the vertical video), whilst in Zed it does. However, I don't see a good reason as to why this should not be supported and would argue that it makes more sense to keep the clear priority swap behavior, instead of adding a workaround to supports such cases.