Editors for OS X
From OS X Scientific Computing
What comes with OS X
Standard unix editors
vim (an augmented vi) and emacs, the two "standard" unix editors, are present on OS X by default. It is prudent to know how to perform basic editing functions in at least one of these, since these are pretty much ubiquitous on any unix platform.
nano (a clone of pico), an editor made popular with users of the pine email program, is also available by default.
I wrote a vim wrapper script that permits easy editing of files requiring administrator privaleges, as well as binary plist files.
TextEdit: A basic GUI editor
OS X also comes with a basic GUI text editor, called "TextEdit.app".
You can invoke it from the command line to open a file foo.txt as follows:
open -e foo.txt
Be sure to set the preferences to treat new files as "plain text" (not rtf) and be sure to use only unix line endings.
In general, this is a very basic editor, but with few useful features. You are better off with one of the other options described below.
Free third-party editors
Standard unix and X11 editors
Since OS X doesn't run X11 by default, it probably won't come as a surprise that vim and emacs GUI versions are not available.
To get gvim and xemacs, you are probably best off installing these (and their dependencies) with Fink or DarwinPorts. However, standalone versions are also available.
There is an aquafied GUI emacs called aqaumacs that I imagine emacs fans will really like.
The Fink project lists a large number of editors that you can install.
Some GUI editors
Sometimes you would like to stare at a document, or a whole family of documents, complete with syntax highlighting, and so forth. For this, a native OS X GUI editor is very nice to have, and the unix integration with OS X generally is an advantage, as you get the best of both worlds. Although I rely heavily on vim, I like to have other options. Here are some, with my personal opinions (yours may well differ, so try all the options).
I think the best free editor on OS X is Smultron. It seems to improve almost daily. It is open-source, as well as being cost-free. It has a large number of useful features, including tabs and syntax highlighting. It gets great ratings on VersionTracker. Here is a screenshot:
It comes with a command-line utility that you can install, /usr/bin/smultron, which you will probably want to alias to something easier to type (unless you are Swedish and associate text editing with eating strawberries).
I think this editor is ugly but functional, and is a Cocoa OS X application, which means it behaves in ways that are standards-compliant with OS X and can make use of a lot of built-in system functionality.
Another free option is TextWrangler.app. It is essentially a free version of BBEdit.
It, like BBEdit, is written in Carbon and has a truly ugly, counter-intuitive interface, but has quite a bit of functional utility.
I mentioned AquaMacs already, but it also belongs in this category. If I liked emacs, I probably would use this extensively.
Editors you can purchase
The idea of purchasing a text editor is rather foreign to unix users. The above gives at least an overview of the many free options available. I surprised myself a few months ago when I actually paid money for a text editor. I'm even more surprised to say that it was worth it.
I bought a copy of Textmate.app and I'm not sorry. It is absolutely superb, both in terms of functionality and aesthetics. Here's one of my own screenshots:
TextMate is extendable by the user, offering the ability to create or modify various commands and other features. For example, I created a zsh bundle myself (building on the supplied bash bundle) and have made some other bundles and TextMate - iTerm interaction scripts.
The VerstionTracker reviews are quite favorable. Price: €39 (about US$ 50).
BBEdit is similar to TextWrangler, but with more features and a rather large pricetag. It has a clunky Carbon interface and despite having trade-marked the expression "It doesn't suck", it does. I do not recommend this. Get TextMate if you need to buy an Editor. It is about 1/3 the price and you get much more.
SubEthaEdit.app used to be free and claimed it would be open-source, then it used to be free to non-commercial users, then it was free to non-commercial users but had a watermarked nag built into the binary, then it stopped being free (although you might still be able to get a ppc old version from their website for free). It has a nice, clean, simple, aesthetic interface, but it comes with an attitude problem. Unless you need to do collaborative editing, this isn't worth paying for. Get TextMate if you need to buy an Editor. It costs slightly more, but you get a lot more for your money.