有人知道在Visual Studio Code中切换编辑器和集成终端的快捷键(Mac和Linux)吗?
当前回答
我的1.56 VS Code的工作原理是:
Ctrl + ~ to focus on terminal window from editor
Ctrl + 9 to focus back on editor from terminal
其他回答
使用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"
},
根据VS Code键盘快捷键文档页,切换集成终端的默认键绑定是“Ctrl+ '”。如果你不喜欢这个快捷方式,你可以在你的键绑定文件中添加类似的东西来改变它:
{ "key": "ctrl+l", "command": "workbench.action.terminal.toggleTerminal" }
似乎没有一个默认的键绑定来简单地聚焦底部面板。所以,如果你不想切换底部面板,你需要在你的keybindings文件中添加类似以下内容:
{ "key": "ctrl+t", "command": "workbench.action.focusPanel" }
CTRL + -也可以,这意味着回到以前的光标位置
下面是一种添加自己的键绑定来切换焦点的方法。
打开VSCode 按Ctrl+Shift+P,搜索键盘快捷键并点击这个(首选项:打开键盘快捷键)。 在搜索面板中搜索“聚焦终端”并找到该选项(终端:聚焦终端视图)并单击加号图标。
输入你喜欢的没有使用的快捷方式,然后按Enter。 进入编辑器模式,尝试使用快捷方式。 现在按Alt+Shift+T进入终端。 想回去找编辑吗?只需按Ctrl+tab
在Windows 10机器上使用VSCode(1.52.1)进行测试
100%工作设置…
[
{ "key": "alt+right", "command": "workbench.action.terminal.focus"},
{ "key": "alt+left", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"}
]
从编辑器切换到 终端。workbench.action.focusActiveEditorGroup:切换 从终端到编辑器。
推荐文章
- Visual Studio代码如何解决合并冲突与git?
- Visual Studio代码-在文件末尾插入换行符
- 如何重新启动VScode编辑扩展的配置?
- Visual Studio代码PHP Intelephense保持显示不必要的错误
- 如何添加一个@顺风CSS规则CSS检查
- 我如何打开Visual Studio Code的设置。json文件?
- 在Visual Studio代码中运行的Angular应用程序中,TSLint扩展抛出错误
- 在Visual Studio代码编辑器中使用哪种字体以及如何更改字体?
- 如何设置Visual Studio代码来编译c++代码?
- 如何从Visual Studio代码中执行Python代码
- 如何在visual studio代码切换文本情况
- Visual Studio代码回滚缓冲区
- 'TypeError [ERR_INVALID_ARG_TYPE]: "path"参数必须是字符串类型。接收类型未定义'
- 我如何按住一个键并让它在VSCode中重复?
- 在Visual Studio Code中安装Nuget包