I use tools like Perforce and Subversion on a daily basis. I'm a Mac user at heart, and I hate tools like
emacs. However, Perforce and Subversion both use external editors like
emacs to allow the user to change things, namely checkin comments.
Well, BareBones Software has a pretty decent little text editor called "Text Wrangler" that comes with a command-line utility
edit to make it easy to use TextWrangler from the command line (they also make BBEdit, TextWrangler's commercial big cousin). Invoking
"bbedit" when working with BBEdit) all by itself launches TextWrangler. Specify a file name and TextWrangler opens that file, allowing you to edit it with a proper Macintosh user experience.
edit can do much more, including this: if you invoke
edit -w <file>, it will open that file in TextWrangler, and block until you close the window! (I've tried this before using Apple's
open -a command, but it immediately returns, making it useless.) This means you can use
edit -w in the external editor configurations in Perforce and Subversion. And, if you add
--resume to it, it will return to the Terminal.app after you're done editing. This may not seem like much, but it's more than any other non-CLI Macintosh text editor has been able to do.
Note: Chris Cotton tells me that TextMate also supports this usage.
Basic configuration for most UNIX tools is to set the
$EDITOR environment variables (like this in
EDITOR=edit -w --resume
Read on for alternative information on how configure these tools.
To configure an external editor for Perforce, you can also set the
$P4EDITOR environment variable.
To configure the external editor for Subversion, modify your
~/.subversion/config file to include this line:
editor-cmd = edit -w --resume
See the Subversion Book for more information on setting external editors.