Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 如何在VisualStudio代码中的终端之间切换?_Visual Studio Code - Fatal编程技术网

Visual studio code 如何在VisualStudio代码中的终端之间切换?

Visual studio code 如何在VisualStudio代码中的终端之间切换?,visual-studio-code,Visual Studio Code,我希望在VisualStudio代码中打开的终端之间切换 有了这个问题,我正确地设置了焦点,但我想在终端之间切换,而不仅仅是从代码切换到终端 有什么办法吗?仔细看,我发现: { "key": "shift+cmd+]", "command": "workbench.action.terminal.focusNext", "when": "terminalFocus" } :)转到文件→ 偏好→ 键盘快捷键或只需按Ctrl+k+Ctrl+s 然后单击右上角的图标,打开keybindi

我希望在VisualStudio代码中打开的终端之间切换

有了这个问题,我正确地设置了焦点,但我想在终端之间切换,而不仅仅是从代码切换到终端


有什么办法吗?

仔细看,我发现:

{
  "key": "shift+cmd+]",
  "command": "workbench.action.terminal.focusNext",
  "when": "terminalFocus"
}
:)

转到文件→ 偏好→ 键盘快捷键或只需按Ctrl+k+Ctrl+s

然后单击右上角的图标,打开
keybindings.json
文件:

尝试将以下两个条目添加到此文件:

{
    "key": "ctrl+pagedown",
    "command": "workbench.action.terminal.focusNext",
    "when": "terminalFocus"
},
{
    "key": "ctrl+pageup",
    "command": "workbench.action.terminal.focusPrevious",
    "when": "terminalFocus"
}
注意:在Mac上,将ctrl更改为cmd


alt
+
向上/向下左/右箭头
在拆分的终端之间切换。

以下是我的方法,它提供了在活动终端之间导航以及在终端和编辑器窗格之间跳转的一致方式。您可以尝试直接将其添加到您的
keybindings.json
,但我建议您使用keybinding UI(
cmd+K cmd+S
,在Mac上),以便查看/管理冲突等

有了它,我可以使用
ctrl+x
导航到任何可见的编辑器或终端。光标位于终端部分后,您可以使用
ctrl+x ctrl+up
ctrl+x ctrl+down
在活动终端之间循环(请注意,在屏幕分割终端之间移动是通过
ctrl+x left
ctrl+x right
完成的)

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"
    },

这是一项正在进行的工作,因为我试图在VS代码中模拟我的emacs行为,但缺少一些关键元素,比如能够按名称导航到终端缓冲区(无需使用鼠标/下拉菜单)。总的来说,我对一个令人惊叹的产品中糟糕的编辑组/窗格导航UX感到非常惊讶,但我正在努力适应它。

改进@Serhii Popov的答案

使用up和down而不是pageup和pagedown

转到
文件
→ <代码>首选项→ <代码>键盘快捷键或只需按Ctrl+k+Ctrl+s

然后单击右上角的图标打开keybindings.json文件:

然后将以下对象添加到文件中的数组中:

[
...
{
“键”:“ctrl+down”,
“命令”:“workbench.action.terminal.focusNext”,
“何时”:“终端焦点”
},
{
“键”:“ctrl+up”,
“命令”:“workbench.action.terminal.focusPrevious”,
“何时”:“终端焦点”
}
...
]
注意:在Mac电脑上,将Windows上的ctrl更改为cmd

切换终端
ctrl
+
~


要从1.56.0版起切换回代码编辑器
ctrl
+
1

,VS代码中内置了切换终端的支持:

新密钥绑定

此版本的终端有几个新的默认键绑定:

  • 移动到上一个终端-
    Ctrl+PageUp(macOS Cmd+Shift+])
  • 移动到下一个终端-
    Ctrl+PageDown(macOS Cmd+shift+[)
  • 焦点终端选项卡视图-
    Ctrl+Shift+\(macOS Cmd+Shift+\)
    -终端选项卡预览
  • 与往常一样,可以删除或自定义这些默认键绑定 可以通过keybindings系统添加keybindings


    直到今天,我仍然避免使用集成控制台。希望有人能给我一个好的启示workflow@GottZ我认为它主要用于登录集群。如果没有集成控制台,您还可以如何打开文件?@giannisgonidelis,因为我们现在是2020年,我同意。集成控制台已经超越了xterm.js你在哪里添加这个?
    settings.json
    ?要添加它,请转到文件>首选项>键盘快捷键。然后打开“keybindings.json”。下面@Serhii给出的答案基本上是windows用户“键”的正确过程:“shift+ctrl+]”@baldam谢谢。这应该是问题的正确答案,但不幸的是,
    focusNext
    对我不起作用。相反,
    focusNextPane
    工作起来很有魅力。
    focusNextPane
    适用于拆分终端,而
    focusNext
    适用于下拉列表中的不同终端。您可能还需要按alt来获得focuslove此-谢谢!我不确定这算不算是对他们答案的“改进”。你复制粘贴了它并改变了一件事。谢谢你的回答,我在Ubuntu上,它有“命令”:“workbench.action.terminal.focusPreviousPane”,需要删除最后的窗格。您可以为答案添加快捷方式:
    workbench.action.terminal.focusNext
    workbench.action.terminal.focusPrevious
    ,我发现从when表达式中删除
    terminalFocus
    更好,因此,您可以在我的国际西班牙语ISO键盘上更改终端,而无需关注终端,这似乎不起作用,尽管如果我切换到美国键盘,它会起作用。(Cmd AltGr-[和Cmd Shift AltGr-[)都不起作用。它似乎是Ctrl选项Cmd-ç