Transcript for:
Windows Terminal Configuration - Lecture by Scott Hanselman

Alexa, turn on the office. Hey, friends. I'm Scott Hanselman. And I was wondering, did you have to try more than once to get my attention? I'm good, Alexa. Thank you. Goodbye. Bye for now. Okay. You can stop talking to me now. Hello friends, I'm Scott Hanselman and I wanted to talk to you about the Windows Terminal. A number of people have told me that they've been frustrated with configuration and getting started with the Windows Terminal, so I want to take a few minutes and talk about that because it's actually easier than you realize if you know how to set up your commands, your actions, your hotkeys. So right off the bat, just as a reminder, we know that the Windows Terminal has these profiles that sit up at the top here and what I can do is I can I'm just going to set up my zooming tool here. Hang on one second. There we go. I've got these different profiles here. Windows PowerShell, regular PowerShell, various versions of Linux. But I've also set mine up with a bunch of hotkeys. So, for example, I can open up a new tab with Control-T. I can hit another Control-T. I can hit Control-W to close the tabs, just like a browser. I can also click and then hold down with Alt. and click on, for example, PowerShell, I'll click Command Prompt, I'll click Windows PowerShell, and I'll click Ubuntu, and I'm holding down Alt each time. And you notice how I've opened up multiple panes, and if I click on those panes, I'm getting blue outline. And now I'm going to hit Control-W, Control-W, Control-W, Control-W to close those panes. You probably know those things, but I just wanted to remind you of them. Again, if you hover over this, you'll see that it actually pops up a little thing that says Alt-Click to split the current window and Shift-Click to open a new window. That Alt-Click, super important and super easy for... opening up new panes. But here's what you probably didn't know. Control-Shift-P opens up this command palette. And this command palette shows all the different commands that are available inside of the terminal and what they are currently bound to. So why is this useful? This is useful because this is a series of things you can do with the terminal that you maybe didn't know about, and that they can be bound to hotkeys. So for example, you can see that I've got close pane here, bound to control W. There's control W, there's close pane. I've got find. Control-Shift-F. I can actually go in here and look at a directory, and then I could Control-Shift-F, and I could start searching for something, and it'll actually find it and highlight it for me right there. People might not know that. I could have done that in two ways. I could hit Control-Shift-P, search for find. I find that in my command palette, there's find, and I note that it is bound to control shift F, but then I might want to change that. So let's talk about this. You can open up the menu here. I'm going to hit settings. Okay. And I want to put myself in the corner and make this a little easier to see. All right. And I want to click on actions and over here in actions in the terminal settings, you can see we've got all the different actions. and what they are bound to. So, for example, if we look at Find, you can see that it's bound to Control-Shift-F. I can hover over that. I can pick my command and type in my preferred hotkey. Super important. So, for example, I told you that I had changed my system such that Close Pane was Control-W. I can go in here manually, add new actions, pull them down, I could say decrease font size is whatever, and I could put in some command if I wanted to. That's one way to do it. Or, come down here in the corner, we have this JSON file. These settings again are expressed both in the UI and as a JSON file. So I'm going to click open JSON file. That's going to open up into Visual Studio Code. Look at this. This is a really useful way to do things. If you're a little bit more advanced, this is the best way to do things because you can then store this file in a GitHub Gist or in OneDrive or Google Drive or Dropbox or whatever makes you happy. So here's those commands. Find, Ctrl-Shift-F, and Close Pane, Ctrl-W. that close pane command that I've set there is not the default. That's something that I decided. So I've gone and done that myself. And then I've also made split pane control shift minus, control shift minus. So I can go back over here to the terminal, and I'll be sitting here in PowerShell looking wonderful. Maybe I'll go to my... GitHub folder, and I'll see my nice prompt here from Oh My Posh. I've got a YouTube video on that that you can check out as well. And I'll hit Control-Shift-Minus and open up a new pane. Totally up to you. I did minus because I think of the minus as splitting the pane. You can also do a pipe or whatever makes you happy. All of that is totally in your control. So I just want to remind you that those actions that are expressed here in the UI are serialized here in this settings and I've put them under actions and I've gone and put up things like always on top and single line copy equals false and different stuff like this split pane open settings you can change all of these things that you want there's another split pane here with with parameters to the command so split pane automatically versus split pane horizontally or vertically and now by having that array from here to here I can take this put it up in my github gist and then set it up that way everywhere that I want It's also worth pointing out that there's a reason that I'm using Visual Studio Code to edit my terminal schema. It's because we actually have a JSON schema here, that JSON schema supported by VS Code. When I do this, look at that. Here's another list of all of the potential commands. Those commands are in the schema, which is then supported by VS Code, and that is letting me see the same stuff that I would see if I was over here and I hit Control Shift P. Do you see that little error that just appeared right there? If you save a bad syntax JSON file, Visual Studio, so Windows Terminal won't let you do it, and they'll revert to a backup. So don't worry, you can bounce back and forth between the UI and the JSON file. So here's that list again. And if we wanted to take something like close all other tabs, let's say add new. close all other tabs i don't know ctrl shift alt w i just made that up okay save so i've just made a new hotkey that is close all tabs but the one i'm currently on ctrl alt shift w i hover off back over here And there it wrote that command for me close other tabs ctrl alt shift W I could have done that in either place This is where you start if you're feeling in any way that Windows Terminal is not doing what you needed to do buckle up get on board with the hotkeys and the actions. You can do a bunch of cool stuff. If you have any questions, put them in the comments. As with all my videos, I did this quickly and all in one take because I respect you and your time. If you liked this, I would encourage you to take a look at my other videos on computer stuff they didn't teach you in school. And thank you very much. Bye. Alexa, turn off the office.