sub·lime [suh-blahym]
Adjective: Of such excellence, grandeur, or beauty as to inspire great admiration or awe.
This is not going to be a “Why Sublime Text 2 is better than <insert your preferred editor here>” post. But the pure awesomeness of Sublime Text 2 will make your current editor look like a chump. A very slow chump.
Hopefully this post will serve as a guide to give anyone wanting to try Sublime Text 2 instant gratification. Let’s go…
1 — Get It!
To get started, grab the latest Sublime Text 2 Beta. If you want to live on the edge, you can grab the dev build of Sublime Text 2 here. Sublime Text 2 is available on OS X, Linux and Windoze.
2 — Package Control
Any editor worth its salt supports a vast array of add-ons and plug-ins. Sublime Text 2 is no different. A full-featured package manager is available that helps managing and discovering new packages.
Installation
To install Sublime Package Control open the Sublime Text 2 console (^`) and paste the following code into it.
Usage
Once you’ve restarted Sublime Text 2 you are ready to install some packages.
Open the Command Palette (⌘⇧P) and begin typing Package Control to see a list of available commands. Select the Package Control: Install Package option and press ⏎.
Use your arrow keys or start typing to find packages to install. Once you found a package press ⏎ to install it.
Here’s a list of great packages to get started with:
- Abacus
- BracketHighlighter
- CoffeeScript
- FileDiffs
- Gist
- Git
- Haml
- Nettuts+ Fetch
- Rails Related Files
- RSpec (snippets and syntax)
- Ruby-Slim
- SCSS
- SideBarEnhancements
- ToggleQuotes
- VintageEx
All of the above packages can be installed via Package Control with the exception of Ruby-Slim. To manually install Ruby-Slim, or any other package, just clone the repo into the
Packages
folder.3 — Making It Pretty
Although some UI improvements have been made, Sublime Text 2’s default UI is still fuggo.
- Start the beautifying process by installing the Soda UI Theme via the Package Manager.
- Open your preferences file,
Preferences > Settings - User
or by using the ⌘, shorcut. - Activate Soda Theme by either adding
Soda Light.sublime-theme
orSoda Dark.sublime-theme
to your settings file.
Sublime Text 2 ships with an alright-ish set of color schemes, but everyone has their preference. My personal favorite isSolarized. To install it, simply clone the textmate-solarized repo into the
Packages
folder.Once installed, activate it under
Preferences > Color Scheme > Solarized
or add it to your preferences file.All of this will make your editor look… Sublime!
If you prefer light colors, here’s Sublime Text 2 with Soda and Solarized Light.
4 — Command-Line Setup
To open files and folders from your command-line you need to add Sublime Text 2 to your path.
To make it easier to edit directly from your current directory, add the following alias.
6 — Notable Features
Command Palette
The Command Palette is an interactive list of all the commands available to Sublime Text 2. Whether you need to visit a Preferences page, or paste in a snippet, all of that can be done here. The Command Palette can be accessed by the⌘⇧P key binding.
File Palette
Giving you quick access to your files, the File Palette also lets you quickly jump to methods, functions or even markdown headings. Access it with ⌘P and after typing the file name, type @ to jump directly to a method in that file without even opening it. You can also use the ⌘R key binding.
You can also use : in the File Palette to jump to a specific line number in the current open file, or use the ^Gbinding.
Multi-Selection
Although vertical selection is nothing new, Sublime Text 2’s multi-selection takes it to another level. You effectively have multiple cursors on a single page.
To enabled multi-selection, you have the following options:
- Hold down ⌘ and then click everywhere you require a cursor.
- Select a block of lines and then press ⌘⇧L.
- Place the cursor over a word and press ⌘D repeatedly to select additional occurrences of that word.
- Alternatively, pressing ⌘^G will select all occurences of that word.
Split Screen
Simply, a MUST have! By pressing a few keys you can quickly split your screen.
Columns: 2 ⌘⌥2
Rows: 2 ⌘⌥⇧2
Grid: 4 ⌘⌥5
Vintage Mode
Are you a Vim Ninja? Then you are in luck. Sublime Text 2 has a Vintage Mode setting that will allow you to use the Vi commands you can’t code without.
To enable Vintage Mode make the following change to your preferences file.
After a quick restart, press ⎋… Bam! Command mode!
To take full advantage of Vim’s command-line mode you will need to install the VintageEx package. After installing it, just press : to open the Vim command-line.
To see all the implemented commands, just look through ex_commands.py.
5 — Customising Settings
For all settings, Sublime Text 2 has at least two files… Default and User. You can edit any of these files, but it is recommended to edit the User setting files.
- Settings - Default This file contains all the settings to configure Sublime Text 2. It can also serve as a great reference.
- Settings - User This is where you can override the defaults to better suit your own needs.
- Syntax Specific - User Allows you to configure settings for specific file types, like applying a ruler to markdown files.
- Key Bindings Key bindings… Move along.
Here are some basic settings to get you started.
Conclusion
As noted by a friend, “Sublime Text 2 made it to version 2 stably”. Even in its current state Sublime Text 2 surpasses most “stable” editors out there, and it did not require everyone to wait years for a major version bump.
When it comes to choosing a text editor, all developers have their own preference and favorite. I feel that Sublime Text 2 bridges the gap between hardcore code wrangling and an editor with a slick user interface.
Give Sublime Text 2 a try! You have nothing to lose and everything to gain.
Post a Comment