Add tab switcher mode similar to vim/helix buffer picker#47079
Add tab switcher mode similar to vim/helix buffer picker#47079ConradIrwin merged 5 commits intozed-industries:mainfrom
Conversation
|
Thank you for creating this @baldwindavid. It's much appreciated. To share some perspective, I tried getting a similar feature merged into vscode 4 years ago and there were follow ups. I bet this PR will go a lot better than the vscode folks. :) |
|
You got it @mkcode . Yeah, we'll see. Definitely tried to avoid impacting the existing tab-based paradigm, but there are a lot of different approaches that could be taken. The vim implementation in Zed is really nice, but I just haven't been able to get over having to constantly babysit tabs confined to panes. |
|
Just chiming in to say that I am another user that would very much appreciate this functionality, as it would also allow emulating Emacs better as well. I found the existing behavior extremely confusing and opaque lol |
|
Thanks for this.
It feels a bit broken in its current state, but happy to take another look once you've cleaned it up. |
|
Thanks, @ConradIrwin This has also been changed to a standalone command named That it is a standalone command makes me think maybe its okay to diverge from the other modes in lacking the previews, but also understandable if that feels like an incomplete/inconsistent feature. I know for my own usage, the critical part is not the previews, but it would also be nice to have. If this gets to a shippable state perhaps I'd take another run at previews later too. The other thing I suspect is that all the modals will eventually end up going in a direction similar to #44530 with a preview decoupled from tabs, but that might be a big assumption.
One thing I want to make sure is clear is that the intent is very much that you can easily end up with a file open in multiple panes. Regular files/buffers should "activate or clone" (never removed) in whichever pane you're in while terminals, multibuffers and such should "move" to whichever pane you're in. You wouldn't typically necessarily know or care which tabs are open in which panes because, if you're using this feature, you probably also hide the tab bar altogether, similar to vim/helix. |
|
Makes sense, thanks for fixing it up. The code looks good to me, but I'm super hung up on the name. Do we need the original ToggleAll if we have this? Because that really is the best name for it. If we do then our AI overlords suggest any of:
I'm not sure what to do... and it doesn't seem fair to make you wait any longer... maybe rename the existing ToggleAll to ToggleGlobal and make this one ToggleAll (not great if we want to keep that feature as-is), or this could be |
|
Great, sounds like we're close. Yeah, we're in a bit of pickle with the naming. The intent with Maybe we just go real explicit with Something like I'm not too concerned with how quickly this gets in; lets get a name we're comfortable with. Thanks! |
|
I've pushed the |
|
tab_switcher::OpenInActivePane works for me, thanks! |
Key changes: - Thermal state detection (zed-industries#45638) - GPUI detects system thermal state, throttles to ~60fps when overheating - Checkerboard shader for side-by-side diff (zed-industries#48417) - visual pattern for diff backgrounds - cosmic-text v0.17 (zed-industries#48504) - fixes font ligatures on Linux - Middle click tab close (zed-industries#44916) - on_aux_click/is_middle_click API additions - Soft wrap modes for wrap width (zed-industries#46422) - Tab switcher mode similar to vim/helix buffer picker (zed-industries#47079) - Multi_buffer optimization batch (zed-industries#48519) - TreeMap for diagnostics (zed-industries#48482) - performance improvement - Semantic token follow-up fixes (zed-industries#48485) - Claude Opus 4.6 and 1M context window model variants (zed-industries#48508) - Anthropic adaptive thinking types (zed-industries#48517) - Side-by-side diff: hunk gutter highlights restored, toolbar buttons for SplittableEditor - Shell quote bypass fix in terminal permission system (zed-industries#48436) - Project panel: Collapse All improvements (zed-industries#47328, zed-industries#48443) - Edit prediction: trailing newlines fix, cursor position in global coords - Properly discard tokens on language server stop (zed-industries#48490) - AgentTool::NAME const instead of hardcoded strings (zed-industries#48506) Conflict resolution: - collab/editor_tests.rs: deleted (collab removed) - vim (helix, motion, increment): deleted (vim removed) - GPUI (17 files): deleted from Glass (handled in Obsydian-HQ/gpui) - editor/items.rs: merged imports (added BufferId, kept Theme) - project_diff.rs: removed old native_button toggle (upstream uses toolbar buttons now) - lsp_store.rs: added SemanticTokenConfig, removed GlobalLogStore/LanguageServerKind - project_panel.rs: merged UI imports (added ContextMenuEntry, ScrollAxes) - Keymaps: took upstream JetBrains bindings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements the enhancement requested in #24655 - enables tab switcher to show all open files across all panes deduped. Whichever is the active pane is ALWAYS where the file, terminal, etc will be opened from the tab switcher.
Adds
tab_switcher::OpenInActivePane. When enabled:Intended for vim/helix
:bufferscommand workflow while respecting Zed's tab-based paradigm.Q&A
Q: Why not tie this to vim mode?
A: This feature is different enough from vim/helix buffer behavior that I opted not to couple them. It is an approximation using Zed's tab switcher/picker and would take architectural changes to implement real vim/helix buffers. Additionally, both this and regular tab switcher mode (
tab_switcher::ToggleAll) are useful window/tab management workflows that vim or non-vim users may want regardless of their editing mode preference.Q: How to use this?
A: For a vim/helix-like workflow:
Bind the tab switcher to a key - Add to your keymap:
{ "context": "Workspace", "bindings": { "cmd-i": "tab_switcher::OpenInActivePane" } }Hide the tab bar (optional) - Add to settings:
{ "tab_bar": { "show": false } }Move tabs to other pane on close (optional) - Add to your keymap to join tabs into next pane when closing:
{ "context": "Pane", "bindings": { "cmd-w": "pane::JoinIntoNext" } }This makes closing a tab behave more like vim's split closure - items move to the adjacent pane instead of being closed.
If you find that you'd rather have the tab bar visible, there's a pretty good chance you don't need/want this feature. Vim/helix don't have visible tab bars, so this feature is primarily for users who want that sort of experience where buffers are not tied to a specific split/pane and closing a split does not impact the available buffers.
Future Work
A few additional features could make for more complete vim/helix-like buffer workflow:
:bd(buffer delete) improvements:workspace::CloseActiveItemonly closes in current paneworkspace::CloseActiveItemAcrossPanesand/or update vim command mapping:q(quit) improvements:pane::CloseAllItemsto actually close the pane. This would be closer to what vim/helix does although those only close the "window" into buffers rather than all buffers within. Users of the behavior in this PR would likely want to have a keybinding topane::JoinIntoNextlike mentioned above. I don't think it's completely clear what the best course of action is, but something to consider.Previews:
When first opened, this PR had preview functionality. However, that added a whole lot of complexity for a nice feature, but not the critical part of this workflow. Perhaps that could be approached in the future.
Release Notes:
tab_switcher::OpenInActivePaneto allow a more vim-like tab switching experience.