Visual Studio Code and the inbuilt terminal

Did you know that there is an embedded terminal running within Visual Studio Code as of May 2016? I didn’t! 2016-11-01-VSCode-and-the-terminal

Wait, what?

Yeah, if you’re like me, and you’ve been using VS Code for a while, but not really paying attention to the release notes, then you may have been greeted with a nice surprise when launching a new instance. Namely, this screen:

Whoa there, what's that terminal thing they mention?

See that bottom line? Toggle Terminal!? It turns out that there has been an integrated terminal in VS Code for quite some time, and it’s pretty slick.

Using Ctrl+` now launches a perfectly reasonable cmd terminal (at least here, on Windows), which you can switch into a “more fully fledged console” by launching PowerShell:

Terminal wonderfulness

Unlock PoshGit

As an added bonus, I have a Set-Prompt command which I’ve uploaded over here that I load into my Microsoft.Powershell_profile.ps1 (in ~\Documents\WindowsPowerShell\) so that I can call Set-Prompt GitHub and – assuming you have PostGit installed on Windows – have something like this:

Ooo, now with pretty colors

As a result now, when I’m blogging, there’s no need to switch back and forth between a PowerShell window and VS Code, I can do it all from a single window:

Git prompts and Powershell in VS Code, yay!

There are plenty more supporting docs on this, at the official site, and there are plenty of options for modifying it as you see fit, so go nuts!

Multiple instances?

You can launch multiple instances of the terminal, so why not set it up in another instance of the terminal and switch between them easily? By default the keybindings are not preset, but there’s a simple solution to that: just add your own keybindings!

/// Add this in your own keybindings.json
/// Or just use Ctrl+Shif+P and type SHORTCUTS
        "key":      "ctrl+` n",
        "command":  "workbench.action.terminal.focusNext",
        "when":     "terminalFocus"
        "key":      "ctrl+` p",
        "command":  "workbench.action.terminal.focusPrevious",
        "when":     "terminalFocus"

What about Jekyll?

Great idea! Back in Part 4 I showed you how to set up Jekyll in Docker, and because this is a command window, you can check Docker, or launch containers, or attach to running containers – the sky is your limit!

Keep an eye on those notes

So that’s all for now; one less reason to leave the Visual Studio Code window, and one more reason to keep an eye on the Release Notes in the future!

I'm Pat Hermens, an Australian that's spent a decent amount of time living & working in the Netherlands.
I am a .NET developer (for the last 20 years or so), a technical manager, a public speaker, a happy husband and father, but most of all; I'm just a nerd.
I'm currently a Director of Software Engineering at Slalom Build in Sydney, Australia, and I was previously Development Manager at Coolblue in Rotterdam, NL.

Leave a comment