Custom Look and Feel
00:00 In this lesson, I’m going to show you how to completely customize the look and feel of Sublime Text to really make it your own and to really make it work well with your monitor and your setup and your personal preferences.
00:12 The whole lesson is split up into four parts. First of all, I’m going to show you how to install a custom editor font in Windows and then use that in your Sublime Text setup.
00:22 I’m going to show you a couple of tweaks you can make to the font rendering in Sublime Text that can really make a huge difference on the quality of the font rendering. After that, I’m going to show you a couple of valuable visual tweaks you can make to the code editing area.
00:35 And we’ll conclude the lesson by completely changing the color scheme that is being used to render the Sublime Text window. I’m going to show you how you can completely tweak the syntax highlighting and all the colors that are being used to draw the Sublime Text window. Okay, so let’s dive right in! We’re going to install a custom editor font first. Sublime Text uses a really decent default font in all the platforms it runs on, but learning how to set up a custom font gives you the opportunity to tailor Sublime Text to your needs, and some fonts just work better for programming than others and it’s a really personal choice, where you want to pick a font that works well on your setup, on your specific combination of screen resolution and monitor.
01:17 So it absolutely pays off to work through this. I’ll walk you through downloading and installing a custom font and then setting that up in your Sublime Text.
01:25 One of my favorite programming fonts is called Ubuntu Mono. It’s normally part of the Ubuntu Linux distribution, but you can download the font for free on the internet as well.
01:35 Let’s do that now. And the easiest way to do that is by just searching for ubuntu mono font,
01:42 and it will usually be the first hit, here, on font.ubuntu.com.
01:47 You want to find that download button and download a ZIP file with the font. And now we’re going to open that folder and you want to right-click on that ZIP file and select Extract All.
01:58 It’s really important to extract the ZIP file, because if you don’t do the extraction, then you can’t actually install the font from within the ZIP file. Okay, so now we’re looking inside the extracted folder that holds all of the font files. And you can see them here, they’re all of these TrueType font files.
02:15 Next up, we need to open the font settings. The easiest way to do that is to just search for font in the Windows search box, and it will be this hit here in the Control Panel.
02:27 If you’re manually looking for this, it will be in the Control Panel under Appearance and Personalization > Fonts. And here you can see a list of all the fonts that are already installed on the system and with their names.
02:39 The name here is really important because we need to make a note of that. We want to enable that font inside Sublime Text. The next step here will be to actually go back to the folder that we previously extracted and then to select all of the TrueType font files and just drag them all over into the font settings.
03:01
This will install all of the fonts, and now we can look for the Ubuntu Mono font, and we can find that here. And because it shows up here and we see this little preview, you can see that the font installed correctly. All right, so now we can close this and open up Sublime Text. To change the font inside Sublime Text, you need to go to your Preferences under Settings, and this will pop up a window with your default settings on the left and your user settings on the right. We’re just going to add a new setting here, and it’s called the "font_face"
setting.
03:34
And now we just need to pass in the name of the font that we want to use based on the name that was displayed in the Windows font settings. So in this case, it will be Ubuntu Mono. And as soon as I save this file, Sublime Text will re-render all the text onscreen with the new font. Okay, now you can see it makes quite a difference in the look and feel here now that we have enabled this new font. After we pick the new font, there are a few more tweaks we can make to Sublime’s text rendering settings on Windows. Because the default rendering settings—they’re pretty good overall, but with a few small tweaks, you can get a crisper look and just better legibility without really any downside associated with it. So let’s go back to our user settings here, and we’re going to add another option and that’s called the "font_options"
setting. And this time, this is a list of other values that we’re going to type in here.
04:25
And the first one is to enable the "directwrite"
font rendering, and then also to enable the "subpixel_antialias"
option. This will influence how Sublime Text renders our fonts.
04:39 And now we’re going to save this file. And when we switch back, you can see that some of the jaggedness that we saw earlier is now actually gone. I’m not sure if this will fully come through in the video, but this is a really powerful option that, depending on the font size that you’re using and the monitor setup that you’re running, could really make a big difference on the quality of your font rendering here.
04:58
But let me show you a couple more options. One more option we can put here is disabling the "directwrite"
renderer and switching to "no_antialias"
and then saving the file. So again, this will give a result that looks slightly worse at first, but actually when you zoom out the font and render it at a smaller font size, you can get this very clear, kind of clean-cut, very sleek rendering that looks kind of nice.
05:23 The only thing that’s distracting here is the italics, and we’re going to get rid of those as well, because we already have the different color highlighting the different keywords here, so in my mind, we don’t really need the italics. They kind of make it harder to read the text anyway. But first, let’s turn on the subpixel anti-aliasing again.
05:41
To disable the bold and italic font rendering, we’re going to add a couple more options to this "font_options"
list here. The first one is "no_bold"
, and the second one is "no_italic"
.
05:53 And when we save this and switch back to the code display, you can see here that now it’s all nice and clean and we don’t have these distracting italics.
06:01 And compared to the default settings, I feel like this makes quite a bit of a difference for legibility and how quickly you can read your code. My take on this is that when I’m staring at the screen for so many hours every day, it might as well look really, really good, so that’s why I like to change these settings. And we’re not done yet!
06:17 So, before we dive into installing a custom color scheme, I want to show you a number of extra tweaks and changes you can make to Sublime Text’s look and feel, and kind of how the editor area is displayed.
06:29 With these tips, you can mix and match them as you want. I’m just going to demonstrate to you the settings that I found the most valuable, but as always, you’re free to pick what works for you and ignore the rest. For these changes, we’re going to go back to your user settings. And the first tweak that I want to show you has to do with how the caret, or the cursor, is displayed.
06:49 Because I feel like with this blinking, very thin cursor, it’s actually kind of hard to read and kind of hard to find where it is placed on the screen, so we’re going to change that.
06:58
The first setting we’re going to modify here is called "caret_style"
. And what that allows us to do, if we set that to "solid"
, is to stop the cursor from blinking.
07:08
But now the cursor is even harder to see because it stopped blinking, so also what we’re going to do here is enable the "wide_caret"
setting, and that will give our cursor double the standard width, which again, makes it a little bit more visible without being distracting.
07:24
And then we can also turn on the "highlight_line"
setting, and this will make the current line really visible. And so as I’m navigating around the code, I can always instantly know where the cursor is placed without having this distracting blinking. So I like this setting a lot better, especially this combination with the wider caret and then turning on the "highlight_line"
setting.
07:45 In Python, the indentation level of your statements is really important because it has an actual meaning, so I feel like it’s important that we have great visibility into the whitespace that is part of our code and into the indentation levels.
07:58
So I’m going to show you two changes you can make to your user settings again that will improve that situation. So, first of all, we’re going to turn on the "draw_white_space"
setting here by setting that to "all"
.
08:11 And when I turn on that setting, you can see here that now all of these characters that were previously hidden because they were just whitespace are now getting displayed with this little dot here.
08:21 And this is actually really handy when you have extra whitespace at the end of a line that really serves no purpose and you might want to get rid of that.
08:28 I’m actually going to show you later how to do that automatically with Sublime Text so you don’t have to manage this yourself. Another thing that this affects is that you can instantly tell what settings a file uses—whether it’s using tab characters, which are represented by this line here, or whether it’s actually using space characters to represent the indentation level.
08:50 And so it’s handy to see that you’re not mixing two ways of indentation in your code. You always want to be consistent. Now, another cool feature in Sublime Text are these indent guides.
09:00 The indent guides are these faint vertical lines here, and the purpose of those is so that you can tell how your code is indented. And the problem with that is that, by default, they’re kind of hard to see, and also they’re cluttering up the whole screen. Like, very often, I only want to see these indent guides for the function or the piece of code that I’m actually working on, but I don’t necessarily care having them all over my screen.
09:24
So I’m going to show you how to change that now. The setting we’re going to change here is called "indent_guide_options"
. And a good way to find these, by the way, is to look here on the left in the default settings.
09:37 And then you can just search for, let’s say, indent_guide, and this will highlight a matching option here, and then you can read the description of that option with the comment here, and you can just copy and paste that over.
09:49
This could really save you some typing and some typos. All right, so we’re going to set this. Again, this is a list. We’re going to set this to "draw_active"
.
09:59 And when I save that, you can see here that the indent guides actually render differently now. The first thing that happened here is that the indent guides only appear for the relevant lines of code.
10:11
Now you can see here, when the cursor is placed on that line 128, I only get the indent guides here for the if
statement, for the function, and then for the class above me—but I’m not getting it here for all of these other functions and then the class below. So this removes some of the clutter that we have previously.
10:31 And now I also feel like this is much more useful because when I’m editing this line and I’m shifting my eyes to the left, I can just look at these indent guides and I can instantly see that, all right, I’m working inside this function here, and this whole thing is also part of a class because I get this indent guide here that shows me that there’s some structure above me. On top of that, it changes the way these indent guides are drawn, slightly, so that they’re a little bit more visible. Again, which makes them more useful in my mind and makes them a helpful tool for writing code.
11:01
There’s another setting that you can play with that will affect the legibility of your code, and that setting is called the line padding setting. Here you can put in the "line_padding_top"
and then "line_padding_bottom"
settings. And by default, they will both be set to 0
.
11:18
Let’s change these to something else, let’s say 3
pixels above and 3
pixels below. And then when I save that, you can see that the rendering changed and these lines are spaced out a little bit further.
11:30 Now the downside here is that you can’t fit as much code on your screen, which is why I usually don’t use this option, but they can give a really nice effect to make things a lot more readable depending on how you work with your code. So, they don’t have to be symmetric.
11:42
You could say, okay, I only want a little bit of top padding and then some more padding at the bottom. And again, this will give a different result and it will allow you to fine-tune the font rendering so it makes the most sense for you and that it works the best for you. So, like I said, I usually leave those both at 0
so I can fit a little bit more code on my screen, but it could totally pay off depending on the font size that you’re using to play with these settings, to get a result that is really perfect for you.
12:09 There’s one more thing with the code folding buttons here. What these little icons here, the little triangle icons in the gutter area—what they allow you to do is to hide parts of your code and to just kind of fold it up so that it doesn’t clutter up your screen.
12:24 Or, I guess the idea is that you would now be able to focus on something else and not be distracted by this code. Now, personally, this is not something that I use because I don’t like how it changes the scroll distance, and I also really like to see all of the code that’s on my screen.
12:39 I’d rather make a new module or a new file if I have too much code in a single file than to try and hide it with the fold buttons. So what I like to do is to actually disable these fold buttons.
12:50
And you can do that with the "fold_buttons"
setting. We’re just going to set that to false
. And this will remove the fold buttons and actually give us a little bit more space here horizontally, which also adds up if you’re running multiple columns, so I like that.
13:04
Of course, if you want to use the fold buttons, then just leave them alone and leave the "fold_buttons"
setting unchanged. Another cool feature in Sublime Text is the ability to scroll past the end of the last line in a file. In many editors, if you wanted to add code to the end of a file, you would always have to work here at the lower portion of the screen.
13:24 You couldn’t really shift that up and you might have to move your window up to actually be able to fit that on a part of the screen that you enjoy, that’s easier to work with for you. Now with Sublime Text, you can just scroll past the end of a file and move that anywhere you want so that it becomes a lot more comfortable working with the code. Now, I really like having the ability to do that, but you can also turn that setting off if you want the behavior.
13:49
I’m going to show you how to do that. You want to go back to your settings and then set "scroll_past_end"
to false
, and this will change to the behavior so that you can’t scroll past the end of a file. So, depending on what your preference is here, it has the advantage that you can just always scroll down and it will, you know, not bounce all the way up on your screen and you’ll know where to look when you’re looking for the end of a file.
14:11
But personally, I still like having that enabled. There’s one more useful setting I want to show you here, and that is the "shift_tab_unindent"
setting.
14:21
We’re going to set that to true
and then save the file. And now what this allows you to do, it allows you to use the Tab key to indent your code. And that already worked previously, but now you can also press down on Shift and then hit Tab again and it will undo the indentation.
14:38 And I find that that’s really helpful for working with your code. It’s kind of like the Control + / (slash) button that allows you to comment out the selection or the active line, and it works the same way where you can comment and then uncomment the line.
14:52
And I kind of like having the Tab key work the same way, so this is why I like to turn on this "shift_tab_unindent"
setting. Highly recommended.
14:59 So, I just showed you some additional visual tweaks you can make to the editor area with these settings that we added to your user settings. And what we’re going to do next is actually completely customize the color scheme used by Sublime Text. And this is going to work in two ways.
15:15 Sublime Text is really flexible when it comes to these color scheme customizations. Not only can you change the way the syntax highlighting works here, but you can also change things like the sidebar here—so we can get rid of this brightness here, this really bright area here—but you can also change how some of the dialogs like the Find dialog are rendered. I’m going to show you how to do that now.
15:35 So, the way this works in Sublime Text is that for the code editor area here with the syntax highlighting, these will be effected by color schemes or by what Sublime Text calls a color scheme.
15:47 And a color scheme really only affects the code editing area here. And actually, Sublime Text comes with a couple of color schemes built-in, and you can select those by going to Preferences > Color Scheme, and there you can select some of the built-in patterns. So for example, the Blackboard theme kind of has a DOS Borland Turbo Pascal feel to it.
16:10 Or you could go to Color Scheme and maybe select something like the IDLE preset that gives you a super bright, white color background.
16:19 And there are also some more subdued choices, for example, Zenburnesque, which is kind of nice. So, you can play with those and see if you find something that you like, or you could also install one of the many third-party color schemes that are available through the Package Control installer.
16:35 So we’re going to go ahead and fire up Package Control again. I want to show you how to install one of my favorite color schemes, and it’s called the Tomorrow Night color scheme, and it’s part of the Tomorrow Color Schemes package.
16:47 We’re going to install that. And then once that’s installed, this adds a new color scheme here to our Preferences menu, and you can go and select the Tomorrow Night color scheme.
16:58 And I really like this color scheme because it’s super legible and it’s really low on the brightness level, too, so it’s not very straining when you work with it for a long time.
17:06 And I really like the color scheme too, in general. So, this is the Tomorrow Night color scheme. And other color schemes would be installed in exactly the same way, and you would enable them here through the Color Scheme settings. Now, the next thing I want to show you is how to install a custom color theme, which will then affect how all of these other areas in the Sublime Text window are going to be rendered. So similarly to how we installed the Tomorrow Night color scheme, we can install a color theme, because it again works through the Install Package functionality. I’m going to show you a color theme that I really enjoy.
17:41 That one is called SoDaReloaded, so you just want to search for that. I think SoDaReloaded stands for Solarized Dark Reloaded. It’s kind of funny with these color schemes, where someone at some point created a color scheme that was called Solarized and then I think someone created one that was Solarized Dark, kind of a dark version of that.
18:00 And then people keep forking these and improving these, and so now we’ve ended up with this SoDaReloaded scheme that I really like. Let’s install that now and I’m going to show you how to set that up. Okay, so once that SoDaReloaded completed its installation, it actually pops up this message here that shows us how to activate it. Because with a color theme, we need to actually manually copy this setting over to our Sublime Text preferences, so I’m going to go back to the preferences here and then just paste that in and then save my settings. And this will immediately re-render the screen, but to be on the safe side, we’re going to close all the windows here and quit Sublime and then start it again, because it usually gives a better result. All right, and now we’re back at this Python file, and you can see here that the sidebar looks much different.
18:50 Now we have these colored icons, which I really like because they make it a lot easier finding the files and the file types that you’re looking for. And also, it’s a lot less distracting now because the color difference or the brightness difference is just much lower. And when I open up the search box, you can also see that the dialog here has changed quite a bit.
19:11 I also really like the tab bars up here, they look a little bit different too. I really enjoy this combination of the Tomorrow Night color scheme and the Solarized Dark color theme. And of course, there’s so many more combinations you might want to try out, and again, this is a very personal decision and something where you really need to find an option or a combination of options that works really well for you. But again, now you know how to install a color theme and how to activate it, and this would be really similar with any kind of other color scheme that you want to install. So with this skill, you’re well-equipped now to go out and try out a bunch of color schemes until you find one that you really like.
19:48 Here’s a quick recap of what we learned in this lesson. We installed a custom editor font that we downloaded and set up in Windows and then enabled inside Sublime Text.
19:57 I showed you how to improve Sublime’s font rendering to get a crisper font rendering, and just a nicer, more legible result. And then I showed you a couple of tweaks and improvements you can make here to the code editing area. And lastly, I showed you how to completely customize the color theme inside Sublime Text.
20:13 You can get a completely different result compared to the standard settings and the default theme and color scheme.
You must own this product to join the conversation.
konstantinsm on May 26, 2020
Hi, I’d like to share one UI setting I find useful to magnify editor’s status and file browser areas: “ui_scale”: 1.3