The idea of shelling out $60 for a text editor in this day and age is absolutely absurd, but I’m seriously contemplating doing so in the near future, because Sublime Text 2 appears to be the answer to all the things I hate about text editors. I’d been pointed at it before, but don’t like to increase my dependency on proprietary software, so it took a couple passes of seeing it do things right before I was willing to look seriously. But oh how it does things right. I’ve been using the uncrippled demo version for a couple days, and am seriously impressed.
It has all the basic features of a programmer’s editor. It can open multiple files (it uses a browser-style tabbed interface). It syntax highlights almost anything, does intellitext-style autocompletion on pretty much everything, and has shortcuts for context-aware section jumping (brackets/functions/classes/chapters, etc.) and the like. It does all this while remaining fast (startup/execute actions) and responsive (UI), and lives in about 8MB of private RAM — which is to say it is lighter than some of the command line editors I see people using. It also appears to have an excellent pluign framework, because there are a great many available.
One of the things that most frusterates me about programmer’s editors is that they usually do wrong things with shortcuts ingrained into my fingers by every other program I use, which is unacceptable. ST2 uses “modern GUI” keybindings – C+x C+c C+v (cut/copy/paste) all work like they should, as do C+z (undo) C+s (save) and browser-stye tab management like C+w (close tab). Furthermore, all the key-bindings are editable both per-user, and system-wide, as a straightforward format text file accessible from the UI.
While talking about keyboards, I am apparently unusual in that I ride my navigation keys, and ST2 not only binds them, it binds them better than expected. One tap to Home takes you to the current tab level, two taps to the actual beginning of the line. Del deletes, Shift-Del deletes whitespace until it hits text or newline. PgUp/PgDn jump up/down a page, Shift-PgUp/PgDn jump to the top and bottom of the document. The mouse is bound like any modern program, such that selection and scrolling work correctly, unlike most command-line based tools. At least on Linux, both the select and middle click and select, right click, choose from menu copy/paste mechanisms work correctly. It even supports multiple selection and column selection in reasonably straightforward ways.
Another thing that drives me batty about editors is modality. Not only do I not want modes in a text editor that do things other than accept text input, I don’t want modal dialogs that can pop up and eat my text. ST2 has neither (Except for the About window, which is a modal dialog for no apparent reason). Things that might happen in modal dialogs instead happen in either a nonmodal dialog area that appears at the bottom of the window, or (for text-oriented operations) in a input-accepting bar at the top of the window. The top bar does a variety of amazing things, including acting as a launchable, hinting search of the command reference, so if you think of a feature you want, it will tell you if it is available and if there are currently key-bindings for it, or let you use it directly from the search. Imagine Firefox’s awesome bar done right.
It can hook most common build systems (Makefiles and the various language-specific tools).. and like everything, the mechanism is pluggable, so simply dropping a LaTeX plugin in the appropriate place got me C+b to spit out a PDF from my LaTeX document. It detects if these are relevant based on the file and directory, but the automatic choice can be overridden (for cases where you have a Makefile that also generates LaTeX formatted documentation or the like). There appears to be a project managment system that I haven’t even messed with yet, but it apparently works with a pair of human-readable dotfiles in the directory, instead of demanding a particular layout and spewing files like most IDEs.
The search mechanism is also exactly what I always want: it accepts regular expressions, as well as case/whole word switchable simple queries. It does this with obvious controls for direction, and supports highlight all. It also does it across files, with straightforward control over which files are included. As an incredible example of it just being right, a day after I started using it, I needed a “replace preserving case” feature to modify a LaTeX document… I didn’t expect it to exist, but went looking as a “Wouldn’t it be cool” item since it seemed to be wish-granting, and it was not only there, but in the first place I looked on the replace bar – and it did exactly what I expected.
It does some neat things I haven’t seen before. The most obvious of these is that by default it has a tiny live view of the whole document next to the scroll bar, with the visible section highlighted, which is surprisingly useful for navigation. Furthermore, it supports almost every feature I’ve liked from the boneyard of rejected editors. Real-time underlining spell check? Present. Multiple views (ie. two simultaneous views into the same buffer which are kept mutually consistent)? Present. Split-window editing (think Screen/tmux)? Present. Code folding? Present. Bookmarks? Present. Case mangling? Present. Scope marking? Present. I keep finding amazing things, and it isn’t like vim, where you keep finding things because the learning curve is asymptotic. I haven’t even messed with the scripting and macro features yet.
This thing is impressive.