Skip to content

Allow to open two distinct editors side by side in one group #36700

Open

Description

VsCode has the ability to horizonatally split an editor window. When you execute code --diff file1 file2 both files are opened side by side in a single editor window with a single header tab. A similar view is presented when you edit the VsCode settings.

This is splitting. It would be nice to be able to do this for my own files to have multiple views of the same file. What would make it actually usable would be the following three enhancements.

  1. The option to split either horizontally or vertically.
  2. The ability to move focus from one split pane to another.
  3. The ability to unsplit (revert the editor back to a single pane).

What we currently have is a keyboard shortcut "workbench.action.splitEditor" which doesn't actually split an editor at all, instead it just opens the same file in another editor in a different editor group. This is not editor splitting which by definition should occur in the same editor tab.

Calling opening a file in another editor group 'splitting' when there is already nascent functionality to support proper splitting is a pointless ambiguity that serves only to reduce the possibility that the editor will ever support proper splitting any time in the near future.

Proposal:

  1. Rename "workbench.action.splitEditor" to "workbench.action.openInNewEditorGroup"
  2. Make the VsCode diff view usable by adding a keyboard shortcut to permit cycling focus from one editor pane to the other.
  3. Add support to split open editor vertically or horizontally by the addition of the additional keyboard shortcuts "editor.action.splitHorizontal", "editor.action.splitVertical" and "editor.action.unsplit".

Activity

  1. Neutrino-Sunset commented on Oct 22, 2017

    @Neutrino-Sunset
    Author

    I found the discussion about enhancing the editor group functionality here

    #5911

    ...and added some thoughts of my own about how grouping and splitting should be two separate things which it might be useful to reiterate here.

    My personal workflow is to open editors horizontally (side by side). Occasionally I may want to view two parts of the same file, which I do by splitting that editor vertically (one pane above the other). Splitting the file in the editor (as opposed to opening another vertical editor group) is a distinct useful feature because splitting one editor vertically does not half the height of all the other horizontally laid out editors you have open.

    Suggesting that opening additional horizontal or vertical editor groups performs the same job as editor splitting is to completely misunderstand the problem. Suppose I have 4 editors laid out side by side and I want to split one editor vertically. If to do this open my file in another editor in a group below the existing editor group, then all the other editors in the first group are now halved in height.

    This is why editor groups and editor splitting are two different things.

  2. Faultless commented on Oct 22, 2017

    @Faultless

    +1
    Horizontal splitting is a really frustrating experience in vscode. And apart from git diffing, it ends up being more of an annoyance (misclick) than an actual feature.

    Sent from my Samsung SM-A500H using FastHub

  3. added
    layout
    and removed on Nov 16, 2017
  4. added
    feature-request
    on Nov 17, 2017
  5. changed the title [-]Rationalize editor splitting functionality.[/-] [+]Allow to split an editor into two without creating separate tabs[/+] on Nov 17, 2017
  6. robertocarta commented on Mar 4, 2018

    @robertocarta

    +1 This is the only reason why I'm unable to switch from vim to vscode. The idea is that you want to be able to split a tab, not the entire editor.
    For example, I want one tab vertically split with index.html and controllers.js, and another tab split between directives.js and somethingelse.whateva.

  7. added
    workbench-editors
    on May 3, 2018
  8. smbkr commented on Dec 18, 2018

    @smbkr
    Contributor

    This workflow would make sense to me as well. I work in Vim the same way that robertocarla describes. I like to work with implementation and tests side by side, and switch tabs to switch to a different implementation/test pair.

    It's also disruptive opening a git diff when you have got a split view open, as the diff opens in one side of the split only, but splits it in half again. Ideally, opening a git diff would open a new tab (a blank canvas with no splits), splitting that in two vertically.

  9. smbkr commented on Dec 18, 2018

    @smbkr
    Contributor

    There are some other (now closed) issues not referenced here that are requesting the same feature, just to indicate that there is a healthy demand for this: #7418
    #49062
    #41486

  10. 56 remaining items

  11. changed the title [-]Allow to open two editors side by side in one group[/-] [+]Allow to open two distinct editors side by side in one group[/+] on Sep 14, 2021
  12. heartacker commented on Sep 14, 2021

    @heartacker
    Contributor

    open setting config with split view, then use ctrl+kctrl+shift+\and the split view is closed into one, but trigger that again, we couldn't recover the split setting view,

  13. heartacker commented on Sep 15, 2021

    @heartacker
    Contributor

    click setting file will create new-two-tab-view even opened
    001splite

  14. bpasero commented on Sep 15, 2021

    @bpasero
    Contributor

    heartacker if you see any issues specific to settings, please report as new issues and make sure to try this out in insiders. You can give our preview releases a try from: https://code.visualstudio.com/insiders/

  15. ted1030 commented on Sep 25, 2021

    @ted1030

    I hope this feature can also be used when we move the terminal to the editor area.

  16. ChugunovRoman commented on Oct 28, 2021

    @ChugunovRoman

    Benjamin Pasero (@bpasero) Hi. Is the split an editor without creating a new group feature available for plugins? Can a plugin use this feature for creating own UI inside a splited tab?

  17. bpasero commented on Oct 28, 2021

    @bpasero
    Contributor

    There is no official API, though arguably an extension could open an editor and then trigger the workbench.action.splitEditorInGroup command right after.

  18. veryjos commented on Jan 18, 2022

    @veryjos

    Reading through the comments and linked issues, it looks like the original intent of just splitting 1 editor into 2 is not what got all the upvotes. Instead, it seems that some are asking for being able to open 2 different editors in the same group (also in #22068) and others want to open as many editors as they want side by side in a group ("VIM Style Tabs").

    I feel that being able to open any 2 editors side by side in a group is realistic. Being able to have a full grid of editors within a group is imho rather unrealistic for the complexity this brings and given we have full grid support via groups already.

    As such I have extracted #132651 for the work I am planning to do in September or what is already pushed with regards to being able to split an editor into 2.

    I'm a little confused, is this being dropped? The issue title changed to something different, and I can't find the original ask tracked somewhere else.

    But just to recap, because this issue is getting huge and confusing to me:

    For most vim users, this is an intrinsic part of the workflow for stuff like having an impl/test side-by-side, and maybe you open a third split for like, an HTML template or stylesheet.

    Then, those 3 splits are grouped together in one tab. So when I want to think about "ComponentX", I just navigate to that tab and see everything at once. Maybe even a 4th split for documentation.

    I think multiple editors solves all of this, but the missing piece is grouping them into a single tab.

    One way to solve this might be to introduce an optional, higher-order tab bar where each tab groups editor splits, and then provide an option to disable the tab bar inside the editors.

    But anyway, I understand that's probably a lot of effort. I hope the original feature request is still tracked somewhere, though.

  19. a-stewart commented on Feb 11, 2022

    @a-stewart
    Contributor

    it seems that some are asking for being able to open 2 different editors in the same group

    I think this is something that would be really useful, especially if it could be controlled via an extension.

    For example, we often use two editor groups for doing side-by-side previews (eg markdown). But that is usually no what is wanted as when you click onto another editor tab, the preview is still taking up half the screen.

    It would be great if extensions could split an editor in half, and then put a webview into the other half.

    Very hacky demo:
    Kapture 2022-02-11 at 17 27 44

  20. aggrhm commented on Feb 14, 2022

    @aggrhm

    It definitely feels like the Code team prefers this functionality be implemented as an extension, and this is pretty much exactly what my extension "Workviews" (https://marketplace.visualstudio.com/items?itemName=agquick.workviews) does, except the "tabs" are shown in the Explorer pane on the left.

    The problem is I can't get access to all the open editors/terminals/etc properly until VS Code decides to open up the extension APIs a bit. But it's the closest feeling to VIM I've been able to achieve thus far.

  21. a-stewart commented on Feb 16, 2022

    @a-stewart
    Contributor

    this is pretty much exactly what my extension "Workviews" (https://marketplace.visualstudio.com/items?itemName=agquick.workviews) does

    I think that is slightly different to what is being asked for here. (The post above is a demo of what could be done with the functionality, not what we are asking for explicitly.)

    This FR is asking for a way for extensions to control the "Split Editor in Group" functionality and specify what is rendered in the other half of the editor. At the moment it is not possible for extensions to do that.

  22. thefakeplace commented on Feb 16, 2022

    @thefakeplace

    I think that is slightly different to what is being asked for here. (The post above is a demo of what could be done with the functionality, not what we are asking for explicitly.)

    If you gather context from reading the thread, it's likely that most of the support for this FR is from Vim users who have a workflow based on grouping multiple editors within tabs. They've been punted here from other FR's that are closed as duplicates of this FR.

    In my opinion, the main issue is that tabs don't group anything. One-to-one correlation between tabs and files, except in some special cases, like the diff view.

    Creating another grid inside the existing editor grid seems like the wrong way to solve the problem to me-- especially if the new grid is subject to limitations like only horizontal splitting + showing the same file.

    See #143024 for an alternate solution that solves everyone's problem.

  23. starball5 commented on Jul 6, 2023

    @starball5

    Related on Stack Overflow: Is it possible to create split editors inside individual tabs in VS Code?. I'll keep my answer post updated with whatever progress is made here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestworkbench-editors

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions