vscode
vscode copied to clipboard
Add option to automatically move files to current tab group on open
From @aguynamedben in https://github.com/microsoft/vscode/issues/41289:
I wish to live in a "don't-care-about-tabs" world but still want a way to split my editor's UI. However, the idea of tabs and tab groups seems deeply embedded into VS Code's ability to split windows, so I'm skeptical this is coming any time soon.
The best way out of this I can think of is some kind of settings such as:
"workbench.editor.moveToCurrentTabGroupIfOpen": true,
This would be similar to workbench.editor.revealIfOpen but opening a file that's already open in another tab group would move that file into the current tab group. Then I could disable all tab-centric UIs in VS Code and indiscriminately open any file within any split and not end up with a mess of duplicate files open across many tab groups. I think this might be sufficient for most tab-haters.
Working without Tabs could say:
If you're used to text-focused editors such as Emacs or vi and simply want to view any open file within any split without regard for tab or tab groups, set:
"workbench.editor.showTabs": true, "workbench.editor.revealIfOpen": true, "workbench.editor.moveToCurrentTabGroupIfOpen": true
With this setup, the underlying tabs and tab groups system will continue power which files are shown in which visual split, but that will be mostly irrelevant in day-to-day use. You wont see tabs, and opening a file will "move" the open file into whatever tab group ("visual split") you're focused on, similar to Emacs buffers and "windows".
https://github.com/microsoft/vscode/issues/41289 was originally closed as it was out of scope. However, this suggested feature does not seem out of scope and seems easier to implement than just removing editor groups altogether. I would be happy to try to implement this.
It seems like this might have already been somewhat implemented by @mkcode in https://github.com/microsoft/vscode/pull/134525 over 2 years ago. Is there any reason why this hasn't been merged and is there anything I can do to help get it merged?
I'll chime in again just to share my experience and perspective with all this:
I completely understand microsoft's values in making vscode as accessible as possible. And, vscode is so close to be able to make people that prefer keyboard oriented approaches (usually coming from vim or eMacs) happy as well. It's just one or two "opt-in" settings away, meaning there would be no changes to the out of the box user experience.
Ultimately, I was unable to create a consistent keyboard oriented workflow in vscode, and have therefore been using neovim. A lost user that could have been supported, by allowing an opt-in setting change to unlock keyboard oriented workflows.
+1
@jonathanjameswatson interesting that it doesn't seem that difficult to implement. #134525 is pretty close, I'd just want it to move the tab into current tab group from quick open (not open again).
Hmmm, I've never hacked on VS Code, but given that the other PR is 20 lines and I think there could be a compelling 2 minute video "how to setup VS Code like Neovim or Emacs" it could be pretty compelling and I don't see why it wouldn't be merged.
I think it makes sense to move the editor to the current tab group rather than re-open it – with re-opening, if you only use quick open, then you could presumably end up with all editors being in all tab groups.
I believe complexity may come from the interaction between revealIfOpen
and moveToCurrentTabGroupIfOpen
. It would not be an unreasonable to assume that moveToCurrentTabGroupIfOpen
would not require revealIfOpen
to be set, but if this was the case then it would not be clear what would happen if both were set. Perhaps we could use a name like moveToCurrentTabGroupOnOpenReveal
instead? Although, perhaps that is too verbose.
I have made a PR that implements this feature: #205442
Demo here:
https://github.com/microsoft/vscode/assets/23344719/0598e320-1e7d-43c4-a1cc-ab7b372c139d
@jonathanjameswatson Amazing!!! It works just like I imagined.
This will really help users coming from Emacs or vi. Users of those editors are accustomed to splitting windows into "frames" or "panes", then being able to recall any buffer into any frame without the file being opened a 2nd time. Your PR and revealIfOpenInActiveGroup
makes that possible in VS Code. Without this, users must open a file once-per-Editor Group which creates a mess and kills the "fast switching". This is especially confusing for users who want to do side-by-side editing with tabs turned off.
I wrote these docs that I think should go under the "Working without Tabs" section, but I don't see how to edit the docs in the vscode repo.
Docs: https://github.com/microsoft/vscode/pull/205442#pullrequestreview-1886995297
@mkcode Can you review the PR and docs in my approval as well? Thank you!
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
Docs PR: https://github.com/microsoft/vscode-docs/pull/7043
This would be great!
:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!