Mimsy Were the Borogoves

Hacks: Articles about programming in Python, Perl, Swift, BASIC, and whatever else I happen to feel like hacking at.

Smultron text editor

Jerry Stratton, October 27, 2006

I am a slut for text editors. A richer, nicer-looking one comes along and I will dump my old one in a flash. I’ve tried every new text editor I’ve seen for at least a couple of seconds, using VI since forever, settling on BBEdit Lite on Mac OS and later Mac OS X, dabbled a bit with HyperEdit, moved to SubEthaEdit, and am now using Peter Borg’s Smultron.

Smultron has all or most of the basic features I expect in a modern text editor: syntax coloring, HTML preview, automatic indentation, but it has a few other features that quickly become indispensable:

Multiple files in a window
Smultron has tabbed windows, so that if I’m editing five or six files at a time I don’t need five windows open. Now that I’ve started converting Negative Space to Django, this is very useful.
Projects to organize those files
Smultron also allows me to assign files to projects, so that I can open one project file to load all of the files attached to that project. I can also have multiple projects open, and when I switch from project to project the tabs for open files also switch to that project. When working in the Django version of my web site, for example, this means I can have a project for the HTML templates and CSS files, a project for the main application (that holds the pages), and a project for each of the secondary applications, such as the Shooting San Diego range listing.
Auto-indent after an open curly
Smultron doesn’t just maintain indentation at the same level as the previous line. It also can automatically indent after an open curly bracket, and automatically de-indent after a close curly bracket. This takes some getting used to after having to hit tab/delete myself in every other editor I’ve used, but once I got used to it I found it brilliant. The only real problem is that it doesn’t work in Python, because Python doesn’t use curly brackets. Obviously, most of my Django programming is in Python.

Problems

There are some serious problems with Smultron that I’m willing to put up with only because I love the ability to open multiple files in projects.

  1. Command-left curly bracket to indent and command-right curly bracket to de-indent deselects the selected text. There is a workaround for indenting, but not for de-indenting and in any case it has its own problems. I can use tab instead to indent the selected text, but when I highlight the entire line(s) and tab, it grabs onto the first character of the next line. Whereupon if I hit tab again, that extra line starts indenting, too. There is no working de-indent that maintains the selection. If anything were to get me to stop using Smultron, this is it. Modifying the indent is important for me in everything I use a text editor for.
  2. Adding a close curly bracket auto de-indents, but it also sometimes deletes the next carriage return. Often this means that the next line ends up on the same line as the close curly.
  3. Auto-completion of typed text sounds cool, but is for all practical purposes worthless for programming. It changes the case of what you’re typing even if you don’t choose any of the auto-complete guesses.

Launchd Editor

Peter is also author of Lingon, which makes launchd look very cool. I may have to look at converting my cron jobs over to launchd.

January 2, 2007: Smultron indentation problems fixed?

Just a quick note that the indentation problems I noted in the earlier post appear to have been fixed. I’ve been happily using Smultron at work and home for several weeks.

  1. <- Python Appscript
  2. PHP Tutorial ->