Vscode: How to clear the contents of the terminal

Created on 24 Mar 2017  路  13Comments  路  Source: microsoft/vscode

  • VSCode Version:
  • OS Version:

Steps to Reproduce:
d:\test>cls
"cls" does not work when the contents is too long
How to clear the contents of the terminal

*question integrated-terminal

Most helpful comment

@csyj501 ctrl+k should work on Windows

All 13 comments

Terminal scroll bar is displayed "CLS" doesn't work

In OSX u can use cmd+k.

Enter command clear, if you are using Mac OS, press Cmd+K.

think you all,but i'm using windows!

@csyj501 ctrl+k should work on Windows

command +k on mac waits for a second key "chord"

is that just me?

@sebbean you need the terminal focused. If it doesn't work then you have keybindings overriding cmd+k

could be i selected "sublime" key preset

  {
    "key": "cmd+k",
    "command": "workbench.action.terminal.clear",
    "when": "terminalFocus"
  },

worked for me

This doesn't work for me on windows running VSCode version 1.17.2. The Keyboard Shortcuts page says the Clear command is using the default. I get the text ^K in the terminal when I try it.

@ajbeaven I don't think Windows has a default for this, if you want ctrl+k then add this to your keybindings.json:

  {
    "key": "ctrl+k",
    "command": "workbench.action.terminal.clear",
    "when": "terminalFocus"
  },

@Tyriar Oh, OK. I'm just confused with the following comment you made that everyone seems to be upvoting for some reason.

@csyj501 ctrl+k should work on Windows

This should be added to the default keybindings IMO.

@ajbeaven actually that guy's pretty smart, you should listen to him 馃槈, ctrl+k should work on Windows, it's just Linux that it's disabled on:

https://github.com/Microsoft/vscode/blob/7dd39116e7fc52f3e6ee587b3d3e8fdddf0f294c/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts#L338-L341

If it doesn't work, you likely have a ctrl+k chord keybinding defined, if that is the case you will need to redefine the ctrl+k keybinding at the bottom of your keybindings.json:

  {
    "key": "ctrl+k",
    "command": "workbench.action.terminal.clear",
    "when": "terminalFocus"
  },

Haha, yes indeed! I'm pretty sure I don't have any custom bindings already on ctrl+k. If that were the case the Keyboard Shortcuts page would indicate that it was a "User" instead of "Default" like it has now.

There are only 4 other entries in keybindings.json and none of them are ctrl+k. I've since added the recommended entry to the bottom and it started working. Of course, I figured that would work, but wanted to mention it here just in case it wasn't the default.

Was this page helpful?
0 / 5 - 0 ratings