我需要在Visual Studio代码中清除终端的内容。
每次我使用Maven时,终端的输出都会附加到以前的构建中,这让我感到困惑。
我如何清除终端窗口与一些命令或键盘快捷方式?
CLS不起作用;它只隐藏文本。
我需要在Visual Studio代码中清除终端的内容。
每次我使用Maven时,终端的输出都会附加到以前的构建中,这让我感到困惑。
我如何清除终端窗口与一些命令或键盘快捷方式?
CLS不起作用;它只隐藏文本。
当前回答
workbench.action.terminal.clear不再工作(至少对Mac上的VS Code Insiders 1.54)
下面是将CTRL+L映射到默认控制台功能的方法。
{
"key": "ctrl+l",
"command": "workbench.action.terminal.sendSequence",
"args": {"text": "\u000c"},
"when": "terminalFocus"
}
其他回答
要使用最新版本VS-Code上的默认键绑定清除终端,请按CTRL-L。
使用Ctrl + K。这将在Visual Studio代码中清理控制台。
每个注释,在VSCode(1.29及以上)的后期版本中,这个快捷方式是缺失的/需要手动创建。
Navigate: File > Preferences > Keyboard Shortcuts search for workbench.action.terminal.clear If it has no mapping or you wish to change the mapping, continue; otherwise note & use the existing mapping Double click on this entry & you'll be prompted for a key binding. Hold CTRL and tap K. Ctrl + K should now be listed. Press enter to save this mapping Right click the entry and select Change when expression. Type terminalFocus then press enter. That's it. Now, when the terminal is in focus and you press Ctrl+K you'll get the behaviour you'd have expected to get from running clear/cls.
点击VS code屏幕左下角的齿轮按钮 然后搜索“终端:清除” 默认情况下没有键盘快捷方式。 只需双击终端:清除 并给出您选择的清除终端的首选快捷方式。 通常使用ctrl+k,因为该快捷键没有与任何命令一起分配。
供参考:这个方法与@SuRa相同,但更简单一点。 顺便说一句:我使用的是VS Code 1.43.0版本
只需在终端(窗口)中输入'clear'即可 或者ctrl+shift+p和 在MAC上-右键单击
您可以从设置菜单更改(至少从版本1.30.2及以上)…
在Mac上,只需点击代码>首选项>设置。
然后搜索“清除”并选中“清除以前的输出”。