Mac

About the Mac category

Note: I’m doing most of my Macintosh-related writing at O’Reilly’s MacDevCenter nowadays. Here’s my author page over there.

Vim a la TextMate

Alex Young posted “Vim for TextMate fans” a couple of years back, in which he ponders how to get the best of both worlds:

I’ve used vim a lot over the years, mainly because I spent a long time using Linux and it was there so I used it. The choice was obvious: vim or vi were on almost every machine I had access to, and worked excellently both locally and remotely. Once I’d learnt the basics I was set, I knew enough to get my work done.

Then I found TextMate for Mac OS. The immediacy of TextMate made it easy to get started with, and it has many excellent features. The problem is, I’m not always using a Mac. But you know who’ll follow me around to every platform I use? Good old vim! So I started thinking, how could I make vim feel more like TextMate?

Check out his screencast for more.

Agrippa: A Book of the Dead rebooted

A poignant experience on two fronts — via BoingBoing and Slashdot, William Gibson’s 1992 “Agrippa (a book of the dead)”, an electronic poem that came on a 3.5” Mac floppy and which, once it had been read, would encrypt itself into illegibility. Much to love about the concept (see Wikipedia for more info).

The researchers who captured the original Mac experience posted a video of it. Their website is currently slashdotted, boingboinged, and dugg into oblivion, so check out the currently vaporized post and video in a few days.

Meanwhile, you can read the poem at Gibson’s site. His introduction:

“AGRIPPA, A Book of the Dead” is a longish poem written in 1992 for a multi-unit artwork to be designed by artist Dennis Ashbaugh and “published” by art-guy Kevin Begos. Ashbaugh’s design eventually included a supposedly self-devouring floppy-disk intended to display the text only once, then eat itself. Today, there seems to be some doubt as to whether any of these curious objects were ever actually constructed. I certainly don’t have one myself. Meanwhile, though, the text escaped to cyberspace and a life of its own, which I found a pleasant enough outcome. But the free-range cyberspace versions are subject to bit-rot, it seems, so we’ve decided to offer it here with the correct line-breaks, etc.

“Agrippa” is the name of the particular model of Eastman Kodak photograph album my father kept his snapshots in.

On a semi-related note, check out the fun “Dr. Gunn’s Organic History Supplement for The Difference Engine”, a dictionary of terms for the Gibson and Sterling novel.

A command line ebook reader

I was casting around for a replacement for the excellent Tofu screen text reader for Mac, due to some encoding issues. Always wont to explore the command-line options, I turned first to the ubiquitous less pager, available on pretty much every unix-alike system out there.

The only real drawback to less is its apparent inability to wrap long lines at spaces rather than chopping words in the middle and sans hyphenation. This isn’t a problem on hard-return files like a Project Gutenberg ebook, but makes for difficult reading otherwise. (The opposite is the case for Tofu, which requires a bit of manual column widening to compensate for the hard returns.)

Doing a bit of poking around, I re-discovered the also-ubiquitous fmt command, which does word wrapping to a fare-thee-well, though doesn’t do paging.

Combining the two commands gives the best of both in classic Unix fashion:

fmt 1911EthanFrome.txt | less

You can also use options to enhance the experience. less -m will give you a prompt showing how far along you are in the file; see man less for others.

The pager recognizes vim movement keys, which I love. Plus you can hit the v key at any time to drop into vim, edit the file, and then return to less. Spiffy.

Of course, you could just use vim (or your favorite text editor), but I like the simplicity without the overhead. Unlike other options, less doesn’t read the entire file into memory before displaying it, a definite advantage on big documents.

Another Tip: If you’re in a Mac Terminal window, right click on a word or phrase to search for it in Google or Dictionary.

Bonus tangential tip: if you don’t care about downloading the text files but want to stick to reading Project Gutenberg files in the terminal, why not use lynx or ELinks?

screenshot of terminal window showing lynx web browser viewing the Edith Wharton novel Ethan Frome on Project Gutenberg

Vi Input Manager for Cocoa text fields

By Jason Corso. Updated earlier this year to work with Leopard.

Vi Input Manager

This bundle patches the Cocoa Text System to add a Vi-like command mode. After entering command-mode (typically, by hitting escape in Vi), ordinary Vi commands can be typed and the text field will be updated accordingly. Essentially, this add Vi command functionality (albeit a small subset) to any (and all) text editors that use the Cocoa text system; e.g., Safari, TeXShop, XCode, etc. Note, however, this does not work for other programs that do not use the Cocoa system.

Syndicate content