有人知道在Visual Studio Code中切换编辑器和集成终端的快捷键(Mac和Linux)吗?
当前回答
对于版本:1.26.1 (linux),默认情况下没有设置快捷方式。 设置快捷方式
打开键盘快捷键面板[ctrl + k, ctrl + s] 搜索焦点终端
设置快捷方式
编辑器的焦点已默认设置。
其他回答
我把我的配置如下,因为我发现ctrl+ '有点难按。
{
"key": "ctrl+k",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
},
{
"key": "ctrl+j",
"command": "workbench.action.terminal.focus",
"when": "!terminalFocus"
}
我还配置了以下内容,以便在编辑器组之间移动。
{
"key": "ctrl+h",
"command": "workbench.action.focusPreviousGroup",
"when": "!terminalFocus"
},
{
"key": "ctrl+l",
"command": "workbench.action.focusNextGroup",
"when": "!terminalFocus"
}
顺便说一下,我在Mac上从系统首选项=>键盘=>修改器键配置了Caps Lock。
使用keybindings.json中的键绑定:
CTRL+j和CTRL+k将焦点在编辑器组中的编辑器和终端中的终端窗口之间转移 CTRL+h和CTRL+l在包括终端在内的编辑器组之间转移焦点
(这些键绑定对vim用户来说应该特别自然。其他人可能希望把h/j/k/l换成左/下/上/右)
// In an editor group, ctrl+j and ctrl+k jump between editor windows
{ "key": "ctrl+j", "command": "workbench.action.nextEditorInGroup" },
{ "key": "ctrl+k", "command": "workbench.action.previousEditorInGroup" },
// In the terminal, ctrl+j and ctrl+k jump between terminal windows
{
"key": "ctrl+j",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus"
},
{
"key": "ctrl+k",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus"
},
// In the work area, ctrl+j and ctrl+k jump between editor groups
{ "key": "ctrl+h", "command": "workbench.action.focusPreviousGroup" },
{ "key": "ctrl+l", "command": "workbench.action.focusNextGroup" },
// in the first editor group terminal, jump "back" to the terminal (if there is a terminal open)
{
"key": "ctrl+h",
"when": " terminalHasBeenCreated && terminalIsOpen && activeEditorGroupIndex == 1",
"command": "workbench.action.terminal.focus"
},
// in the last editor group terminal, jump "forward" to the terminal (if there is a terminal open)
{
"key": "ctrl+l",
"when": "terminalHasBeenCreated && terminalIsOpen && activeEditorGroupLast",
"command": "workbench.action.terminal.focus"
},
// in the terminal, jump "back" to the last editor group
{
"key": "ctrl+h",
"command": "workbench.action.focusLastEditorGroup",
"when": "terminalFocus"
},
// in the terminal, jump "forward" to the last first group
{
"key": "ctrl+l",
"command": "workbench.action.focusFirstEditorGroup",
"when": "terminalFocus"
},
Shubham Jain的答案是现在使用内置的键盘快捷键的最佳选择。
我映射
Ctrl +;
和重新映射
Ctrl + L
这样你就可以在终端和编辑器之间移动焦点,并在近距离切换终端。
有点晚了,但我在keybindings.json中配置了我的如下:
{
"key": "ctrl+`",
"command": "workbench.action.terminal.focus",
"when": "editorTextFocus"
},
{
"key": "ctrl+`",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
},
{
"key": "alt+`",
"command": "workbench.action.terminal.toggleTerminal"
}
我想要单独的键来打开/关闭终端和在窗口之间来回切换焦点。
下面是一种添加自己的键绑定来切换焦点的方法。
打开VSCode 按Ctrl+Shift+P,搜索键盘快捷键并点击这个(首选项:打开键盘快捷键)。 在搜索面板中搜索“聚焦终端”并找到该选项(终端:聚焦终端视图)并单击加号图标。
输入你喜欢的没有使用的快捷方式,然后按Enter。 进入编辑器模式,尝试使用快捷方式。 现在按Alt+Shift+T进入终端。 想回去找编辑吗?只需按Ctrl+tab
在Windows 10机器上使用VSCode(1.52.1)进行测试
推荐文章
- 如何设置每个文件类型的标签大小?
- 我如何添加环境变量启动。VSCode中的json
- 如何格式化Visual Studio Code项目中的所有文件?
- Pylint在Visual Studio代码中“未解决的导入”错误
- 如何在VS Code中默认打开文本换行
- 在Visual Studio代码中更改突出显示文本的颜色
- Visual studio代码-键盘快捷键-全部展开/折叠
- Visual Studio Code无法检测已安装的Git
- 禁用Visual Studio代码中的工具提示提示
- Visual Studio Code -将空格转换为制表符
- 在VSCode中的列自动硬换行
- Visual Studio Code:格式没有使用缩进设置
- 如何排除文件扩展名和语言从“格式保存”在VSCode?
- Visual Studio代码- URI的目标不存在" package:flutter/material.dart "
- VSCode——如何设置调试Python程序的工作目录