Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A new user's guide to SublimeText 2. Estimated reading time: 2 mins. Estimated workthrough time: 12 minutes.

Make it useful

  • Install Package Control. For SublimeText 2, paste the following in Terminal:
import urllib2,os; pf='Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), 'wb' ).write( urllib2.urlopen( 'http://sublime.wbond.net/' +pf.replace( ' ','%20' )).read()); print( 'Please restart Sublime Text to finish installation')

From here on out, use Package Control to install everything. +Shift+P, then type Install to get a list of installable packages you can 'livesearch through. After installing plugins, they should be running.

Make it look good

Add helpful tools

  • SideBarEnhancements for an actually useful sidebar.
  • GitGutter tracks line changes in the gutter.
  • Scss syntax highlighting is sorta necessary. Called Scss in Package Control.
  • SublimeLinter makes you code more good. Has HTML/CSS/JS linting and hinting.

There are infinity tools in Package Control, so if you have some kind of weird coding fetish, there's probably a package for you. #R34

Customize settings

In the File Menu, go to SublimeTextPreferencesSettings – User. It opens a JSON file with some options. Here's my setup. Go through and comment on/off each one to see what it does. I try and keep it alphabetized.

{
	"auto_complete": true,
	"auto_complete_commit_on_tab": true,
	"auto_complete_with_fields": true,
	"bold_folder_labels": true,
	"caret_style": "phase",
	"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
	"detect_indentation": true,
	"fade_fold_buttons": true,
	"folder_exclude_patterns":
	[
		".svn",
		".git",
		".hg",
		"CVS",
		"tmp",
		".bundle",
		".sass-cache"
	],
	"font_size": 12.0,
	"highlight_line": true,
	"highlight_modified_tabs": true,
	"ignored_packages":
	[
		"Vintage"
	],
	"line_padding_bottom": 1,
	"line_padding_top": 1,
	"rulers":
	[
		80
	],
	"soda_classic_tabs": false,
	"soda_folder_icons": true,
	"tab_size": 4,
	"theme": "Soda Light.sublime-theme",
	"translate_tabs_to_spaces": true,
	"trim_trailing_white_space_on_save": true,
	"word_wrap": true,
	"wrap_width": 120
}

Favorite features

Everybody has their favorite built-in features, here are mine:

  • ~$ subl .: You can symlink a SublimeText command line tool that can open folders you've navigated to Terminal. If you want a more graphical approach, drag a folder onto the icon.
  • +t: Quick open files. Just start typing the filename you want. No more folders. Glorious.
  • +f: Find in File. Bonus: Hitting alt+return to "Find All" will multi-select all instances of the search term. Start editing instantly.
  • +Shift+F: Find in Project. Great for grepping redundancies, finding !importants, and more. In the results, click the file location to open it.

There's infinity more features though. Setting up Projects is pretty bad ass because you can hide bullshit build folders (like stylesheets/ and _site/). I'm not a pro at it yet, but it's pretty handy. Lots to love.

@elyseholladay

This comment has been minimized.

Copy link

commented Oct 29, 2013

  • "save_on_focus_lost": true, for auto-saving, which is genius when paired with CodeKit/LiveReload.
  • "create_window_at_startup": false, to get rid of that annoying window on open

+1 for setting up projects and hiding build/temp folders.

Flatland is my current favorite theme: https://github.com/thinkpixellab/flatland

Aqua Theme comes with some great color schemes https://github.com/cafarm/aqua-theme including the Tomorrow color schemes https://github.com/chriskempson/tomorrow-theme

@davatron5000

This comment has been minimized.

Copy link
Owner Author

commented Oct 29, 2013

Also, for more information and package recommendations, check out these two guides suggested on Twitter.

@bensmithett

This comment has been minimized.

Copy link

commented Oct 29, 2013

Also super handy:

@gscottolson

This comment has been minimized.

Copy link

commented Oct 30, 2013

Awesome guide, Dave. I have a couple additions:

Add a newline to the end of a file, which plays nicely with some version control systems:
"ensure_newline_at_eof_on_save": true

Show me what the whitespace characters are (to quickly determine if tabs or spaces are being used):
"draw_white_space": "all"

@rwaymouth

This comment has been minimized.

Copy link

commented Oct 30, 2013

Tutsplus has a good overview course here:

http://net.tutsplus.com/articles/news/perfect-workflow-in-sublime-text-free-course/

Some of it might be out of date now, but it gives a good rundown of what you can do.

@adamjohnson

This comment has been minimized.

Copy link

commented Oct 31, 2013

Zander Martineau has a pretty sweet (and moderately popular) Sublime Text Setup introductory guide:

https://github.com/mrmartineau/SublimeTextSetup

@cbracco

This comment has been minimized.

Copy link

commented Nov 9, 2013

Here's my setup in case anyone's interested: https://github.com/cbracco/ST2-Setup

@mifas

This comment has been minimized.

Copy link

commented Nov 11, 2013

alt+shift+w to create instance tag. If not working, find it insert_snippet in your default keyboard map file

@nicinabox

This comment has been minimized.

Copy link

commented Feb 11, 2014

I'll just throw this in. I created this script to setup Dropbox syncing and symlink the command in my PATH (I prefer sub over subl. Rebel, I know.)

https://gist.github.com/nicinabox/7470922

@djfarrelly

This comment has been minimized.

Copy link

commented Feb 11, 2014

Great guide. These are all essentials to a good ST2 setup. To additional setting recommendations that I love & recommend:

"scroll_past_end": true - Allows you to scroll the bottom line of the file you're viewing to the middle of the screen
"spell_check": true - This is great when you're writing copy in HTML. I turn this off for specific types of files, i.e. Python

To override a setting for a specific syntax, when a file is open goto SublimeTextPreferencesSettingsSettings - MoreSyntax Specific. Really helpful for setting different tab sizes or tabs-as-spaces per language.

@WickyNilliams

This comment has been minimized.

Copy link

commented Feb 11, 2014

One great thing about cmd + t (or cmd + p in fact) is that it is a jump off for other features too. If you bring up the jump-to dialog with that command and then enter : you can jump to a line number. If you enter @ you can jump to symbol (e.g. method in JS or class in CSS).

This functionality can also be accessed directly

  • Go to line number ctrl + g
  • Go to symbol cmd + r
@ded

This comment has been minimized.

Copy link

commented Feb 11, 2014

I couldn't stress how important @bensmithett's comment on Dropbox syncing is. Nothing like creating new preferences and having them available on multiple computers.

@fabean

This comment has been minimized.

Copy link

commented Feb 11, 2014

Super awesome! I just went ahead and changed my theme. I just earlier today was complaining that the tabs on Sublime didn't have retina support. Now I'm using spacegrey as I'm a fan of dark themes for coding.

@bloqhead

This comment has been minimized.

Copy link

commented Feb 11, 2014

Tons of handy stuff here. These are my settings with some things from here thrown in. Nice work.

@hamedqaderi

This comment has been minimized.

Copy link

commented Feb 11, 2014

Thanks. I like your setting

@code26

This comment has been minimized.

Copy link

commented Feb 12, 2014

Very nice tips. If you're looking for a more readable font, install Inconsolata font then use with

"font_face": "Inconsolata",
"font_size": 11,

http://www.google.com/fonts/specimen/Inconsolata

@jimpriest

This comment has been minimized.

Copy link

commented Feb 23, 2014

I try to keep a list of relevant links here: http://thecrumb.com/wiki/sublime Somewhat focused on ColdFusion but a lot of general info there as well.

@growdigital

This comment has been minimized.

Copy link

commented May 7, 2014

One of my favourite tidbits is EditorConfig, a simple configuration file that ensures file consistency across text editors, eg

# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@cferdinandi

This comment has been minimized.

Copy link

commented May 8, 2014

@djfarrelly - Scroll past end = brilliant! Didn't know about that one, and often found myself adding line breaks during development. Thanks!

@KatieK2

This comment has been minimized.

Copy link

commented Oct 13, 2014

Cool resource! But why do you specify behaviors which already default to true? Ex: auto_complete and fade_fold_buttons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.