Add pane join actions for vim-like split close workflows#50035
Add pane join actions for vim-like split close workflows#50035baldwindavid wants to merge 1 commit into
Conversation
dinocosta
left a comment
There was a problem hiding this comment.
Hey @baldwindavid 👋
Thank you so much for suggesting this change! I can see how introducing something like this can be useful for users that are trying to get a setup as close as possible to Neovim/Vim with tab_bar hidden 🙂
Am I missing a specific use case or would simply supporting the JoinIntoNextAsInactive (or similar) be enough to support Neovim's behavior? I tested the :q behavior a bit with 3 splits in Neovim and it seemed to always focus on the next (right) split, when closing the middle split, regardless of whether the previously focused split was the left or right one.
|
Thanks, @dinocosta
Oh, right, that's the default behavior in vim. I guess I've had this in my vim config since forever... ...and, with those settings, it does the opposite. The additional actions would allow for whatever devs are used to, but I'm also not going to argue it's strictly necessary. Frankly, my preference would be for it to move to the most recent pane, but vim didn't choose that. I'm pretty okay with whether we go three additional actions or just one; the key thing is just having some way to approximate keeping buffers around and either of the Also, I'm not really enamored with
And then there's also the option of keeping just |
Makes total sense to me! 🙂
Yes, was also thinking whether we could simply update/extend Thanks! |
|
I've also just noticed a couple of things that might be relevant:
Still thinking about this! 😅 |
|
Yeah, it doesn't cover The bigger issue I've been concerned with is that I'm not sure we can just force that behavior of merging panes onto users for To your point though, it might be cleanest to just do an entirely new action purpose built (i.e. last pane aware) for this need. Even so, I'm just not sure we should make One route is to not change |
|
Related: I apparently also set this probably a couple years ago in my Zed settings and forgot about it... "pane_split_direction_horizontal": "down",
"pane_split_direction_vertical": "right",So if we were to end up going with a standalone action (e.g. |
|
I just want to add another user voice here: this workflow would be genuinely useful. For people using hidden tabs and a more vim buffer workflow, closing a split without disrupting the destination pane’s active item while keeping the buffers open is a big quality of life improvement. |
Follow-up to #47079 which added
tab_switcher::OpenInActivePanefor vim/helix-like buffer management (i.e. tabs hidden, buffers available in every pane). That PR noted the need for better pane close behavior — in vim/helix, closing a split (:q) closes the window but buffers remain available. Zed's tab model ties items to panes, so the closest equivalent is joining items into an adjacent pane without disrupting the destination's active tab.The existing
pane::JoinIntoNextgets partway there, but it always activates the source pane's tab in the destination, and only searches in the "next" direction (Right → Down → Left → Up). These new actions fill the gaps:Actions:
pane::JoinIntoNext(existing) — Joins this pane into the next pane. The source pane's active tab remains active.pane::JoinIntoNextAsInactive(new) — Joins this pane into the next pane. The destination pane's active tab remains active.pane::JoinIntoPrevious(new) — Joins this pane into the previous pane. The source pane's active tab remains active.pane::JoinIntoPreviousAsInactive(new) — Joins this pane into the previous pane. The destination pane's active tab remains active.Example keymap for vim-like
:qbehavior:{ "context": "Pane", "bindings": { "cmd-w": "pane::JoinIntoPreviousAsInactive" } }This closes the current split and moves its items to the previous pane (typically left/above), without disrupting the destination pane's active tab — approximating how vim/helix close windows.
Future work:
:qtopane::JoinIntoPreviousAsInactiveso closing a split behaves like vim/helix out of the box.Before you mark this PR as ready for review, make sure that you have:
Release Notes:
pane::JoinIntoNextAsInactive,pane::JoinIntoPrevious, andpane::JoinIntoPreviousAsInactiveactions for more flexible pane join behavior, enabling vim/helix-like split close workflows.