[英]VSCode: How to Split Editor Vertically
In Visual Studio code, a while ago, when I used View->Split Editor, it would split vertically.前段时间在 Visual Studio 代码中,当我使用 View->Split Editor 时,它会垂直拆分。 (One file on the left and one file on the right.) (左边一个文件,右边一个文件。)
I updated Visual Studio Code and when when I do View->Split Editor, it always splits horizontally.我更新了 Visual Studio Code,当我执行 View->Split Editor 时,它总是水平拆分。 (One file on the top and one file on the bottom.) (上一个文件,下一个文件。)
How can I split vertically?如何垂直拆分?
Grid
layout.您可以将编辑器拆分为Grid
布局。 Check View
=> Editor Layout
检查View
=> Editor Layout
** Someone update this with the lowest version where this became true. ** 有人用最低版本更新它,这成为现实。
View
=> Editor Layout
=> Flip Layout
上面给出的快捷方式的菜单项是View
=> Editor Layout
=> Flip Layout
{ "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.如果您正在寻找一种通过 GUI 进行更改的方法,至少在当前版本 1.10.1 中,如果您将鼠标悬停在EXPLORER
窗格中的OPEN EDITORS
组上,则会出现一个按钮,用于在水平和垂直之间切换编辑器组布局。
To split vertically:要垂直拆分:
⌘ + \\ Mac ⌘ + \\ Mac
command: workbench.action.splitEditor
命令: workbench.action.splitEditor
To split orthogonal (ie. horizontally in this case):要拆分正交(即在这种情况下是水平的):
⌘ + k + ⌘ + \\ Mac ⌘ + k + ⌘ + \\ Mac
command: workbench.action.splitEditorOrthogonal
命令: workbench.action.splitEditorOrthogonal
按CMD + SHIFT + P
(MAC) 并搜索Toggle Editor Group
Simply in windows只需在窗口中
ctrl + @ (the button 2 in the upper horizontal row of numbers in keyboard) ctrl + @(键盘上横排数字中的按钮2)
By default, editor groups are laid out in vertical columns (eg 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:
默认情况下,关闭编辑器组的最后一个编辑器也会关闭该组本身,但您可以使用新设置workbench.editor.closeEmptyGroups: false:
更改此行为workbench.editor.closeEmptyGroups: false:
There are a predefined set of editor layouts in the new View > Editor Layout menu:
在新的View > Editor Layout menu:
有一组预定义的编辑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.
如果您更喜欢在活动编辑器下方打开编辑器,请配置新设置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.
The key bindings has been changed with version 1.20: 1.20 版更改了键绑定:
SHIFT + ALT + 0 for Linux. SHIFT + ALT + 0对于 Linux。
Presumably the same works for Windows also and CMD + OPT + 0 for Mac.大概同样适用于 Windows 和CMD + OPT + 0为 Mac。
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.现在您已经打开了两个窗口,您必须使用PC (Alt + Shift + 1) 的组合键(Windows 和 Linux 操作系统)或MAC (Cmd + Option + 1) ,如此处 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 VSCode v1.30.2
Update: you can also drag a file from the Explorer to split the Editor in the same way above.更新:您还可以从资源管理器中拖动一个文件,以与上述相同的方式拆分编辑器。
Use Move editor into Next Group shortcut使用将编辑器移至下一组快捷方式
Mac: ^+⌘+-> Mac:^+⌘+->
If you want to change shortcut,如果要更改快捷方式,
Open command pallette打开命令面板
Mac: ⌘+shift+p Mac:⌘+shift+p
Select Preferences: Open Keyboard Shortcuts选择首选项:打开键盘快捷键
Search View: Move editor into Next Group搜索视图:将编辑器移至下一组
The best way is to configure the VSCode settings to make the default behavior the way you want:最好的方法是配置 VSCode 设置以按照您想要的方式设置默认行为:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.