I have been looking for a decent code editor for a long time, as my favourite was previously Smultron but it's been slewed with problems in newer OS X releases ever since it was discontinued (and then subsequently forked and re-started as a closed-source application). I tried Eclipse, TextWrangler, Coda, and Xcode at different times but each had little things that I didn't like about them so I kept putting up with Smultron's little glitches.
I came across this thread in r/apple on reddit that suggested Sublime Text 2 and I absolutely recommend it to everyone! I have been using it ever since I first installed it.
The UI is very simple and clean and there's no button toolbar giving it a minimalistic feel (which I prefer in text editors; this is where Eclipse failed me). I should also mention that the whole program is very snappy and it responds very quickly to any query, even complex regex finds across several files or editing large files.
It has some really nice features (some very unique) which are worth mentioning (for simplicity's sake I use
Ctrl below as the modifier of choice, on OS X simply substitute with
Cross OS with per-user license
This strictly speaking isn't a "feature" but it certainly is worth mentioning. ST2 merits its $59.99 pricetag based on its features alone but what makes it even more attractive is that it runs very well on Windows, OS X and Linux with portable editions available and the licensing is per-user... Use it at work, at home, on the go, on any number of your computers with any OS. Oh, and did I mention you can even sync your packages & settings across all these machines and OSs via Dropbox? Awesome sauce.
After trying it in ST2, the feature now seems so obvious and natural that I wonder how I ever got by without it. Each line receives to receive its own cursor and copy/paste buffer, so you can very easily perform multi-line edits or variable renames. There are also several ways to create several cursors:
- Select a block of text and then use
Ctrl+Lto select the whole lines, follow up with
Ctrl+Shift+Lto split each line give each selected line its own cursor.
Ctrland click where you want to place a new cursor
- Highlight a text symbol (variable, associative array index or other) and matches will be highlighted. Press
Ctrl+Dto select them in sequence
- Open the Find Text (
Ctrl+F) and enter your query then click Find All
There's a good animated demo of this feature on the ST2 homepage.
Ctrl+Shift+P to bring up the Command Palette, where various ST2 or plugin actions such as setting file syntax, changing themes, inserting code snippets. The menu updates as you type and displays the best matches to your query.
Enter confirms and
It is particularly handy for add-on packages, as a package may provide some custom snippets or git integration (yes, you can diff and commit)!
Ctrl+R and start typing a part of a function name. ST2 will filter through all function names in your file and jump to the best match as you continue typing.
Enter dismisses the search,
ST2 has built-in package management via the Sublime Package Control extension. Simply copy the command from the page and enter it into the Console (opened via
Ctrl+`) and it auto-installs. From there, hit
Command+Shift+P to install, list or remove a slew of extensions right from with ST2 itself. There's even no need to restart it after installing or removing a plugin, it reloads what's necessary to get you going straight away.
Although ST2 is a text editor, not an IDE, it does have limited support for compiling & running files directly from within the editor. Its pluggable build system system allows add-ons to supply details on how to compile or run different file types.
Ctrl+B runs the one associated with the current file type/syntax. SublimeREPL is a great extension that provides a build system plugin and can also run interpreters as a new tab inside ST2.
Extremely customizable preferences
The ST2 preferences file is simple a JSON-like file where you place the parameters. Getting it set up the way you like may be a bit tricky since there is, at the moment, no preferences UI. That said, ST2 is one of the most flexible text editors I have encountered and practically every aspect can be tweaked provided you can find the configuration parameter's key name.
Edit single file in many places
Smultron had this feature as well but it was horribly buggy so I never was able to use it much... It works flawlessly in ST2. Just select File > New View Into File... and it opens up a new tab of the current file. You can view and edit in different portions, both buffers update simultaneously and undo/redo history works across views into the same file.
Alt+Shift on Windows or
Command+Alt on Windows allows you to layout the window in various configurations such as right/left or top/bottom. Triple column/row or 2x2 grid modes are also supported. These prove to be very useful in combination with the multi-view feature mentioned earlier, as you can setup to have 2+ views editing same file at different locations in a single window.