在 Visual Studio Code 中的编辑器和集成终端之间切换焦点 [英] Switch focus between editor and integrated terminal in Visual Studio Code

查看:43
本文介绍了在 Visual Studio Code 中的编辑器和集成终端之间切换焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道在 Visual Studio Code 中在编辑器和集成终端之间切换焦点的键盘快捷键(Mac 和 Linux)吗?

Does anyone know the keyboard shortcut (Mac and Linux) to switch the focus between editor and integrated terminal in Visual Studio Code?

推荐答案

虽然 VS Code 有很多模式切换和导航快捷方式,但没有一个专门用于从编辑器移动到终端,然后再返回".但是,您可以通过重载 key 并使用 when 子句.

While there are a lot of modal toggles and navigation shortcuts for VS Code, there isn't one specifically for "move from editor to terminal, and back again". However you can compose the two steps by overloading the key and using the when clause.

从编辑器打开 keybindings.json:CMD-SHIFT-P -> 首选项:打开键盘快捷键文件并添加以下条目:

Open the keybindings.json from the editor: CMD-SHIFT-P -> Preferences: Open Keyboard Shortcuts File and add these entries:

// Toggle between terminal and editor focus
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus"},
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"}

通过这些快捷方式,我将使用相同的按键在编辑器和集成终端之间聚焦.

With these shortcuts I will focus between the editor and the Integrated Terminal using the same keystroke.

这篇关于在 Visual Studio Code 中的编辑器和集成终端之间切换焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆