zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.97k stars 2.83k forks source link

More flexible tab management support / multiple splits per tab #10819

Open lougreenwood opened 5 months ago

lougreenwood commented 5 months ago

Check for existing issues

Describe the feature

I'm dabbling in Zed, I've used Neovim for some time, and whilst I love the flexibility and keyboard driven nature of the Vim, I've always missed a nice looking GUI and something with a bit more robustness & opinionated.

I'm really liking Zed, it obviously feels similar to VSCode, but the speed is more like nvim and the native vim bindings support is a BIG selling point.

However, I feel that both VSCode (and as a result, Zed - by adopting the same idiom), manages splits & tabs in an inflexible way.

The TLDR; for this issue could be described as:

Allow for a tab management stragegy where a single tab can contain also multiple split buffers, allowing for using a tab to organise multiple buffers for multiple files which are related and usually worked on together - i.e a Vim-like mode for tab, window & buffer organisation.

The long version could be outlined as follows:

I use tabs extensively in Vim. Specifically I use tabs to group related files - I'm a frontend developer and the framework which I use means that there are multiple files for a given "entity", for example, given a web page URL (aka a route), I have the following files:

When I'm working on a feature, I like to have one tab per "entity", this allows me to orientate myself in my project in a concrete, spatial way and gives me access to my related files in a consistent way - I can simply use mappings for "buffer left" / "buffer right" to navigate to the realted file, and then use "tab left" / "tab right" to navigate between the related entities.

My brain seems to prefer visual, concrete, spatial organisation - abstract organisation of working files (arbitrary tab/buffer order in the tab bar or using the command pallete for all file navigation is just wasteful cognitive load for me - sometimes I can't remember the name or a keyword I need for the file I'm working on to use the command palette - I just want to use my eyes and navigate through the tab bar for each of my "entity groups".

I will use a tool like telescope-alternate (vim) or related files hopper (vscode) to allow me to open all of the sibling files when I'm viewing one of these files, I'll then open them in splits in that tab (and use a "split auto-collapse accordion thingy" addon, to allow the main file to have focus and the other splits take up minimum space, but maintain a consistent order on screen).

Effectively I use tabs as something similar to "smart folder" organisation for disparate files which are related, but scattered amongst the file system.

I also make extensive use of tabdrop in vim so that when I attempt to open a file (go to definition etc) when I'm not viewing the destiniation file (but it is already open in some other tab), then vim will jump to the target tab and buffer - avoiding having the same file open in many "buffers" across many tabs.

So for me, I want tabs to allow multiple buffers (the vim way), not tabs to be separate buffers (the vscode way). Practically speaking this is implemented as:

If applicable, add mockups / screenshots to help present your vision of the feature

I tried to create a video of my vim setup, but this feature is currently broken after doing some updates and the video is more confusing that helpful. When I finish fixing my setup I'll share a video here.

0x2CA commented 4 months ago

I think the way to minimize changes from what is already there is to add the concept of groups, which are more advanced tabs.Manage windows with groups, a group can contain multiple windows.Window contains multiple tabs. When the window is closed without modifying the tab will be closed directly, there are modifications to the tab will determine whether to open in other windows, there is a direct closure, there will be no move to other windows. Very close to vim-style tabs when hiding tabs to show groups. Of course I'm committed to pursuing true vim style tabs, depending on the zed team. @ConradIrwin