Smultron Editor

I'm a "vi" kind of guy. Whether it's writing scripts or posts for this web site, vi is my tool of choice

Part of that is quite utilitarian. Vi is always available, except on Windows, of course, but I don't write posts on Windows and certainly don't do any Windows scripting. Everywhere else, I can count on vi.

But it is also force of habit. I'm used to vi, can do what I want to do quickly and efficiently, so why use anything else? Why indeed. I'm not about to switch.

Yet for the purposes of this review, I'm actually using Smultron, a Mac OS X editor.

The first thing I wanted to check out was search and replace. This is usually where editors fail to impress me. Vi has wonderful search and replace features. For example, when writing posts like this, I may paste in a list of web site references:

http://abc.com
http://xyz.com

and so on. I want to change them into hyperlinks, so in vi I'd simply do:

s/\(.*\)/<href=""><\/a>/
 

That may look awful to the uninitiated, but it really breaks down very simply. See Vi Primer for a quick introduction.

So how would you do that in Smultron? Well.. I don't know. I don't think you can. The search and replace supposedly recognizes regular expressions, so you can say that the "find" part matches ".*", but there's no apparent way to refer to what was matched. It isn't \1 or $1, and Smultron's "Help" link is entirely mute on this subject.

Worse, Smultron is worried that you might have made a mistake: when you execute a search and replace Smultron asks if you are sure. I couldn't find anything in Preferences to turn that nag off.

More maddening is the "Undo" feature. If you mistakenly replaced more than you wanted to in selected text, you have to re-select the changed text before you can undo it!

Smultron does have a "Close Tag" feature (command T) that works well for typing in html documents like this. I also like that it displays line numbers and can easily display invisible characters, though the distinction between a space and a period isn't much in that mode.

Smultron can be set to auto complete words after a delay period of your choosing. As it lacks spell checking, that's at least a partial substitute. That feature does make it difficult to type html tags, though: if you start <p it Smultron thinks the "p" should be the word "period". Also, if you have accidentally mistyped something, Smultron will add that to its list of words to suggest, making it very easy to keep compounding the mistake. I found auto completion more annoying than useful, so turned it off.

Smultron can do automatic indenting and supposedly can indicate matching braces in code, but I couldn't figure out how you ask it to show the matching brace and again the documentation is non-existent. There's also supposedly syntax coloring that supposedly shows unclosed tags; how to trigger that eluded me.

That's undoubtedly the most annoying part of Smultron: no documentation. I suppose if you must have a graphical editor, and don't mind one that has lousy documentation, then Smultron might be useful to you. It sure is not useful to me.



Got something to add? Send me email.



8 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Anthony Lawrence







Mon Jun 26 14:25:16 2006: 2172   bruceg2004


I am very happy with TextMate. When I am not using vi, I am using TextMate, and have only scratched the surface of what it can do. I mostly use it for project management. According to the website, you can run code right in the editor, and it has the regex of grep in it's search/replace.

(link) (link)

I tried Smultron, as well. I also trialed BBEdit, and TextWrangler, and settled on TextMate.

- Bruce






Fri Apr 27 14:10:03 2007: 2978   anonymous


Could you please sprinkle in some more ads within your articles. I think you still have room to make your site a bit more obnoxious.






Fri Apr 27 14:18:24 2007: 2979   TonyLawrence

gravatar
Happy to take 'em all out if you'd like to step up and pay for the time and expense of running this site.

It's about $2,000 a month all told - when shall I expect your first check?



Fri Oct 17 11:23:57 2008: 4652   GwynethLlewelyn


At least on Smultron 3.5, regexp search & replacing uses the $1 as placeholder. It works fine, even if it's a bit slow.



Wed Mar 11 11:52:45 2009: 5653   NickMariette

gravatar
I have been using smultron 3.1.2 for my thesis and it has been handy for consistency - e.g. fixing SI units to always have a space between the digits and the unit = e.g. 500ms should be 500 ms.

I almost thought I was doomed when I struggled to find a way to do this in smultron after it had been helping me in lots of other ways. I saw the previous comment about v3.5 and almost considered trying a machine with Leopard just to try it out....

I tried to do it in textwrangler - and found a way (thanks to it's very thorough documentation - definitely missing in smultron). but then i tried the same method in smultron and it worked.

so. long story short:
you have to use grep's subpattern syntax (see textwrangler manual page 145 - writing replacement patterns).

so for my problem, i could add a space wherever a digit was followed by ms by finding:
(\d+) ms
and replacing it with:
\1 ms

hope this helps some others with this problem!



Wed Mar 11 12:33:12 2009: 5657   NickMariette

gravatar
Careful!
- Actually the replace string should be $1 (not \1).



Wed Dec 9 05:16:05 2009: 7729   anonymous

gravatar
To find the matching brace, just scroll the text-cursor over the brace with left or right arrow keys and the matching one will be highlighted.



Fri Apr 16 11:24:08 2010: 8424   MartinvanDijken

gravatar


I just found the reference to the smultron regular expression engine, but your blog is first up if you google for smultron regular expression :-)

(link)

The help in Smultron is still as lame as you remember, but the functions themselves work really well.




------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Premature optimization is the root of all evil. (Donald Knuth)

The people I distrust most are those who want to improve our lives but have only one course of action in mind. (Frank Herbert)








This post tagged: