Is there a hotkey to jump between tab groups in VS Code? - visual-studio-code

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

Related

loop through multiple selections and edit individually in vscode

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 :)

Visual Studio Code Toggle Open Files in Grid View

The latest VS Code supports the Grid Layout
In the normal view if you have multiple files open they appear in tabs at the top. You can switch between this tabs by Holding down CTRL + TAB.
How can I do the same in the new Grid Layout?
What I know so far:
-It looks like when you use the Grid Layout the files get split up in to groups.
Once you have a new group you can add additional open files to that group and you have multiple tabs within that group and you can toggle between them with the CTRL + TAB.
-I have found that using CTRL + # (Where # is the group number) toggles you to that group
--Although this is close, it is not the same as the Ctrl + Tab
There is a "Focus Next Editor Group" action, I think this is what you are looking for. It has no keyboard shortcut set by default, you can assign one with these steps:
Open Keyboard Shortcuts Editor by pressing CTRL+Shift+P and searching for "Keyboard Shortcuts"
Search for "Focus Next Editor Group"
Click on "+" button on its left side
Press the shortcut, then press ENTER to save it

How do you unsplit an editor, go back from 2 code views to 1, same with terminal

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"
}

Is there a shortcut to switch panel instead of switching tab?

I'm working on VSCode (last version) and sometimes I work with splitted panels.
I can't find a way to achieve same behavior than a Ctrl + Tab but for panels.
It currently sends me to another tab in the current panel.
In vscode these are referred to as editor groups and can be switched between using either:
CTRL+K, CTRL+LeftArrow/RightArrow
to move focus through the editor groups. If you only have two active groups then this is equivalent to what you describe. This is the under Focus Next Group/Focus Previous Group in the keyboard shortcut settings so you could remap this to something else if you prefer.
or
CTRL+1/2/3
To specify focus in editor group 1/2/3

Visual Studio Code: How to split the editor vertically

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