我需要在Visual Studio代码中清除终端的内容。
每次我使用Maven时,终端的输出都会附加到以前的构建中,这让我感到困惑。
我如何清除终端窗口与一些命令或键盘快捷方式?
CLS不起作用;它只隐藏文本。
我需要在Visual Studio代码中清除终端的内容。
每次我使用Maven时,终端的输出都会附加到以前的构建中,这让我感到困惑。
我如何清除终端窗口与一些命令或键盘快捷方式?
CLS不起作用;它只隐藏文本。
当前回答
使用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.
其他回答
默认情况下,在VSCode中没有与清除终端相关的键绑定。因此,必须按照以下步骤添加一个NEW Keybinding:
导航:文件—>首选项—>键盘快捷键。(或者同时使用Ctrl + K和Ctrl + S) 在顶部的搜索栏中输入:终端:清除。 带有Command: Terminal:Clear的条目将显示以下VSCode命令workbench.action.terminal.clear。 右键单击它,并按更改键绑定。然后一起按Ctrl + K,然后回车。它将被拯救。 再次右键单击并按“更改表达式”。只需输入:terminalFocus。它将被拯救。
最后,打开集成终端,焦点在终端内,按Ctrl + K。
使用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.
F1键打开快捷方式为我使用windows 10。然后输入Terminal,你会看到清晰的选项。
对于MacBook来说,可能不是Cmd + K…
关于Cmd + K不起作用的情况有很长的讨论。 就我而言,我用
cmd+K +cmd+ K
转到菜单首选项->快捷键->搜索(“清除”)。把单K改成双K…
要在VS Code中清除终端,只需按Ctrl + Shift + P键,这将打开一个命令面板,并键入命令Terminal: clear。你也可以去任务栏的左上角查看vs code,然后打开命令面板。
这将很容易清除终端,并为您在终端中打开的任何目录工作。 这是适用于Windows的,也试试它是否适用于Mac。
此命令适用于所有VS代码版本,包括最新版本1.52.1