In which I play around with Vico

For many the holy grail of text editors is Textmate. In a very short time it became an indispensable tool for many, many programmers and sysadmins.

Then it stagnated horribly, it gets updated perhaps once per year (and then only to keep it running on the new OS release), and god forbid you find a bug: it will probably never be fixed.

(As I write this there is an alpha promised by Xmas. Many are understandably cynical about this.)

A bunch of projects started up to fill the vacuum created by TM2’s vaporware status. Without sounding too negative on what was an incredible amount of work, they’ve managed to re-implement much of TM1 in the time it took to get TM2 to alpha status. That said making your app compatible with the huge TM1 ecosystem (and what may be the TM2 ecosystem) is an obvious good design call.

Anyway, the two I had immediate access to are Vico and Sublime Text 2. More on Sublime Text 2 later.

To reduce it to the simplest description, Vico is a vi implementation in Cocoa (or at any rate, Mac-native) that is mostly TM-compatible (themes and bundles).

(Also note: I’m sort of unfairly conflating vi and vim here. Pedants, don’t freak out. Hopefully you’ll get what I mean.)

Whether or not you consider vi’s modal editing a plus or minus is not really even worth debating. If you don’t like modal editing, don’t bother to even try any modal editor.

Vico supports a pretty finite subset of vi commands, but enough that you’ll preserve basic muscle-memory when editing. As near as I can tell, commands aren’t as “composable” as a real vi, but that’s where the bundles take over.

Vico supports a subset of TM bundles, so you can probably drop in some functionality that would normally be done with vim macros or scripts.

You can also “drive” Vico’s functionality with built-in scripting using the Nu language. Nu is the (perhaps unholy?) fusion of LISP and Objective-C/Cocoa.  And example of using Nu scripting to perform an editor task (automatically hard-wrapping text in this case) is on the Vico blog.

Is that any better than Vim script, or ELisp? I dunno. Vico seems like too much mashed together. It’s in a weird place: if you’re determined to retain modal editing, why not just use MacVim? Well, MacVim is … not so much ugly as plain. So, assuming the creator can keep up with the state of the art enough to keep the users happy, it’s a nice way to appeal to modal editor junkies who somehow don’t fancy MacVim.

But what of the people coming from TM? Isn’t modal editing a huge change, even if it lets them keep some of their workflow? OK, you’re addicted to some set of TM features, but hopping into the world of modal editing seems like as big a jump as switching to some other editor (BBEdit, etc).

Anyway, Vico is an interesting project and I sincerely hope it stays around for a long time: I’m hugely in favor of taking “venerable” Unix concepts and wrapping them in modern clothes.

 

TextMate to BBEdit switcher’s guide: BBEdit has command-t now! (well, sorta)

For the full details, see here:  https://groups.google.com/d/topic/bbedit/J5YUlmHsVvM/discussion

Now, this feature is wonderful if you’re a long-time BBEdit user. It’s pretty extra awesome if like me you can only run PeepOpen on some of your Macs. And, for switchers looking for a native way to replicate their beloved cmd-t, it’s not bad.

That said I can totally understand why switchers would say “Not the same, not what I want/need”. My dream was to see them re-use the same dialog as the “Insert Clipping” window, which is just like (or damn near, in any event) TextMate’s window. PeepOpen includes extra functionality like showing SCM status.

Still, you can bind it to cmd-t and it’ll work close enough that your muscle memory might not get too confused. And be sure to check out the even more recent betas; they’ve been doing some big performance improvements (one of the reasons I have always kept BBEdit in my Applications folder, even when I’m trying out another editor or using an IDE for stuff like Java).

TextMate to BBEdit switcher’s guide: Bundles and scripts

The power of TextMate, and the reason many people continue to use it today, are the bundles.

BBEdit 10 supports ‘packages’, although this feature is very new and as far as I know, virtually no one is using it.

That said the feature itself is simply a replication of TM’s bundles concept, but the actual features themselves are available already.

Main Points:

Clippings in BBEdit are Snippets in TM.

Syntaxes are handled by Codeless Language Modules. The biggest different here is that BBEdit syntaxes are not “language aware”. The main point of CLMs are to do syntax highlighting and delimit folds, along with setting the clipping set. There are no “tab triggers” related to the syntax of the current language. You can do a LOT with Clippings to emulate this feature, though, but it’s not as pretty as tab triggers (IMHO).

Commands are a combination of Text Filters and Scripts. The manual covers these in great detail, but the short story is filters accept the selection or document on STDIN, and whatever the script returns replaces the selection or document on STDOUT; scripts simply run a command and the output goes to the special script output window.

There is another big takeaway here, which is BBEdit is incredibly scriptable in AppleScript. The only way to interact with BBEdit-the-application is AppleScript. So, things like “select the word at the insertion point” are only possible via AppleScript, whereas in TextMate you may have alternate methods via bundle scripting. (At least, as I recall, anyway, I haven’t done serious bundle devel on TM in some time)

You can have Clippings call AppleScripts which themselves call shell scripts; and you can use AppleScript to drive just about anything on your Mac. AppleScripts obtuseness and awkward syntax (for many programmers anyway) makes it somewhat unpleasant to work with, but there’s an immense amount of power.

Lastly, be sure to check out the sections on the manual about using AppleScript to override menu items. I mentioned this earlier and it’s another somewhat hidden gem in BBEdit.

 

TextMate to BBEdit switcher’s guide: Command T

What about “Command T”?

In TextMate, cmd-t opens a ‘find file’ dialog, letting users type a few characters of the name of a file in the project and it’ll “drill down”. This is extremely nice for opening files quickly without using the mouse.

Option 1: PeepOpen (most users)

If you have a reasonably modern Mac, you’ll want PeepOpen: https://peepcode.com/products/peepopen. Go buy it right now.

Option 2: The poor sad unfortunates with 32-bit Macs

If like me you use a 32-bit (original) Intel Mac (non-Core 2 Duo), you’re hosed: PeepOpen relies on MacRuby which relies on 64-bit. You might be able to get a version of MacRuby compiled to work under 32-bit (opinions differ as to whether or not it’ll work), but the short answer is “lovers of adventure only”.

So, you can use cmd-d to open files by name; be sure to check “Find all Matches” and, optionally, “Match Wildcards”. This isn’t exact TM cmd-t behavior, but it’s close when you can’t use PeepOpen.