Pankaj-Talesara
Pankaj-Talesara

Reputation: 139

VS Code terminal, clear terminal before each run of code

I am learning C Programming currently on VS Code. I run program a lot of time repeatedly which mess up terminal. Mostly I use cls before running program to clear previous output of terminal. My default terminal is PowerShell in VS Code. Is there any way to clean terminal before each run.

What I have tried after google search:
-I have tried adding cls to powershell profile but it does not work on every code run.
-Checking clear previous output in coderunner settings didn't work either.

Upvotes: 1

Views: 1475

Answers (1)

Cpt.Whale
Cpt.Whale

Reputation: 5351

The easiest way is to add cls to the beginning of your code, but that's not always best:

enter image description here

You can also set a keyboard shortcut for clearing the console (Used to be ctrl+k, but was removed)

You don't want to replace the existing behavior when running code, but a pretty simple one-button solution could be setting up a vs code macro to do Terminal: Clear, and also run your open file in the terminal.

Upvotes: 1

Related Questions