Available OSX text editors

From Center for Cognitive Neuroscience
Jump to navigation Jump to search

Why You Shouldn't Use TextEdit

TextEdit is a nifty, convenient little program. However, by default it is not configured to work well with text files on a shell level. Since much of what researchers do require edited files to be readable by UNIX command line utilities, TextEdit can introduce unexpected and hard to track down errors.

Free, Built-In, Command Line Text Editors

This is a short list of text editors that come free with OSX:

Nano.
To start nano from the terminal, simply:
:$ nano <filename>
Where <filename> is the actual name of the file you wish to edit or create. Nano has all the command keys displayed at the bottom of the screen making it a good :editor for the beginner Shell user.
Emacs.
Emacs has a long history in UNIX environments. Basic usage is easy to learn requiring about 10m to work through the first part of the built-in tutorial. If you start emacs with no <filename> argument, you'll be presented with a few basic commands including how to start the built-in tutorial
:$ emacs
To just jump in and start editing files simply type:
:$ emacs <filename>
Where <filename> is the actual name of the file you wish to edit or create.
Vim.
Vim is probably the greatest editor ever bestowed by the Gods upon human kind. However, it's awe inspiring power requires a higher learning curve then other editors, though not much. Vim uses modal editing in which there are two "modes": the first is for inserting text, the other is for performing editing of text, moving around the file quickly, etc. To begin learning the basics for vim:
:$ vimtutor
The tutorial will probably take a new user about 20-30m.
TextWrangler.
TextWrangler is a Macintosh application that does very high-powered plain text editing. It is free, fast, and easy to use. It is much more appropriate for editing unix scripts, code, batch files, etc... than word processors such as MS-Word or TextEdit, because it works on unformatted text. TextWrangler also does an excellent job of opening many files on your computer that otherwise can't be read in an obvious way. For example, files that end in '.plist' don't open in Word. Some other interesting features of TextWrangler are its ability to open "hidden" files or files that are in the hidden directories, such as /usr/local, and its ability to edit files using ftp.
If you have installed TextWrangler, but are in a terminal window, you can open it from the command line. For example, to edit the file, foobar.txt, you would type:
:$ open -a TextWrangler foobar.txt
Mark much prefers TextWrangler to the others (though I sometimes use vi).
Summary
For the beginning user who just wants to edit a file real quick and move on, Nano is probably the best option. For an intermediate user who doesn't want to spend time learning a new way of doing things but would like more power features Emacs fits best. If you want to rule the world and don't care what it takes to do so, go with Vim.
Disclaimer: All vim proselytizing done in jest. Emacs is an excellent and powerful editor in its own right 
and usually easier for folks to learn.