Last updated: Apr 6, 2024
Reading time·6 min
The easiest way to split the editor vertically is to use the Move Editor into Next Group command.
Ctrl
+ Shift
+ P
on Windows and LinuxCommand
+ Shift
+ P
on macOSF1
to open the Command Palette.Here is a short clip that demonstrates how this works.
You can also use a keyboard shortcut to move the editor to the next group:
Ctrl
+ Alt
+ Right arrow keyCtrl
+ Cmd
+ Right arrow keyThere is also a Move Editor into Previous Group command if you want to move the editor to the group on the left.
Here is a short clip that demonstrates how the command works.
You can also use a keyboard shortcut to trigger the command:
Ctrl
+ Alt
+ Left arrow keyCtrl
+ Cmd
+ Left arrow keyUse the following keyboard shortcut to switch between the split window panes:
Ctrl
+ 1, Ctrl
+ 2, Ctrl
+ 3, etc.Cmd
+ 1, Cmd
+ 2, Cmd
+ 3, etc.You can also set up keyboard shortcuts to navigate between split screens.
Here is an example that uses the ctrl
+ hjkl
keys to navigate between split
window panes VIM style.
Note that you can adjust the keyboard shortcuts according to your preference.
To set a keyboard shortcut for the action:
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.keybindings.json
file.[ { "key": "ctrl+h", "command": "workbench.action.navigateLeft" }, { "key": "ctrl+l", "command": "workbench.action.navigateRight" }, { "key": "ctrl+k", "command": "workbench.action.navigateUp" }, { "key": "ctrl+j", "command": "workbench.action.navigateDown" } ]
If you already have keyboard shortcuts in the file, you only have to add the
objects {}
.
Make sure to not add a second set of square brackets []
to the file.
If you are on macOS, you can use cmd+h
, cmd+l
, etc.
The example above uses:
ctrl+h
to navigate to the left.ctrl+l
to navigate to the right.ctrl+k
to navigate up.ctrl+j
to navigate down.You can also use the User Interface to set your keyboard shortcuts.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.Repeat the same for:
Another way to split the screen vertically in VS Code is to use one of the following 2 commands:
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.A negative of using the Split Editor Right command is that it splits the screen but duplicates the same file to the right which is very rarely what you want.
You can also use a keyboard shortcut to trigger the command:
Ctrl
+ \
.Cmd
+ \
.There is also an icon at the top right corner that allows you to split the editor to the right.
Here is a short clip of how this works.
If you press and hold the Alt
key (or Option ⌥
) on macOS and click on the
same icon, you split the editor horizontally.
You can also achieve the same result using the Command Palette.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.By default, the command is not bound to a specific keyboard shortcut.
If you need to set up a keyboard shortcut.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.You can use a keyboard shortcut if you need to change the editor split layout from horizontal to vertical or vice versa.
Alt
+ Shift
+ 0
(zero, no the letter o
)Cmd ⌘
+ Option ⌥
+ 0
(zero, not the letter o
)You can also set your preferred layout by using the top menu.
Alt
to show the top menu on Windows and Linux.The last option in the menu to the right is Flip Layout. It can also be used to switch from a horizontal to a vertical layout and vice versa.
You can also use the Command Palette to select your preferred layout.
Ctrl
+ Shift
+ P
on Windows and Linux.Command
+ Shift
+ P
on macOS.F1
to open the Command Palette.You can also split the editor by right-clicking on a tab and selecting one of the following options:
Here is a short clip that demonstrates the process.
You can also use drag and drop to achieve the same result.
You can learn more about the related topics by checking out the following tutorials: