Smultron Code Editor

In developing software, the choice of tools used can affect the ease of the job significantly. While the choice of a language may dictate the compiler to be used, there are generally a number of options for the code editor. For most C, Objective-C, and Java applications, I use Apple’s XCode IDE for the simplicity of having the editor, compiler, and executable all in one interface. For projects in which I won’t be using XCode, however, I now generally use Smultron as the code editor.

Smultron is a free, open source code editor available for Mac OS X 10.4 (Universal). I switched to Smultron recently, having previously used TextWrangler extensively. Smultron offers most of the features I used regularly in TextWrangler, including custom language syntax coloring, balancing delimiters, and regular expression searches. Furthermore, Smultron is under active development, and the developer is quite responsive about bugs and feature requests. For example, I had requested key strokes to delete from the cursor to the end or beginning of the line, a feature present in TextWrangler (but not in XCode) to which I had grown accustomed. This feature was added in the next release, which came shortly thereafter.

A feature shared by TextWrangler and Smultron is support for custom language syntaxes, allowing colorizing of languages not included. I use this feature at work, where I use a proprietary LISP-based language. Both editors allow the user to create custom syntax definitions in Apple’s XML PList file type. Syntax elements include keywords, comments, strings, and functions.

While both editors read the syntax files and colored the source code appropriately, it ended up working better with Smultron than with TextWrangler. First, both editors have a command to comment/uncomment the selected text. In TextWrangler it’s only a menu command by default (annoying), but key sequences can be assigned to all the menu items in the preferences pane (a very nice feature, indeed). Unfortunately, while TextWrangler correctly recognized and colored comments as such, the comment/uncomment command had no effect on files using my custom syntax definition. This was not a problem for Smultron (where the comment/uncomment command has the key sequence ?-/, not editable in the preferences), which correctly commented and uncommented selected text. (Incidentally, I also have to use Microsoft Visual Studio occasionally at work, and it won’t uncomment a selection if a blank line is included, a problem not shared by Smultron.)

Another feature that works with Smultron that I couldn’t get to work with TextWrangler was functions. Many code editors allow you to go to a function defined in the current file by selecting its name from a menu. Both of these editors support that, but I couldn’t get TextWrangler to recognize functions with my custom syntax, whereas Smultron does it quite well (in both cases it’s based on regular expression matching).

Some other features I will briefly mention that both editors share (and comes in very useful, especially with the LISP-based language I use at work), is the ability to double-click on a delimiter (such as a parenthesis or brace), and have the text selection extend to the matching opposite delimiter. Smultron will highlight the opening delimiter when a closing delimiter is inserted or crossed over with cursor; TextWrangler will highlight the opening delimiter only when the closing one is inserted. Double-clicking on a delimiter works from either end. The other feature that can come in handy occasionally is to use them as external editors with an FTP client such as Fugu (from my Alma Mater), or Cyberduck, so you can edit the file directly, without having to download it, edit it, save it, and upload it again.

All in all, these are both quite good editors. TextWrangler is very robust. At one point recently I need to look over a file containing over 333,500 (don’t worry, that wasn’t source code!) lines. I initially tried to do it on the Windows machine on which it resided, using various editors including Crimson Editor, a free editor similar to these two that I use with Windows; notepad; WordPad; and MS Office Word. None of these applications could handle the file. So I transferred it to my Mac, where TextWrangler handled it with aplomb (this was before I started using Smultron, so I don’t know how it would have handled it). Smultron occasionally crashes, but the developer is good at getting fixes out quickly. Although TextWrangler currently has a more robust feature set, Smultron is undergoing active development, with new features added frequently. I have found it to be a very good editor, and use it almost entirely instead of TextWrangler now.

2 thoughts on “Smultron Code Editor

  1. Mugunth Kumar

    Nice comparison… IMO, i felt smultron to be snappier than text wrangler. In my mac, text wrangler seems to be a bit sluggish to start where smultron opens instantly.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *