zed icon indicating copy to clipboard operation
zed copied to clipboard

Tab Switcher

Open alygin opened this issue 4 months ago • 4 comments

Check for existing issues

  • [X] Completed

Describe the feature

When working on tabless editing mode (#6424), there was a discussion about the need to implement Tab Switcher -- a panel similar to the File Finder that would show the list of opened tabs in the active pane and allow to switch between them and close them right in this panel.

I tried to figure out how such switcher could look and how it could be implemented, and decided to file it as a separate feature request, because there's a lot of things to discuss (and probably to change in the code).

How it will look and work

zed-tab-switcher
  • Default shortcut is ctrl-tab. It also moves selection to the next item.
  • Selection is confirmed by either releasing of a modifier key (ctrl by default) or with a mouse click.
  • Items are sorted in the reverse order of the tab activation history.
  • Second item (if exists) is selected by default. This will allow to switch to the previous tab with a single keystroke.
  • We need item icons here to distinguish files from terminal, search results etc.
  • Close button is displayed when hover over item.
  • Implemented using the existing Picker functionality, but with the query editor hidden.

Tasks

  • [ ] Implement #8757
  • [ ] Implement headless picker
  • [ ] Implement tab switcher

How others do this

See comments below:

Related issues and PRs

  • #6424
  • https://github.com/zed-industries/zed/pull/2742#issuecomment-1638903687
  • #7356
  • #8757

alygin avatar Feb 10 '24 09:02 alygin

VSCode

VSCode has several features that allow the user to naviage between opened tabs:

  1. Tab switcher, as described above, available through ctrl+tab shortcut:
vscode-tab-bar-menu
  1. Tab bar dropdown menu wit the "Show Opened Editors" action in it:
vscode-tab-bar-menu

When clicked, it displays a panel that is very similar to File Finder. Tabs of the selected pane (group) are listed in the reverse history order. Name, path, git status, modification mark etc. are the same as in the tabs, including the Close button:

vscode-opened-editors-list
  1. VSCode also has the Open Editors panel that can be displayed in the left pane, along with the project structure:
vscode-opened-editors-panel

VSCode doesn't have a setting that would allow to automatically close tabs when there're too many of them.

alygin avatar Feb 10 '24 09:02 alygin

Jet Brains IDEA

~IDEA doesn't provide such feature~

See @alexander-irbis's comment: https://github.com/zed-industries/zed/issues/7653#issuecomment-1990820785

alygin avatar Feb 10 '24 09:02 alygin

Sublime Text

Sublime Text has an "Add" button and a simple dropdown list with opened tabs:

sublime-tab-bar-menu

alygin avatar Feb 10 '24 09:02 alygin

If Zed had a unified bufferline this wouldn't be an issue.

diocletiann avatar Feb 10 '24 19:02 diocletiann

IDEA doesn't provide such feature

Idea provides such feature (with additional options where to switch). Also it allows to select elements in the list with arrows (while Ctrl is pressed).

image

alexander-irbis avatar Mar 12 '24 06:03 alexander-irbis

Idea provides such feature

You're right, thanks for pointing that out! I've added a link to your comment.

alygin avatar Mar 12 '24 11:03 alygin

If Zed supports ctrl-tab to switch between recent tabs the way VSCode and Firefox do, that will be great.

oxaronick avatar Mar 18 '24 13:03 oxaronick

Nice one! I hope a fuzzy-search feature can be added too, it is so convenient to use it after trying it in Emacs.

maximvl avatar Apr 03 '24 13:04 maximvl

@maximvl Filterable tab switcher would be very helpful. I also miss the ctrl-x b (switch-to-buffer) in Emacs.

failable avatar Apr 04 '24 01:04 failable