Sublime Text Settings That Will Approve Your Life
I recently purchased a new computer and as part of that I had to reinstall Sublime Text (I always look at new computers as a clean slate so I don't copy over any of my settings). As I did so I had to go back through and find all the changes I've made to to my preferences. Here are some of the changes I've made in order to improve the way I develop.
For those of you who don't know how to edit your settings in Sublime yet, Sublime stores all it's user configurable settings in some JSON files. On the Mac, you can get to these settings from the Sublime Text > Preferences > Settings - Default. On Windows, it's just Preferences > Settings - Default.
spell_check
Default: false
Change To: true
This setting enables spell check as you type. I'm not really sure why this defaults to false (maybe there is some performance penalty) but as someone who can't spell this is a godsend. Back when I was still using Notepad++ I was always searching questionable words with Google and this has vastly improved my life.
save_on_focus_lost
Default: false
Change To: true
We all need to be worried about how many key presses we have left before we run into an RSI. save_on_focus_lost automatically saves all the open files when the application looses focus or when a file looses focus so instead of ctrl+s and then alt+tabbing all day you just need to alt+tab. It's also nice because you won't accidentally forget to save a file when you're making multiple file edits. The downside is that it automatically saves so you might save something you didn't want to but you should be working with source control anyways, right?
rulers
Default: []
Change To: [80, 120]
This setting enables two lines (you can add more) that show where the 80th and 120th characters fall on a line. It's not hugely important with the huge monitors we have now (even my laptop maxes out at about 200 characters) but the PSR-2 suggests:
There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less.
I try to stick to this guideline because it's really easy to put to much code on one line and then it's impossible to tell what's going on. :-)
translate_tabs_to_spaces
Default: false
Change To: true
Another PSR-2 suggestion:
Code MUST use 4 spaces for indenting, not tabs.
This one I can really get behind because if you've ever had to fix code on a Unix machine at the command line you know how inconsistent tabs can be between editors. It's even worse when there are some spaces thrown in there.
word_separators
Default: ./\()\"'-:,.;<>~!@#$%^&*|+=[]{}~?
~? (delete the dollar sign ($))
**Change To:** ./\\()\"'-:,.;<>~!@#%^&*|+=[]{}
This one is has a downside so you might want to play this this. This setting changes what Sublime uses determine if a character is a separator for actions like double clicking on a word. Normally if you double click on a variable it selects everything that isn't a word_separator so you get something like this (because dollar sign is):
If you remove the dollar sign then it works like this:
It's nicer because then you get the whole variable instead of just the text portion. The downside that I was talking about is that Sublime won't automatically highlight the other instances of the variable.
Closing
Sublime Text has all kinds of wonderful features that I didn't mention but can make our lives much easier (opening files in Sublime Text with ctrl+p is a great time saver). If you have other suggestions feel free to include them in the comments.
Scott Keck-Warren
Scott is the Director of Technology at WeCare Connect where he strives to provide solutions for his customers needs. He's the father of two and can be found most weekends working on projects around the house with his loving partner.
Top Posts
- Working With Soft Deletes in Laravel (By Example)
- Fixing CMake was unable to find a build program corresponding to "Unix Makefiles"
- Upgrading to Laravel 8.x
- Get The Count of the Number of Users in an AD Group
- Multiple Vagrant VMs in One Vagrantfile
- Fixing the "this is larger than GitHub's recommended maximum file size of 50.00 MB" error
- Changing the Directory Vagrant Stores the VMs In
- Accepting Android SDK Licenses From The OSX Command Line
- Fixing the 'Target class [config] does not exist' Error
- Using Rectangle to Manage MacOS Windows