loading...
Cover image for How to customize the new Windows Terminal with Visual Studio Code
Experts Inside

Windows Terminal Customization How to customize the new Windows Terminal with Visual Studio Code

kasuken profile image Emanuele Bartolesi Updated on ・4 min read

A few days ago Microsoft released a very early version of the new Windows Terminal.
The Windows Terminal is a new, modern, fast, efficient, powerful, and productive terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL.
Its main features include multiple tabs, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and custom themes, styles, and configurations.

Obviously, it's an opensource project hosted on GitHub: https://github.com/microsoft/terminal
Feel free to participate.

At the moment it's a little bit unstable and more features will come in the future, but I am using it for a few days and I like the idea.
Until now I using Cmder but Windows Terminal has some new promising features.

How to install

You can install Windows Terminal directly from the Windows Store or if you want to understand how it works, you can download the source, build it and launch the terminal.

The link for the Store version: https://www.microsoft.com/en-us/p/windows-terminal-preview/9n0dx20hk701
The link for GitHub project: https://github.com/microsoft/terminal
The source code and the project are really well documented.

The first launch

If you launch the app from the Start Menu, it looks like in the screenshot below.

The default terminal is PowerShell.

If you click on the "+" symbol the application launch another terminal in a new tab.
If you click on the down arrow symbol ⬇, you can choose the new terminal from a list.

There is another interesting button below the list, the settings button.

Settings

If you click on the down arrow and after that click on the button "Settings", at the moment, the settings file (it's a JSON file) will be opened in a new instance of Visual Studio.
If you want, instead, open the file directly, you can open Visual Studio Code and open the file directly from the directory: %USERPROFILE%\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState

In this file, you can find all settings for Windows Terminal.
At the moment you can interact with the settings only from this file but in the future, a UI will be added to the application.

Add new Profile

If you want to add a new profile, go the section "profiles" of the JSON settings file and add a new profile section like this below:

    {
        "acrylicOpacity" : 0.85,
        "background" : "#012456",
        "backgroundImage" : "C:/users/barto/AppData/Local/Packages/Microsoft.WindowsTerminal_8wekyb3d8bbwe/RoamingState/unicorn.gif",
        "backgroundImageOpacity" : 0.7,
        "backgroundImageStretchMode" : "uniformToFill",
        "closeOnExit" : false,
        "colorScheme" : "Solarized Dark",
        "commandline" : "powershell.exe",
        "cursorColor" : "#00FF00",
        "cursorHeight" : 25,
        "cursorShape" : "vintage",
        "fontFace" : "Fira Code",
        "fontSize" : 12,
        "guid" : "{79285a8e-036c-446f-8a9c-78994e34bf78}",
        "historySize" : 9001,
        "icon" : "ms-appdata:///roaming/pwsh-32.png",
        "name" : "PowerShell with Unicorn",
        "padding" : "0, 0, 0, 0",
        "snapOnInput" : true,
        "startingDirectory" : "%USERPROFILE%",
        "useAcrylic" : false
    }

If you want to copy this section from here, pay attention to the guid.
Remember to change it every time you paste in the file.
It is used to set the default terminal, for example, and it must be unique in the file.

As you can see in my profile section, you can add an image as background, change the font size, the cursor shape and much more.
For example, I use Fira Code as font because I like it also in Visual Studio Code.
It adds some awesome experience in the text.
You can download it from here: https://github.com/tonsky/FiraCode

If you want to impress your friend or your attendees at a session, you can add a gif as a background.

You can see it in action on the image below.

Color Schemes

At the end of the profiles.json file, you can find a section called "schemes".
From here you can add or change the default colors of your terminal.
If you want to use it in your new profile, you have to insert the same scheme name in the property "name" and in the "colorScheme" property for the profile section.

Share your profiles

I created a new gist on my profile to share my profiles settings and you can find it here: https://gist.github.com/kasuken/076d68b92e2a67dfda591587c77a40c0#file-profiles-json.
Share your profiles in the comment!
Together we can create something awesome!

**Update 27/06/2019

Some users asked for the gif.
I share them below!!!

Discussion

pic
Editor guide
Collapse
nikoheikkila profile image
Niko Heikkilä

It's a very promising terminal app which I will likely switch to once it matures.

The current version doesn't allow pressing AltGr with number keys which means I can't type certain important shell characters. Needs polishing, indeed.

Collapse
kasuken profile image
Emanuele Bartolesi Author

yes... very promising... let's see in the near future... :)

Collapse
alexanderviken profile image
Alexander Viken

The AltGr issue is fixed now it looks like. github.com/microsoft/terminal/issu...

Collapse
simbo1905 profile image
Simon Massey

We use the opens source “Git Bash” for windows on our office laptops. We then configure Visual Studio Code to use that as the integrated terminal. Then whenever we open a new Code window to switch to a different project we have an embedded bash in that Code window in the right folder. Git Bash as all the core tools (find, awk, sed, etc) and extras like ssh and gpg. This means that on legacy windows we have the same solid technology we use in the cloud. It also makes the windows experience the same as working at home on open source on a mac book pro. Git Bash also interacts with the clipboard to cut and paste into the terminal.

Collapse
themobiledev profile image
Chris McKay

We use Git Bash frequently in my office as well. Now, if I just figure out how to integrate it into Terminal without it opening up a new window...

Collapse
simbo1905 profile image
Simon Massey

Yes, you just change the setting in VS Code to tell it to use the bash.exe and when vs code sees any paths in any terminal text it turns them into links to open the files in the editor pane. I will dig the config out of the corporate wiki when I get a chance.

Thread Thread
simbo1905 profile image
Thread Thread
themobiledev profile image
Collapse
themobiledev profile image
Chris McKay

I started playing with it over the weekend. It's pretty nice, even in its early state. I've already set up a new SSH profile (goodbye PuTTY). I'm tempted to submit a PR to clean up the titlebar and borders.

Collapse
kechupslv profile image
Kalvis

Can you show me your settings JSON? I can't figure out how to link ssh with windows terminal.

Collapse
themobiledev profile image
Chris McKay

So, I first followed Scott Hanselman's instructions for getting SSh set up with a public key so that I wouldn't have to enter my username and password every time I opened up my SSH terminal. You can find those here:

hanselman.com/blog/HowToUseWindows...

After that, I created a new profile in Terminal by copying and pasting the PowerShell profile. You need to create a new guid value (there are free generators online) or else it will just open up the first profile it finds. Then, set the commandline parameter like this:

"commandline" : "ssh.exe @"

That's all there is to it.

Collapse
baruchiro profile image
Baruch Odem

What is the Acrylic properties?

Collapse
defman profile image
Collapse
jyggorath profile image
jyggorath

After creating a new profile, I get the following error when opening the terminal app: "Failed to load settings" "Settings could not be loaded from file - temporarily using the default settings. Check for syntax errors, including trailing commas."

I have checked with a validator, and there is no JSON syntax error, it conforms with RFC4627.

And I can't see that any of the keys are wrong, they're all copy-pasted. I've tried using both \\ and / as directory separator in the path to the background image, but it doesn't seem to make a difference. And the background image does exist on that path. Also, I made sure the GUID was new and not used by any other profiles.

Collapse
blacklightpy profile image
Jyothish Kumar

I think it is because you probably modified the GUID by yourself. I used an online GUID generator to fix this problem. I don't know how GUIDs work but since there are generators out there, I tried out one and it worked.

Collapse
baso53 profile image
Sebastijan Grabar

I tried it out today for a few minutes and the first thing I noticed is that it is VERY early access. It froze on me once already (without typing any commands, just switching tabs) and also, the title bar (IMO) looks so bad that it's almost funny. Oh and yeah, I couldn't access the settings at all, it just asked me which program would I like to use to do so. But well, I figured out why it did while writing this comment :).

Collapse
cholasimmons profile image
Chola

"looks so bad" yet don't suggest how it can be improved?
I personally am feeling terminal, I love the prettiness of UWP's, almost like Electron programs.

Collapse
cholasimmons profile image
Chola

The trailer for Terminal had a segment where you could see some color coded text, VScode style, It looked like directly editing C++ code inside the Command window itself!
any ideas how to do this? C++ inside Terminal

Collapse
phduck profile image
Mads Gram

vim, nano, ed, emacs, xi or any of the other command line based editors.

Collapse
thatkazuki profile image
Desmond Edem

Any idea on how I can change the starting directory to my WSL home directory? Currently, I type cd ~ anytime I want to make this switch.

Thank you.

Collapse
rennex profile image
Renne Nissinen

Add this to your settings in the relevant profile: "startingDirectory": "//wsl$/Ubuntu/home/yourname" or whatever is the path that works in Explorer.

Collapse
dougbm profile image
Douglas Marquardt

Thanks! It works.

Collapse
eliandroribeiro profile image
Eliandro

I would suggest you to define the HOME environment variable. This worked for me with Git Bash.

stackoverflow.com/questions/322329...

Collapse
maymeow profile image
💜Emma🌼

Can you share those pictures you have used as background? :)

Collapse
kasuken profile image
Emanuele Bartolesi Author

I updated my post with the images at the end!!! :)

Collapse
maymeow profile image
💜Emma🌼

Thank You :)

Collapse
luizmoratelli profile image
Luiz Augusto Moratelli

It's possible to change the default terminal to ubuntu instead of power shell on open WT?

Collapse
seanatron profile image
Sean W

In the profiles.json file set the default profile GUID to the profile that corresponds to the Ubuntu profile. With this set, when you open the Terminal or use Ctrl + Shift + T, it will open Ubuntu by default.

Collapse
rachaelfi profile image
rachaelfi

How can I change just the font color?

Collapse
moses_odhiambo profile image
Moses Odhiambo

How can I make the color of the title bar match the color scheme?

Collapse
matbanke profile image
matbanke

In the "globals" section of the json you can set Columns and Rows. Anyone know if you can set the Windows Position so the window opens in the same spot every time?

Collapse
attkinsonjakob profile image
Jakob Attkinson

Is there a way to save our custom settings to GH? (Either for sharing purposes, or just a backup)

Collapse
jeanlambert profile image
Jean Lambert

HI! Can I add custom commands?

Collapse
kt0594 profile image
kt0594

how to change "startingDirectory" : "%USERPROFILE%" to custom directory