Locked learning resources

You must own this product to watch this lesson.

Locked learning resources

You must own this product to watch this lesson.

Custom Look and Feel

00:00 Welcome back to the next video. In this lesson, I’m going to show you how to completely customize the look and feel of your Sublime Text setup. We’re going to make a whole bunch of visual tweaks and I’m going to show you how to customize the editor font.

00:14 We’re going to optimize Sublime Text’s font rendering and we’re going to completely change the editor look and feel with a custom theme and a custom syntax highlighting scheme.

00:23 And then in the end, you’ll have taken a large step towards making Sublime Text your own and really making it look like the way it works best for you and the way, you know, the readability works best for you so that it becomes a lot more enjoyable to write code with Sublime Text. So let’s dive right in.

00:39 The first thing we’re going to do is install a custom editor font. And Sublime Text actually uses a pretty decent default font in all the platforms it runs on, but using a custom font gives you some opportunity to really tailor Sublime Text to your needs in making it look the way you want it to look.

00:56 And also some fonts, they just work a lot better for programming than others. This choice is really going to make your Sublime Text look unique and a lot more personal. So in this next section, I’m going to walk you through downloading and installing a custom font on macOS and then we’re going to select that in your editor in Sublime Text.

01:15 And I’m going to recommend a couple of fonts to you. This same technique would apply for any other font you could find online and download. The steps to install and try out that font would be exactly the same, so this technique is going to be really valuable, whatever font you choose to apply in the end.

01:32 A font that I really enjoy is called Ubuntu Mono, and it’s part of the Ubuntu Linux distribution. This font is available for free on the internet and I’m going to show you how to set it up now.

01:41 The first thing we need to do here is actually download the font files. Probably the easiest way to do that is to just Google for ubuntu mono font and then you’re going to find that download link at font.ubuntu.com.

01:56 You want to click on that and then there’s going to be a download link down there, so I’m going to download the font files now.

02:03 They’re going to get extracted automatically, so I can just open that in my downloads folder and we can actually close the Safari window here. Okay, so at this point you should have a folder with these TTF TrueType files.

02:17 These are the actual font files that we want. The next step is we need to install them globally on the system, and for that, you just want to open Spotlight and then search for the Font Book application.

02:30 This is the system application for installing fonts. We just want to open these two windows side by side and we’re going to select all of these font files here.

02:41 And then we’re just going to drag that over and drop it here on the All Fonts box. This is going to validate and install these fonts. You can make sure they were installed correctly by selecting the User section here and then you’re going to see the Ubuntu Mono font and you can get a little preview of that font. All right, that’s actually all there is to it, so we can close that and you can delete these downloaded files because it will have created an internal copy of that font.

03:07 The next thing we need to do is we need to actually enable that font in Sublime Text. You want to go to your Preferences > Settings,

03:16 and this is going to pop up the Sublime Text preferences with your user preferences on the right. We’re just going to add a new setting here that is the "font_face" setting. And then we just need to give the right font name.

03:30 I’m just going to type in here "Ubuntu Mono" and then save that file. This will immediately re-render the window. When we switch back to our code, you can see here it looks quite a bit different.

03:42 What I like about this font is that it’s a nice monospaced font. It renders really well. It’s a little bit more chunky than other monospaced fonts. And there’s actually a bit of a sweet spot to this again, depending on the size you use here. By the way, you can change the font size by pressing down on Command and then hitting the - (minus) and + (plus) keys.

04:06 That’s a really easy way to switch between the different font sizes. And of course here for the video, I’m going to pick a larger font size so you can actually read and see what’s going on on the screen.

04:17 You might want to try out some of the other fonts that come with your system, and probably the easiest way to do that is again, to open the Font Book application. And then inside Font Book, you want to select the Fixed Width collection here, and you can just preview some of the fonts that are available here.

04:34 A really good choice is also Menlo. That looks kind of nice. Monaco is also kind of nice.

04:42 And then now we installed Ubuntu Mono. I’m actually not sure why these emoji and graphical fonts show up here, but another good option to try is Menlo and Monaco. So for those, because they’re already installed on your system, you would just punch in that new name, right?

04:57 You would just go "Monaco" and then that would re-render the font, re-render all of the text. It would be the same with "Menlo".

05:06 And you can see how all of these have a bit of a different feel to them, so I’m going to stick with Ubuntu Mono because that’s one of my personal favorites here. But try that out, and it’s really about making this your own setup and finding a font that you really enjoy. But just to recap, the actual installation process for setting up a new font that you download from the internet will be exactly the same, so you’re basically now free to go and try out a bunch of fonts and find the one that you really like. There are a couple more tweaks you can make to Sublime Text font rendering settings. And again, for this you want to go into the user settings and we’re going to add a couple of new options here.

05:47 The first one is called the "font_options" setting, and that is a list of other parameters. What I’m going to do here is just going to walk you through some of these options.

05:58 The first setting here is called "subpixel_antialias", and this will change how the font is displayed. Now, "subpixel_antialias" should be the default on your system install and you’re probably not going to notice a difference here—at least in the video.

06:13 It might actually make quite a considerable difference if you are running this at a higher resolution on your setup, so it’s worth trying this out.

06:20 Another option here with the anti-aliasing options is to put in "gray_antialias", which again is… Oh actually, okay, that’s visible here in the video as well.

06:30 But this is going to give you a different result. So for me it’s a little bit more blurry, but it also has a completely different feel to it, like not as chunky as it was before. So you might actually enjoy that better.

06:41 Another option would be to put in "no_antialias" and that would completely disable the anti-aliasing. So you get these a little bit more jagged fonts, but the funny thing is that at small sizes turning off anti-aliasing could actually look better. You can get a really crisp and clear result.

06:58 You can see that it looks kind of horrible here with the italics, so we’re going to disable those in a minute because I don’t really like those anyway. But this is a quick fix or a quick thing you can try out here. But I’m going to switch this back to the default, which is the "subpixel_antialias" option.

07:16 There are two more changes you can make here, and that is disabling italics and bold fonts. I’m going to put the "no_bold" and "no_italic" setting here and then save that again. And when we switch back to the code display, you can actually see that now all of these keywords, they’re all rendered in the same font.

07:35 And the reason why I turned this off is that the italics—I find them pretty distracting, and they don’t really add a lot compared to just having the color-coded result.

07:45 Now when we try this out and actually go and disable the anti-aliasing and have the italics disabled as well, this could be a really interesting result.

07:53 I find that this is actually a lot more readable at a smaller resolution than the more chunky anti-aliased font, but of course you’ve got to try and find out what works best for you.

08:05 Because as I bump up the font size here, it kind of gets a lot more ugly. So this will really depend on the combination of the font that you’re using and then the font size that you’re using and then the rendering mode.

08:17 But it’s really good to know about these because they can really make a big difference. I mean, if you’re looking at this thing, staring at the screen all day like I am, then it really makes a big difference here in how nice this looks and just makes your whole workflow a little bit more enjoyable.

08:33 There are a few more settings we can change and some tweaks we can make to this code editor area here to make this look really nice and make it basically perfect for you.

08:41 I want to walk you through some of the changes we can make. So first of all, I want to go back to the Sublime Text user preferences,

08:50 and now I’m going to show you a couple of tweaks you can make to the caret. We’re going to disable blinking and just improve the visibility for that a lot. So you can kind of see that in the video right now, where we have this blinking caret here, and I find that a little bit distracting.

09:05 And actually, I find it not super visible anyway, so I like to disable that. You can just do that by putting in "caret_style" and then "solid".

09:16 That’s going to disable the blinking. When you save that, it’s going to disable the blinking. And then another setting I like to change is setting the "wide_caret" setting to true. This is going to make the caret a lot more visible by doubling its width, and I find that kind of nice.

09:31 And now there’s one more setting we’re going to change, and that is the "highlight_line" setting, which is going to give a lot more visibility to the current line.

09:40 What this did is it added this highlighting here, so when we browse through our code, we’re always going to know where the cursor is placed at the moment.

09:49 And I find that really helpful and I find that a lot less distracting than going with the blinking caret here. This is a tweak that I always apply, and I just find that a lot more readable. If you’re working with a language like Python, then the indentation level of your statements has a meaning, so it’s really important to make sure you’re aware of the correct indentation.

10:09 And this actually applies to some other languages as well, especially if you want to make sure the formatting is consistent and is nice and your code looks clean.

10:16 So I’m going to give you a couple of settings and a couple of changes you can make to improve that situation. The first one here is called "draw_white_space", and we’re going to set that to "all". So once I save that setting, it’s going to add these little symbols here for invisible characters that we otherwise wouldn’t see.

10:38 This is going to tell us exactly how the code is indented. And this becomes really handy if you have whitespace at the end of a line that you don’t really want, right? Usually this would be invisible, but this extra whitespace can lead to all kinds of weird situations.

10:51 When you’re working with a bunch of people in Git, let’s say, and you can end up with these merge conflicts based on these whitespace conflicts that would otherwise just be completely visible. And later, we’re going to get completely rid of the chance of that happening for Python code. But I just find that having more awareness into how the code is formatted, and if there are extra whitespace characters in places where there shouldn’t be, then I just want to know that. I want to make sure I don’t have that.

11:16 And then also here, you can see, for example, the settings files—they use tabs instead of spaces, and those are going to get highlighted differently too.

11:24 This setting is going to make sure that you have more visibility into how your code is formatted and it’s just easier to identify if things go wrong. Now, another option I want to show you here is called the "indent_guide_options" setting. And again, this is going to be a list.

11:41 And so what we’re going to do here is we’re going to change the way these indent guides are rendered. And so the indent guides—they might be kind of hard to see for you right now, but they’re these little vertical lines here that tell you a little about the structure of the code, right? So if I’m working on this line here, you can kind of see this faint line down here that shows me how the code is indented.

12:03 This can be really helpful when you’re at a deeper nesting level and you kind of want to get a feel for how the code is structured. So if I’m editing this line here, this tells me at a glance that, okay, we’re inside this for statement, then there’s a method above that.

12:15 So even if that’s scrolled out of visible range, I still know that, okay, there’s like two indentation levels above me, so there’s probably a method above me and then some kind of class.

12:26 I find that helpful and it’s just kind of one of these subconscious things that you can glance at that and kind of get a feeling for the code. And I really like that. Now, what I don’t like is how these lines are drawn by default, because they’re kind of hard to see and also I don’t like having them around me all the time.

12:42 I only want to see them on the code that I’m editing. And we can change that with the "indent_guide_options" setting, so we’re going to change that to ["draw_active"].

12:52 And once I save that, this will change the behavior of these indent guides. Now what happens is that we only get the indent guides for the line that you’ve highlighted, and it’s going to not render the indent guides for other methods that I’m seeing here on the screen. So, it’s only going to give me the indent guides for the area of the code that I’m actually working on.

13:14 It’s also going to change the color scheme slightly for those, and I find that a lot more helpful than having them all over the place and it’s also a lot less cluttered, so I really like changing this setting.

13:25 All right, one more. There’s a setting to introduce some extra padding between the lines of code, and you can control that with the "line_padding_top"

13:35 and "line_padding_bottom" setting. By default, those will be set to 0, but what I’m going to do now, just for demonstration, I’m going to set them to 3 and then save that.

13:48 And then you’re going to see immediately how that spaces apart your lines of code a lot more. And you might really like this effect, or it might make it a lot easier for you to read your code. So personally, I leave them at the default setting of 0 and 0, but they can lead to really interesting effects.

14:03 You can kind of control the spacing and, you know, make this thing really readable so that it works best for the combination of font and monitor and setup that you’re using in your day-to-day work.

14:13 Let’s actually roll that back and keep them at 0 so that it can have a little bit more vertical space and just fit a little bit more code. So even though I kind of like the way it looks like, I still prefer being able to display more code on my screen.

14:27 Another tweak I want to make here is disabling the fold buttons. Let me show you that real quick. You can see here that for any nested structure, you get these little code folding buttons.

14:38 And then when you click on that, Sublime Text is going to hide that part of the code and it’s just going to give you this little folding indicator. And you can undo that to restore the folded code.

14:48 The idea is that you would fold a section of the code so that you can focus on other stuff and you’re not distracted by this extra code. And I kind of like this idea, but on the other hand, I also never really used this functionality. And sometimes, you know, you can click on it by accident and you’re wondering where your code is.

15:04 I also don’t like how it messes with the scroll distances. I just like to disable these fold buttons, and you can change that behavior with the "fold_buttons" setting.

15:12 We’re going to set that to false, and that’s going to completely disable the fold buttons and it actually gives us a little bit more space here horizontally. So this is kind of nice, and you know, if you don’t use the fold buttons, you might as well disable them.

15:26 Another thing that I usually change is disabling the minimap. So again, the minimap is kind of useful, but again, I like having a little bit more horizontal space and you can just turn it back on really easily. There’s one more really helpful feature in Sublime Text, and that is the ability to scroll past the end of the last line.

15:45 What you’re seeing right now, I’m scrolled all the way to the bottom and now if I were to add some more code at the end here, that means I would always be editing the last line on my screen.

15:56 That’s not ideal, I find, because I’m kind of forced to look down at my screen. And sure, you could resize your window and then scroll down and you could kind of keep that up here where it’s more convenient to look at, but there’s actually a setting you can change that will make this a lot easier.

16:11 That setting is called "scroll_past_end", very aptly named. We’re going to add that, set it to true, and then save the settings file.

16:19 And now when I go back, I actually have this extra space that isn’t part of the file, but it’s just for scrolling, extra scrolling space. I can place that last line wherever I want to and now when I’m adding more code at the end of the file, I can keep that in an area on my screen where it’s the most convenient for me to write and to work with.

16:38 It’s one of these really small tweaks that can just make your setup a little bit nicer if you make them. And they have a cumulative effect, right? Like, if you’re adding a bunch of those, then it’s just going to make your life easier and easier and it’s just really going to tailor this thing so that it works well for your intentions. So, I’ve got one more of those.

16:56 It’s not exactly a visual tweak, but we might as well make it now. And that is the "shift_tab_unindent" setting. This might be enabled by default, but it doesn’t hurt to put that in here as well.

17:09 What you can do with that is actually undo tabbing by pressing down Shift and then hitting Tab. So with "shift_tab_unindent" enabled, I can tab, I can indent the current line by pressing Tab, and then I can also go Shift + Tab to undo that, and that’s a really nice way to change the indentation level of my code, right?

17:32 Because that just gives me a lot of flexibility here to work with my code, so I like to change that setting as well. Okay, so now we’ve applied a bunch of visual tweaks to our code editor here in this code rendering or code display area. And I think it’s a lot nicer now.

17:49 And these were all a couple of small tweaks, but they have this cumulative effect. Another really important aspect of making your development environment feel right and just feel like it’s your own is to pick a color scheme that you really enjoy and that works well for you. So, the default scheme in Sublime Text—it’s pretty good. I kind of like the syntax highlighting that is used by default.

18:12 What I don’t really like is this here in the sidebar area, this bright area. I don’t really enjoy that, but there are ways to fix that. I’m going to show you how to do that now.

18:21 The first thing I want to show you is that, actually, Sublime Text comes with a bunch of syntax highlighting color schemes here that you could apply. And you can just do that by going to Preferences > Color Scheme,

18:36 and you can select a bunch of those. There’s, like, a dark one that kind of has this like Borland editor, DOS kind of feel. But it’s kind of nice, I really like the dark schemes here.

18:47 But there are also other options. For example, the IDLE option, that is really bright and just a white background scheme. So, you can play with those and see if you find one that you like.

18:58 And there’s an important distinction to make. Sublime Text has this concept of color schemes and color themes. So a color schemeit only affects the syntax highlighting here in the code area.

19:10 And the color theme actually affects the whole look and feel of the editor, so it will also affect how these dialogs here are rendered and how the sidebar is displayed and the icons here.

19:22 So now I’m going to show you how you can customize those as well. The first thing I want to do is I’m going to show you how to install a custom color scheme to affect the syntax highlighting.

19:32 And then once you know how to do that, you can go and search for one that you really enjoy. One that I really like is called the Tomorrow Night color scheme.

19:42 We can install that through the Install Package functionality, in Package Control. Again, we’re going to bring up the Command Palette, go to Install Package and then let it load up its list of packages.

19:53 Search for Tomorrow Color Schemes, and then just hit Return. It’s going to install that. All right! And once that’s completed, you can go to Preferences again, Color Scheme, and now you’ll have a new option here, and that one is called Tomorrow Night.

20:08 I really like this color scheme because it’s nice and dark and it has really good visibility, but the colors are not crazy. They’re not, like, in your face bright.

20:17 So I really enjoy this color scheme and this font combination as well.

20:22 Now that we’ve got this color scheme, we still have this problem here in the sidebar area. I think this looks decent but it could be a lot nicer too, so I want to show you how to install a color theme that would override the styling here. And again, we’re going to bring up the Command Palette, open the Install Package functionality, and then you’re going to search for SoDaReloaded. It’s this one here.

20:47 This is a custom theme with a dark and a light flavor to it. And I think SoDaReloaded stands for Solarized Dark Reloaded. At some point there was, like, a Solarized Dark color scheme that someone created. And these color schemes, they kind of evolve over the years where people create copies of them and then improve them, and then, you know, someone else takes on the project.

21:11 And so it’s really interesting what kind of choices you have there and just so many themes you can all find on the Package Control website. And this is one that I really like.

21:19 It’s kind of similar to the standard setting, so it’s not going to be a huge change. But just in the overall feel, I really like the way it looks like. So I’m going to show you that as an example and then once you know how to install a color theme, the actual steps will be similar across any theme that you want to install.

21:38 Okay, so this just installed and now we’re getting this little popup from the SoDaReloaded README. And it’s actually really convenient here because it just tells us exactly the setting that we need to copy.

21:49 But it would be really similar for any other kind of theme that you want to install. So again, you’re going to need to go to your user preferences. And in here, I’m just going to paste that setting in.

21:59 This setting is going to be called the "theme" setting, and you just want to point that to the Sublime theme file that you want to use and then hit Save. And now this is already re-rendering everything, but every time you make a change like that in Sublime Text, it’s best to actually quit Sublime Text and then to start it again.

22:15 Because sometimes, if you don’t do that, it can lead to weird rendering glitches and then it’s just going to look weird until you restart Sublime Text the next time, so I always like to restart my Sublime Text. All right, so now we can get a pretty good feel for what this color scheme looks like.

22:29 I want to show you some of the features here. You can see that just the sidebar area actually can change its color scheme completely and now we have these little icons here that are actually colored for the different file types. I find those a lot more readable and just easier to distinguish than the previous ones. And also the brightness here is, like, way reduced. Also here for the dialogs like the search box and these buttons here—they look slightly different than they do in the default install. It’s kind of an improvement in my mind. So also, you can see here the tab bar looks different. I really like this setup.

23:04 The combination of SoDaReloaded Dark as the theme and then the Tomorrow Night color scheme I think goes really well together. But of course, really the point here is that you want to pick a color theme and a color scheme combination that you really enjoy and then put the font that you really enjoy on top of that. And then you’re going to have a setup that is unique to you and it’s going to look really nice and just make programming work a lot more enjoyable. Okay, great!

23:28 Now you know how to customize Sublime Text visually so that it works really well for your setup. You know how to install custom themes and color schemes and you learned how to apply these little tweaks to the rendering area here.

23:41 That’s going to help you customize your Sublime Text setup so that it works really well for your needs.

You must own this product to join the conversation.