Abh*_*eet 392 visual-studio-code
有没有人知道键盘快捷键(Mac和Linux)在Visual Studio Code中切换编辑器和集成终端之间的焦点.
wgj*_*wgj 776
虽然VS Code有很多模态切换和导航快捷方式,但没有一个专门用于"从编辑器移动到终端,然后再返回".但是,您可以通过重载key和使用when 子句来组合这两个步骤.
// Toggle between terminal and editor focus
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus"},
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"}
Run Code Online (Sandbox Code Playgroud)
通过这些快捷方式,我将使用相同的按键在编辑器和集成终端之间进行关注.
Rah*_*kla 83
ctrl +`:专注于集成终端
ctrl + 1:专注于编辑器(如果editor-2命令为ctrl + 2)
sch*_*udu 55
比赛有点晚了,但我在下面配置了以下内容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"
}
Run Code Online (Sandbox Code Playgroud)
我想要单独的键来打开/关闭终端并在窗口之间来回切换焦点.
小智 52
Ctrl+ J工作; 但也显示/隐藏控制台.
Shu*_*ain 20
从版本:1.26.1(linux)开始,默认情况下不设置快捷方式.设置快捷方式
对于编辑器焦点已默认设置.
Sam*_* Xu 18
我将我配置为以下因为我发现ctrl+ `有点难以按下.
{
"key": "ctrl+k",
"command": "workbench.action.focusActiveEditorGroup",
"when": "terminalFocus"
},
{
"key": "ctrl+j",
"command": "workbench.action.terminal.focus",
"when": "!terminalFocus"
}
Run Code Online (Sandbox Code Playgroud)
我还配置了以下内容在编辑器组之间移动.
{
"key": "ctrl+h",
"command": "workbench.action.focusPreviousGroup",
"when": "!terminalFocus"
},
{
"key": "ctrl+l",
"command": "workbench.action.focusNextGroup",
"when": "!terminalFocus"
}
Run Code Online (Sandbox Code Playgroud)
顺便说一下,我从Mac 配置Caps Lock到ctrl了Mac System Preferences => keyboard =>Modifier Keys.
fel*_*gnu 11
通常,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"
}
]
Run Code Online (Sandbox Code Playgroud)
根据vscode键盘快捷键文档页面,切换集成终端的默认键绑定是"Ctrl +`" .如果你不喜欢这种快捷方式,你可以通过添加类似于以下内容的东西在你的keybindings文件中更改它:
{ "key": "ctrl+l", "command": "workbench.action.terminal.toggleTerminal" }
Run Code Online (Sandbox Code Playgroud)
简单地聚焦底部面板似乎没有默认的键绑定.因此,如果您不想切换底部面板,则需要在keybindings文件中添加类似以下内容:
{ "key": "ctrl+t", "command": "workbench.action.focusPanel" }
Run Code Online (Sandbox Code Playgroud)
适用于我的 1.56 VS Code 的是:
Ctrl + ~ to focus on terminal window from editor
Ctrl + 9 to focus back on editor from terminal
Run Code Online (Sandbox Code Playgroud)
适用于任何键盘布局的简单 WINDOWS 解决方案(可能适用于其他操作系统,但未经测试)
\n\n我使用芬兰键盘,因此上述方法均无效,但这应该适用于所有键盘。
\n\n嘿,我完成这项工作的步骤是:
ctrl + shift+ p 并寻找 preferences: keyboard shortcuts或者您可以使用ctrl k + ctrl s它直接打开它
在搜索框中查找 Terminal: Focus Terminal,我为自己设置,alt + T alt + T但您可以选择您想要的组合
在搜索框中查找View: Focus Active Editor Group,为自己设置,alt + E alt + E但您可以再次选择所需的组合
就是这样,我希望这有帮助
这并不完全是所问的问题,但我发现它非常有用且相关。
如果有人想从一个终端切换到另一个终端也在Visual Studio的集成终端面板中打开,可以搜索:
Terminal: Focus Next Terminal
或者添加以下快捷键并使用键盘组合更快地完成。
{
"key": "alt+cmd+right",
"command": "workbench.action.terminal.focusNext",
"when": "terminalFocus"
},
{
"key": "alt+cmd+left",
"command": "workbench.action.terminal.focusPrevious",
"when": "terminalFocus"
},
Run Code Online (Sandbox Code Playgroud)
Shubham Jain 的答案是现在使用内置键盘快捷键的最佳选择。
到Ctrl+;
到Ctrl+L
通过这种方式,您可以在终端和编辑器之间移动焦点,并在附近切换终端。
这是一种添加自己的键绑定以切换焦点的方法。
Ctrl+Shift+P并搜索键盘快捷键并点击此按钮(首选项:打开键盘快捷键)。Alt+Shift+T去终端。Ctrl+tab使用 VSCode(1.52.1) 在 Windows 10 机器上测试
100% 工作设置...
\n打开命令面板(Ctrl+Shift+P Windows/Linux 或 \xe2\x87\xa7 \xe2\x8c\x98 P Mac)。
\n输入“首选项:打开键盘快捷键 (JSON)”并按 Enter。
\n将以下条目添加到 keybindings.json 文件中:
\n[\n { "key": "alt+right", "command": "workbench.action.terminal.focus"},\n { "key": "alt+left", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"} \n]\nRun Code Online (Sandbox Code Playgroud)\n\n\nworkbench.action.terminal.focus:从编辑器切换到\n终端。 workbench.action.focusActiveEditorGroup:\n从终端切换到编辑器。
\n
| 归档时间: |
|
| 查看次数: |
76566 次 |
| 最近记录: |