VS Code Key Binding 用于在终端屏幕之间快速切换? [英] VS Code Key Binding for quick switch between terminal screens?

查看:20
本文介绍了VS Code Key Binding 用于在终端屏幕之间快速切换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚是否有一种方法可以设置键绑定以允许在我在内置终端中打开的终端窗口之间快速切换,而不必每次都单击下拉选择器.有没有人知道在进行个人键绑定时的命令,或者我可以在哪里看到 VSC 的所有可能命令的列表?提前致谢!

I'm trying to figure out if there is a way to set up a key binding to allow a quick switch between the terminal windows I have open in the built in terminal rather than having to click on the drop down selector each time. Does anyone know the command for this when making a personal key binding or where I can see a list of all the possible commands for VSC? Thank you in advance!

推荐答案

来自 Microsoft 文档 有个提示:

提示:如果您广泛使用多个终端,您可以添加密钥概述了 focusNext、focusPrevious 和 kill 命令的绑定在 Key Bindings 部分以允许在它们之间使用导航只有键盘.

Tip: If you use multiple terminals extensively, you can add key bindings for the focusNext, focusPrevious and kill commands outlined in the Key Bindings section to allow navigation between them using only the keyboard.

来自此处:

其他终端命令可用并且可以绑定到您的首选键盘快捷键.他们是:workbench.action.terminal.focus:聚焦终端.这就像切换但聚焦终端而不是隐藏它,如果它是可见的.

Other terminal commands are available and can be bound to your preferred keyboard shortcuts. They are: workbench.action.terminal.focus: Focus the terminal. This is like toggle but focuses the terminal instead of hiding it, if it is visible.

workbench.action.terminal.focusNext: Focuses the next terminal instance. 
workbench.action.terminal.focusPrevious: Focuses the previous terminal instance. 
workbench.action.terminal.kill: Remove the current terminal instance.
workbench.action.terminal.runSelectedText: Run the selected text in the terminal instance.

只需将这些快捷键分配给您首选的键绑定,您就可以开始使用了.

Just assign these shortcuts to your preferred keybindings and you are good to go.

这可能不是直接跳转到终端的解决方案(例如 vims gt2),但它确实是一个开始.

That might not be a solution for jumping directly to a terminal (e.g. like vims gt2) but it certainly is a start.

只是玩弄了一下,发现您也可以专注于特定的终端.只需将这些命令中的任何一个添加到您的 keybindings.json 中即可!

Just toyed around and found that you can also focus on a specific terminal. Just add any of these commands to your keybindings.json and you are good to go!

// - workbench.action.terminal.focusAtIndex1
// - workbench.action.terminal.focusAtIndex2
// - workbench.action.terminal.focusAtIndex3
// - workbench.action.terminal.focusAtIndex4
// - workbench.action.terminal.focusAtIndex5
// - workbench.action.terminal.focusAtIndex6
// - workbench.action.terminal.focusAtIndex7
// - workbench.action.terminal.focusAtIndex8
// - workbench.action.terminal.focusAtIndex9

例如{ "key": "yourkeybinding", "command": "workbench.action.terminal.focusAtIndex1"}

这篇关于VS Code Key Binding 用于在终端屏幕之间快速切换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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