如何清除 Visual Studio Code 中的终端? [英] How can I clear the terminal in Visual Studio Code?

查看:44
本文介绍了如何清除 Visual Studio Code 中的终端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Visual Studio Code 中清理终端的内容.

I need to clean the contents of the terminal in Visual Studio Code.

每次使用Maven时,终端的输出都附加到之前的构建中,这让我很困惑.

Every time I use Maven, the output of the terminal is attached to the previous build, which is confusing me.

如何使用某些命令或键盘快捷键清除终端窗口?

How do I clear the terminal window with some command or keyboard shortcut?

cls 不起作用;它只隐藏文本.

cls doesn't work; it only hides the text.

推荐答案

使用 Ctrl+K.这会在 Visual Studio Code 中清理您的控制台.

Use Ctrl+K. This goes clean your console in Visual Studio Code.

根据评论,在更高版本的 VSCode(1.29 及更高版本)中,缺少此快捷方式/需要手动创建.

Per comments, in later versions of VSCode (1.29 and above) this shortcut is missing / needs to be created manually.

  • 导航:文件 >首选项 >键盘快捷键
  • 搜索workbench.action.terminal.clear
  • 如果它没有映射或者您希望更改映射,请继续;否则请注意 &使用现有的映射
  • 双击此条目 &系统会提示您进行键绑定.按住 CTRL 并点击 K.Ctrl + K 现在应该被列出.按 Enter 键保存此映射
  • 右键单击该条目并选择 Change when expression.输入 terminalFocus 然后按回车键.
  • 就是这样.现在,当终端处于焦点并且您按下 Ctrl+K 时,您将获得您期望通过运行 clear/cls.
  • 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.

这篇关于如何清除 Visual Studio Code 中的终端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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