Falling in love with Sublime Text
Sublime Text 2 is an incredibly fast code editor that I’ve been using off and on for web development since late 2011. Some major positives are the editor runs lighting fast on little resources and has a robust plugin system to supercharge any development.
Download the Software
Go here and download http://sublimetext.com. I’ll wait. after installing the software, while it’s more than capable as an editor, is not exactly the supercharged setup you want. Let’s fixed that.
Install Package Control
This allows you to easily install future plugins directly through Sublime Text and will minimize any errors in setting these up. To do this, press (Ctrl + `) to brings up the console (think Terminal or Command Prompt). Copy and past the line below to install the package control plugin:
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’
Wait a few seconds….and you should be finished! Now you can set up further plugins for your computer’s development.
Using the Command Palette
To begin, type Ctrl + Shift + P to bring up what’s called the Command Palette. The Command Palette is similar to a shortcut menu for everything to do in Sublime Text.
To use package control and install the more plugins, type in “Package Install” and hit Enter. A list of packages will display. Feel free to browse packages or type in the names below to install a package.
List of plugins that are recommended:
- Sublime Code Intel – Autocompletion options
- Sublime Linter – real-time error checking
- Zen Coding – adds Zen Coding features (cheat sheet: http://zen-coding.googlecode.
- Sublime JsDocs / DocBlockr – Documentation block generator for PHP & JS
- WordPress Plugin – adds WordPress Snippets for usage
- Alignment – Text alignment
- Fetch – Get Remote files
- Prefixr – CSS3 Prefixes
- Tag – Autoformat HTML
- SFTP – remote file management, local file/folder mapping to server, SSH and password management (license needed or annoying message pops up occasionally)
- ColorPicker – Color picker plugin
- Git – Source control integration
- Git Sidebar – git functionality in the sidebar
Sublime Text Shortcut Keys
Included a list of some short cut keys you will likely enjoy:
- (Ctrl + P) – Fast file switching, Line Number, Jump to definition (within file)
- (Ctrl + Shift + F) – Search and/or replace within files and folders
- (Ctrl + Shift + P) – command palette (preferences, add a snippet, etc.)
- (Alt + [1-9]) – Switch to a certain tab
- (Ctrl + M) – jump to bracket
- (Ctrl + Shift + M) – expand selection to bracket
- (Ctrl + D) – expand selection to word (multi-selection), multiple commands will select the next instance of the word
- (Ctrl + Shift + J) – expand selection to indentation (I have impeccable code formatting)
- (Ctrl + /) and Ctrl + Shift + /) – toggle comment line/comment block
- (Alt + .) – Close a started HTML tag
- (Alt + Shift + W) – Wrap in tag
- (Ctrl + Shift + Up/Down) – Move line up or down
- (Ctrl + J) – join lines together
- (Ctrl + Shift + D) – duplicate line
- (Ctrl + left mouse click) – multiple cursors
- (Shift + Delete) – cut the current line
- (CTRL + Z) – Go back 1 action
- (CTRL + Y) – Go Forward 1 action