1 00:00:00,360 --> 00:00:03,748 Terminal profiles lets you configure what shell you want 2 00:00:03,748 --> 00:00:06,952 to run in your terminals and how they'll look in the 3 00:00:06,952 --> 00:00:08,800 terminal group inside VS Code. 4 00:00:08,800 --> 00:00:12,945 I've already got the settings.json file I was previously working 5 00:00:12,945 --> 00:00:14,656 on open here in my editor. 6 00:00:14,656 --> 00:00:18,624 I'll also open a new terminal and show you how we can get started 7 00:00:18,624 --> 00:00:20,732 creating custom terminal profiles. 8 00:00:20,732 --> 00:00:24,511 I'll click on the dropdown arrow in the top right corner 9 00:00:24,511 --> 00:00:26,22 of the terminal panel. 10 00:00:26,22 --> 00:00:31,377 From here, I'm going to click "Select Default Profile." 11 00:00:31,377 --> 00:00:35,426 That brings up a list at the top with the profiles currently 12 00:00:35,426 --> 00:00:36,112 available, 13 00:00:36,112 --> 00:00:38,997 and I could now click on one of them to set it as my 14 00:00:38,997 --> 00:00:39,902 default profile. 15 00:00:39,902 --> 00:00:43,35 However, notice that they each have a little gear icon 16 00:00:43,35 --> 00:00:44,276 to the right of them. 17 00:00:44,276 --> 00:00:48,541 Clicking one of those will let me create a new profile based on 18 00:00:48,541 --> 00:00:52,394 the one already in place, and will copy all of my profile 19 00:00:52,394 --> 00:00:56,522 configurations to my settings.json file so I can make changes 20 00:00:56,522 --> 00:00:57,554 to any of them. 21 00:00:57,554 --> 00:01:01,331 One important thing to note is that terminal profiles are 22 00:01:01,331 --> 00:01:02,545 platform-specific. 23 00:01:02,545 --> 00:01:06,480 Different operating systems have different shells you can run. 24 00:01:06,480 --> 00:01:10,239 So if you're on a Linux machine, for instance, the list you see 25 00:01:10,239 --> 00:01:13,816 here will be different from this list on my Windows machine. 26 00:01:13,816 --> 00:01:17,817 It can also vary just based on what shells you have installed. 27 00:01:17,817 --> 00:01:20,884 I'll click the gear icon beside Ubuntu. 28 00:01:20,884 --> 00:01:25,497 I'm running it with the Windows Subsystem for Linux, WSL. 29 00:01:25,497 --> 00:01:28,950 I'm then prompted to provide a name for the profile. 30 00:01:28,950 --> 00:01:32,663 I'll just accept the default suggestion. 31 00:01:32,663 --> 00:01:37,521 That adds a big new section to the settings.json file with the 32 00:01:37,521 --> 00:01:41,423 configuration information for each of my profiles. 33 00:01:41,423 --> 00:01:45,575 The top-level setting added to my file appears here on Line 13, 34 00:01:45,575 --> 00:01:50,416 terminal.integrated.profiles.windows. 35 00:01:50,416 --> 00:01:53,940 If I were on a Linux machine, that last segment would be Linux, 36 00:01:53,940 --> 00:01:56,278 and on a Mac, it would be OSX. 37 00:01:56,278 --> 00:02:00,122 The value for that setting is a comma-separated list of 38 00:02:00,122 --> 00:02:03,326 my current profiles, which each have their own 39 00:02:03,326 --> 00:02:05,106 configuration properties. 40 00:02:05,106 --> 00:02:10,112 Each profile basically configures VS Code to run a particular shell. 41 00:02:10,112 --> 00:02:14,506 In most cases, that's done by providing a path property whose 42 00:02:14,506 --> 00:02:17,875 value is a full path to the shell's executable. 43 00:02:17,875 --> 00:02:22,318 You can see an example of that for my Ubuntu shell on Line 30. 44 00:02:22,318 --> 00:02:25,49 On Windows machines, you can instead use 45 00:02:25,49 --> 00:02:28,691 a source property, and Windows will attempt to detect 46 00:02:28,691 --> 00:02:31,493 installations of PowerShell and Git Bash 47 00:02:31,493 --> 00:02:34,810 as you see on Lines 15 and 27. 48 00:02:34,810 --> 00:02:39,45 Also note the use of an environment variable on Lines 20 49 00:02:39,45 --> 00:02:43,742 and 21 when specifying the path to the Windows command prompt. 50 00:02:43,742 --> 00:02:47,367 There are lots of different variables available to help you 51 00:02:47,367 --> 00:02:50,55 refer to different file paths and locations. 52 00:02:50,55 --> 00:02:54,392 You can check out the VS Code website for a full list of those. 53 00:02:54,392 --> 00:02:58,366 Let's now add a few properties to the Git Bash profile 54 00:02:58,366 --> 00:03:02,307 so it looks like the one I configured earlier 55 00:03:02,307 --> 00:03:03,740 in this chapter. 56 00:03:03,740 --> 00:03:07,532 I'll add a comma after the source property, 57 00:03:07,532 --> 00:03:13,487 and then press "Ctrl space" to bring up a code completion list of 58 00:03:13,487 --> 00:03:16,327 the other available properties. 59 00:03:16,327 --> 00:03:21,171 I'll add the override name property and set it to true 60 00:03:21,171 --> 00:03:28,420 so that the title of this terminal is the title of the profile. 61 00:03:28,420 --> 00:03:36,360 I'll also change the name of the profile to simply be git. 62 00:03:36,360 --> 00:03:44,672 I'll now set the color property to red. 63 00:03:44,672 --> 00:03:53,888 Lastly, I'll change the icon and assign it the git-branch-create 64 00:03:53,888 --> 00:04:00,125 icon ID. 65 00:04:00,125 --> 00:04:04,954 I could also add an args property like you see on the Ubuntu 66 00:04:04,954 --> 00:04:06,100 profile below, 67 00:04:06,100 --> 00:04:09,987 which would pass command line arguments to the shell executable, 68 00:04:09,987 --> 00:04:12,340 but I don't really need that on this one. 69 00:04:12,340 --> 00:04:16,21 If there are profiles in here that you don't want to appear as 70 00:04:16,21 --> 00:04:19,702 choices in the new terminal dropdown, you can just assign them 71 00:04:19,702 --> 00:04:20,607 the value null. 72 00:04:20,607 --> 00:04:28,500 I'll do that for the command prompt profile. 73 00:04:28,500 --> 00:04:34,225 The last settings change I want to make is to actually specify which 74 00:04:34,225 --> 00:04:36,960 profile I want to be my default. 75 00:04:36,960 --> 00:04:41,861 I'll do that with the terminal.integrated.defaultProfile.windows 76 00:04:41,861 --> 00:04:53,693 property. 77 00:04:53,693 --> 00:05:01,103 From the code completion list of possible values, 78 00:05:01,103 --> 00:05:06,127 I'll select my newly configured git profile. 79 00:05:06,127 --> 00:05:13,249 I'll now go to the terminal menu and open a new terminal and see 80 00:05:13,249 --> 00:05:15,849 how these changes look. 81 00:05:15,849 --> 00:05:23,309 That opens a new Git Bash shell with my new profile settings. 82 00:05:23,309 --> 00:05:26,908 In the tabbed view on the right, you can see the label 83 00:05:26,908 --> 00:05:29,896 I specified for it, along with the red Git 84 00:05:29,896 --> 00:05:30,982 icon I selected. 85 00:05:30,982 --> 00:05:35,178 Also note that if I click the dropdown to open a new terminal, 86 00:05:35,178 --> 00:05:39,440 the Windows command prompt is no longer in the list since I set 87 00:05:39,440 --> 00:05:41,228 it to null in my settings. 88 00:05:41,228 --> 00:05:45,05 Terminal profiles are a way to customize how your terminal 89 00:05:45,05 --> 00:05:48,319 shell start and look, as well as a way to configure 90 00:05:48,319 --> 00:05:50,638 alternative shells you've installed, 91 00:05:50,638 --> 00:05:53,620 so you can also use them inside VS Code. There are 92 00:05:53,620 --> 00:05:57,165 one more way you can customize VS Code to fit the way 93 00:05:57,165 --> 00:05:58,324 you want to work. 94 00:05:58,324 --> 00:06:01,718 Coming up next, we'll take a look at task and how 95 00:06:01,718 --> 00:06:05,00 you can use them to automate common operations.