There are some pretty neat ways you can make your install of Sublime look and act the way you want it to. In this post, I’m going to go over a few of those techniques. And since I’m running Windows, the instructions I give will be geared towards my machine.
Adjusting Your Settings
If you open Sublime Text and click on “Preferences > Settings – Default” from the top menu, you’ll see a file that looks like this:
This file is where Sublime holds your preferences. Now, if you scroll through all the lines in this file, you’ll most likely see something you’d like to change. There are some enticing options, such as to show or hide the gutter, what you want your margin to be, your font size, whether or not you want spell check. Tons of lines and they’re all begging for you to start editing. Don’t do it!
This isn’t to say that you shouldn’t edit your preferences. You just shouldn’t edit them in this file. Where you want to customize your editor is in your user preferences file. The way to find that is to click “Preferences > Settings – User” from the top menu. If you open that file, you’ll see something that looks like this:
Yes, it’s basically an empty file. It does have a line or two of text up top, though, that says:
// Settings in here override those in "Default/Preferences.sublime-settings", and // are overridden in turn by file type specific settings. { }
If you’re familiar with CSS or how WordPress templates work, this should be easy for you to figure out. These settings files cascade just like they do. To adjust your preferences, what you want to do is to find the line you want to edit in the “Preferences > Settings – Default” file, copy it and then paste it into the “Preferences > Settings – User” file. It’s simple. Here’s an example.
Say I want to edit the font size my editor uses for the code that displayed on the screen. Like I said above, I’d go into the default settings file and find the area where the font settings are held. On my install, it looks like this:
// Note that the font_face and font_size are overridden in the platform // specific settings file, for example, "Preferences (Linux).sublime-settings". // Because of this, setting them here will have no effect: you must set them // in your User File Preferences. "font_face": "", "font_size": 10,
All I need to do is to paste that code into the user settings file, in between the curly braces (while updating the font size). In this case, my edit would look like this (in the user settings file):
// Settings in here override those in "Default/Preferences.sublime-settings", and // are overridden in turn by file type specific settings. { "font_size": 12 }
Notice how I left off the comma.
I want to let you know that you can also customize your settings by file type, per syntax, per project, etc…If you want to learn how to do that, check out Sublime’s settings page. They give some excellent instructions. Also, if you’d like to expand on the instructions I just gave you regarding the settings file and your available options, you can check out Scott Granneman’s page on just that.
Adding a Custom Theme to Sublime Text
I’ve heard some grumbling out there regarding the “stock” look of Sublime Text. I’m not sure what these folks are referring to because I kind of like the way this editor looks right out of the box. But, since Kevin Yank is going over how to update the current theme to the “Soda Theme” in his course, I guess I’ll play along. But this isn’t something I would do. If you sense my lack of enthusiasm, this is why.
Okay, these are the instructions that were given to me in order to update to the Soda Theme.
1. Head over to GitHub at this URL (https://github.com/buymeasoda/soda-theme) to find the available download of the theme.
2. Download the theme by clicking the “Download Zip” at the bottom of the right column.
3. Unzip your folder and rename the “soda-theme-master” to “Theme – Soda” (it’s very important to name it exactly as you see here).
4. In Sublime, click “Preferences > Browse Packages” in the top menu and you should see a folder open. Drag or copy your “Theme – Soda” folder in that packages folder.
5. Once that’s done, click “Preferences > Settings – User” and inside that file, type:
{ "theme": "Soda Light.sublime-theme" }
6. Lastly, close Sublime Text and then re-open it. Your changes should now take effect.
Updating Your Color Scheme
Color schemes in Sublime are super simple to change. To update to a scheme that already ships with Sublime, simply click “Preferences > Color Scheme” from the top menu. From there, you’ll see a drop-down menu from which you can choose something to your liking.
If nothing appeals to you there, you can shop around on Google for something else. I just did this and came across a website that offers all sorts of color schemes for Sublime. It’s called, “ColorSublime” and can be found here. To install their schemes, check out their installation page.
If you’d like to download a color scheme from someplace like GitHub, just follow the instructions I gave you above for how to add a custom theme. This time though, after you add the folder to your packages folder, you’ll need to choose your new scheme from the Color Scheme menu I just described.
Customizing Your Key Bindings (Keyboard Shortcuts)
If you’re used to a certain keyboard shortcut doing a certain thing and just can’t get past the fact that Sublime uses that keyboard shortcut differently, you can change the situation. What I’m trying to say here is that you can alter Sublime’s standard settings for shortcuts.
The way to do this is to, first, check out what the default key bindings for Sublime are. Simply click “Preferences > Key Bindings – Default” from the top menu and you should see something like this:
Do you remember when I told you that you shouldn’t edit your default settings? Well, the same thing goes for this file. Don’t edit it. And if you couldn’t figure this out already, the way you customize a key binding is to grab (copy) the lines you want to change from the default file and paste them into the “Preferences > Key Bindings – User” file. So, if you wanted to switch the copy keyboard shortcut (Ctrl+C) with the paste keyboard shortcut (Ctrl+V), all you would need to do is copy this from the “Preferences > Key Bindings – Default” file:
{ "keys": ["ctrl+c"], "command": "copy" }, { "keys": ["ctrl+v"], "command": "paste" },
…and paste it into the “Preferences > Key Bindings – User” file. It would look like this:
[ { "keys": ["ctrl+v"], "command": "copy" }, { "keys": ["ctrl+c"], "command": "paste" } ]
Notice how I switched the “c” and the “v” and how I left off the last comma. You can do this for any key binding you see in the default file.
Well, that’s all for now. If you’re interested in more ways to customize your experience with Sublime Text, check out these great sites I found for you.
– Customize Your Sublime Text 2 Configuration For Awesome Coding
– Getting Started with Sublime Text 3: 25 Tips