本文介绍了当 terminalFocus 时切换侧边栏可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最常用的操作是 ctrl+b,它可以切换侧边栏的可见性.但是,当我专注于终端并按 Ctrl + b 时,它会输入 ^B 而不是切换焦点.

My most used action is ctrl+b which toggles the sidebars visibility. However when I am focused in the terminal and I press Ctrl + b it types ^B instead of toggling the focus.

我尝试将其添加到我的键绑定中:

I tried add this to my keybindings:

{ "key": "ctrl+b", "command": "workbench.action.toggleSidebarVisibility", "when": "terminalFocus" }

注意 terminalFocus 但是它仍然输入 ^B,是否可以在终端聚焦时使 ctrl+b 工作?

Notice the terminalFocus however it still types the ^B, is it possible to make ctrl+b work when terminal is focused?

推荐答案

问题是终端在 vscode 有机会处理它之前捕获了关键输入.根据 vscode 用户和工作区设置 documentation 有一个选项允许跳过某些命令终点站.您将想要将您的命令添加到命令列表以跳过 shell:

The issue is the terminal captures the key input before vscode has a chance to handle it. According the vscode user and workspace settings documentation there is an option to allow certain commands to skip the terminal. You are going to want to add your command to the list of commands to skip the shell:

"terminal.integrated.commandsToSkipShell": [
    "workbench.action.toggleSidebarVisibility",
    ...
],

这篇关于当 terminalFocus 时切换侧边栏可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 05:33