In VS Code, whenever I'm in the split view (when I have multiple editor groups) and want to switch tabs with ctrl+tab, the tab switches fine until I reach the last tab on that active window (editor group). Then, instead of looping back to the first tab, it switches to the other split view window (editor group) instead.
I tried to see if there was any setting to disable this behavior but I couldn't find anything. Duplicating the other window instead of using split view works but isn't the best for my workflow.
Does anyone know of any setting to change the behavior so that it goes back to the first tab instead of switching to the other split window?
Note: I cannot reproduce this on Ubuntu.
For me, I can focus editor groups (what you are calling "splits") by number by using ctrl+<number>, or by directional navigation using ctrl+k,ctrl+<direction>, and open a quick cycle popup to cycle between editor tabs in the focused editor group by using ctrl+tab and ctrl+shift+tab. I can also focus editor tabs in an editor group by index in that editor group using alt+<index>.
For more similar info including default keybindings on other OSes, see Is there a quick change tabs function in Visual Studio Code?.
What you are probably interested in is the distinction between the following commands:
View: Open Next Editor (bound by defaut on Windows and Linux to ctrl+PgUp)
View: Open Next Editor in Group (bound by defaut on Windows and Linux to ctrl+k,ctrl+PgUp)
The first is for cycling through editor tabs in all editor groups (which is the behaviour you don't want), and the second is for cycling through editor tabs in the currently focused editor group (which is the behaviour you do want, and which has no default keybinding).
If you don't like the default keybindings, just edit them to your liking (edit keybindings for the workbench.action.nextEditorInGroup command).
Like when you split a window into two tabs, is there a way to jump between the two (or more) tab groups?
Yes, CTRL 1 - Focus First editor Group
CTRL 2 - Second Editor Group
etc...
You can find more specific shortcuts in the keyboard shortcuts settings, search for editor group
Complete list
In sublime text I used to use a shortcut that allowed me to tab through my multi selection and edit each element individually.
for example I would cmd+d a word then the shortcut would allow me to tab through each selection and edit them individually.
I haven't used sublime text in a month since I switched and can't even remember the shortcut I used to find the name of that action. so I don't even know if it was a plugin or a built in short cut.
is there a similar shortcut in vscode?
You can multi-select in VSCode using alt+click
(can be changed to cmd+click in "Selection -> Switch to Cmd+Click for Multi-Cursor").
To tab through your selections install the tab-through-selections extension and then use cmd+shift+u to start iterating (alternativley ctrl in Windows), then:
tab to go to the next selection
shift+tab to go to the previous selection
click anywhere to cancel iterating
Hope this helps :)
How do you unsplit an editor, go back from 2 code views to 1, same with terminal.
Editor Groups
To "unsplit" editor groups without closing any open files, use the menu-bars: View > Editor Layout > Single (or, while in the editor, press and release ALT and then type vls).
Editor groups are also closed by default when they become empty. You can empty an editor group by closing tabs/files or by dragging all of the tabs from that group to another.
Hints:
Grabbing the area to the right of the tabs allows you to drag/drop all tabs in a group at once.
The "Open Editors" section of the "Explorer" panel lets you use CTRL and SHIFT to select and drag/close multiple editors at once. (If you don't have an "Open Editors" section, use the "..." menu of the Explorer panel to enable it.)
Terminal Groups
Terminals work differently than editor groups and are more limited:
You can open new terminal groups by pressing the '+' icon in the terminal tab of the panel.
"Splitting" a terminal (done by clicking the split icon in the terminal tab of the panel) really just opens an additional terminal in the same group and displays it side-by-side with the others in the group.
So, two ways to "unsplit" terminals:
Kill terminals (e.g. with the trashcan icon) until there is only one left in the group.
Switch to a new terminal group with only a single terminal in it.
(as of Visual Studio Code version 1.29.1)
By mouse
To close or unsplit a split Editor you need to
either close all the tabs in the split side you want to close
or right-click on one of the tabs in the section you want to close and select Close All.
By keyboard
To close or unsplit split Terminals:
type exit in the terminal you want to close.
Note
The split Editors will not close when you close the tabs if you have in your settings "workbench.editor.closeEmptyGroup" : false
Editors:
View: Join Editor Group with Next Group workbench.action.joinTwoGroups
View: Join All Editor Groups workbench.action.joinAllGroups
Terminal:
Terminal: Kill the Active Terminal Instance workbench.action.terminal.kill
ctrl+\ to split
ctrl+w to unsplit
F1 > View: Join Editors of Two Groups
Default keybindungs for join/split editor (macOS)
join current view/group with next group (just press multiple times if you have multiple groups):
alt+cmd+1
split current view/group:
alt+cmd+2
To avoid this "VSCode irritation no. 1", you also have, beside "View: Join Editor Group with Next Group", a way to avoid the issue entirely, with VSCode 1.52 (Nov. 2020)
New setting to disable editor group splitting on drag & drop
A new setting workbench.editor.splitOnDragAndDrop allows to disable editor group splitting when using drag & drop of editors.
There is also a way to toggle this conditionally during the drag and drop operation when you press and hold Shift key (macOS) or Alt key (Windows, Linux).
Split current file (Ctrl+\) is a combination I can constantly hitting by mistake so I just removed the shortcut.
Command Palette
Preferences: Open Keyboard Shortcuts (JSON)
Paste the following object in the array:
{
"key": "ctrl+oem_5",
"command": "-workbench.action.splitEditor"
}
In Visual Studio Code, a while ago, when I used menu View → Split Editor, it would split vertically. (One file on the left and one file on the right.)
I updated Visual Studio Code and when when I do menu View → Split Editor, it always splits horizontally. (One file on the top and one file on the bottom.)
How can I split vertically?
Change editor split layout from horizontal to vertical
In 1.20
ALT+SHIFT+0 PC (Windows, Linux)
⌘+⌥+0 Mac
Pre-1.20
ALT+SHIFT+1 PC (Windows, Linux)
⌘+⌥+1 Mac
In 1.25
You can split editor into Grid layout. Check View=>Editor Layout
It is nicely presented in Release notes v1.25: VS Code grid editor layout
In 1.58.2 **
** Someone update this with the lowest version where this became true.
The menu entry with the shortcut given above is View=>Editor Layout=>Flip Layout
The Command Palette entry is labeled "Toggle Vertical/Horizontal Editor Layout"
The settings entry is
{
"key": "alt+cmd+0",
"command": "workbench.action.toggleEditorGroupLayout"
}
If you're looking for a way to change this through the GUI, at least in the current version 1.10.1 if you hover over the OPEN EDITORS group in the EXPLORER pane a button appears that toggles the editor group layout between horizontal and vertical.
To split vertically:
⌘+\ Mac
command: workbench.action.splitEditor
To split orthogonal (ie. horizontally in this case):
⌘+k+⌘+\ Mac
command: workbench.action.splitEditorOrthogonal
Method 1
Method2
View -> Command palette -> type 'split'
Method3
Method4
Tip
Add a Keyboard Shortcut for split Editor
Press CMD + SHIFT + P (MAC) and search for Toggle Editor Group
In version 1.23.1, it is Ctrl+Shift+P and Split Editor
This will divide the screens vertically and you can move through them using Ctrl+K+LeftArrow
By default, editor groups are laid out in vertical columns (e.g. when you split an editor to open it to the side). You can easily arrange editor groups in any layout you like, both vertically and horizontally:
To support flexible layouts, you can create empty editor groups. By default, closing the last editor of an editor group will also close the group itself, but you can change this behavior with the new setting workbench.editor.closeEmptyGroups: false:
There are a predefined set of editor layouts in the new View > Editor Layout menu:
Editors that open to the side (for example by clicking the editor toolbar Split Editor action) will by default open to the right hand side of the active editor. If you prefer to open editors below the active one, configure the new setting workbench.editor.openSideBySideDirection: down.
There are many keyboard commands for adjusting the editor layout with the keyboard alone, but if you prefer to use the mouse, drag and drop is a fast way to split the editor into any direction:
Keyboard shortcuts#
Here are some handy keyboard shortcuts to quickly navigate between editors and editor groups.
If you'd like to modify the default keyboard shortcuts, see Key Bindings for details.
⌥⌘→ go to the right editor.
⌥⌘← go to the left editor.
⌃Tab open the next editor in the editor group MRU list.
⌃⇧Tab open the previous editor in the editor group MRU list.
⌘1 go to the leftmost editor group.
⌘2 go to the center editor group.
⌘3 go to the rightmost editor group.
unassigned go to the previous editor group.
unassigned go to the next editor group.
⌘W close the active editor.
⌘K W close all editors in the editor group.
⌘K ⌘W close all editors.
Simply in windows
ctrl + # (the button 2 in the upper horizontal row of numbers in keyboard)
The key bindings has been changed with version 1.20:
SHIFT+ALT+0 for Linux.
Presumably the same works for Windows also and CMD+OPT+0 for Mac.
Use Move editor into Next Group shortcut:
Mac: ^ + ⌘ + Right/Left arrow
If you want to change shortcut:
Open Command Pallette (macOS keyboard shortcut: ⌘ + Shift + p)
Select Preferences: Open Keyboard Shortcuts
Search View: Move editor into Next Group
To change the editor in Landscape and Vertical mode, follow the steps below.
For example, open two files that you have in your left or right side bar, depending on where you are placed. By default it is always on the left.
Now that you have both windows open, you have to use the key combination for PC (Alt + Shift + 1) for (Windows and Linux Operating Systems) or for MAC (Cmd + Option + 1), as commented here v-andrew.
I just found a simple solution. You can drag an opened file and move towards the four sides of the Editor, it will show a highlighted area that you can drop to. It will split the view automatically, either horizontally, vertically, or even into three rows.
VSCode v1.30.2
Update: you can also drag a file from the Explorer to split the Editor in the same way above.
Right-click on the tab that you want to split it into another screen.
Then choose whether you want to split it (up-down | right-left).
I find this is the quickest way, and You can split it to as many screens as you want.
The best way is to configure the VSCode settings to make the default behavior the way you want:
Split Editor (to a new editor group)
"workbench.editor.openSideBySideDirection": "right" // left/right (default)
"workbench.editor.openSideBySideDirection": "down" // up/down
Split Editor in Group (does not create new editor group)
"workbench.editor.splitInGroupLayout": "horizontal" // left/right (default)
"workbench.editor.splitInGroupLayout": "vertical" // up/down