TextMate is a popular text editor for Mac OS X. It is developed by MacroMates? http://macromates.com/. It comes with code markup for most programming languages, and a built in integration with subversion and X-Code's compilers, and it looks sexy. It is highly extensible with macros and "snippets" which are like shell expansions.
TextMate is kind of like Emacs and OS X had a baby.
TextMate is open source (but you are still required to pay for a license)
It is released under the GPLv3 (but patches must be PublicDomain so the author and his friends can use them in ClosedSource projects)
http://arstechnica.com/apple/2012/08/textmate-2-0-goes-open-source-in-response-to-os-x-restrictions/