有人知道在Visual Studio Code中切换编辑器和集成终端的快捷键(Mac和Linux)吗?
当前回答
嘿,我的工作步骤是:
CTRL + shift+ p,寻找首选项:键盘快捷键
或者你可以使用CTRL k + CTRL s直接打开它
在搜索框中寻找终端:焦点终端,我为自己设置了alt + T alt + T,但你可以选择你想要的组合 在搜索框中搜索“视图:焦点活动编辑器组”,为自己设置alt + E alt + E,但同样你可以选择你想要的组合
就是这样,我希望这对你有所帮助
其他回答
通常,VS Code使用ctrl+j打开终端,所以我创建了一个键绑定来切换与ctrl+k组合,如下在keybindings.json:
[
{
"key": "ctrl+k",
"command": "workbench.action.terminal.focus"
},
{
"key": "ctrl+k",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
}
]
下面是我的方法,它提供了在活动终端之间导航的一致方式,以及在终端和编辑器窗格之间跳转而无需关闭终端视图。您可以尝试将此添加到您的键绑定。我建议你使用键盘绑定UI (Mac上的cmd+K cmd+S),这样你就可以检查/管理冲突等。
这样,我可以使用ctrl+x <箭头方向>导航到任何可见的编辑器或终端。一旦光标在终端部分,您可以使用ctrl+x ctrl+up或ctrl+x ctrl+down在活动终端中循环。
cmd-J仍然用于隐藏/显示终端窗格。
{
"key": "ctrl+x right",
"command": "workbench.action.terminal.focusNextPane",
"when": "terminalFocus"
},
{
"key": "ctrl+x left",
"command": "workbench.action.terminal.focusPreviousPane",
"when": "terminalFocus"
},
{
"key": "ctrl+x ctrl+down",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus"
},
{
"key": "ctrl+x ctrl+up",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus"
},
{
"key": "ctrl+x up",
"command": "workbench.action.navigateUp"
},
{
"key": "ctrl+x down",
"command": "workbench.action.navigateDown"
},
{
"key": "ctrl+x left",
"command": "workbench.action.navigateLeft",
"when": "!terminalFocus"
},
{
"key": "ctrl+x right",
"command": "workbench.action.navigateRight",
"when": "!terminalFocus"
},
我的1.56 VS Code的工作原理是:
Ctrl + ~ to focus on terminal window from editor
Ctrl + 9 to focus back on editor from terminal
为了在ctrl+ '组合之间进行切换,我尝试了所有列出的答案,但运气不好。对于那些像我一样有类似问题的人,尝试以下键绑定中的快捷方式。在VSCode 1.59+上测试
[
{
"key": "ctrl+oem_8","command": "workbench.action.terminal.focus", "when": "!terminalFocus"
},
{
"key": "ctrl+oem_8","command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"
}
]
这不是确切的问题,但我发现它非常有用和相关。
如果有人想从一个终端切换到另一个终端,也可以在Visual Studio的集成终端面板中打开,您可以搜索:
终端:关注下一个终端
或者添加以下快捷键,用键盘组合更快。
{
"key": "alt+cmd+right",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus"
},
{
"key": "alt+cmd+left",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus"
},
推荐文章
- 如何设置每个文件类型的标签大小?
- 我如何添加环境变量启动。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程序的工作目录