Share this Page URL

Chapter 17. Text Editing on Mac OS X > Text Encodings - Pg. 460

Choosing a Default Editor Emacs and vi are the two heavyweights of the Unix text editor world, but there are plenty of others to choose from. Two lesser favorites inlcude pico (part of the standard Mac OS X distribution) and joe (obtainable through Fink or the GNU Mac OS X project; see Chapter 17), both of which have fans due to their online help systems, which include ever present key-combination guides. Since all text editors are really different paths to the same destination, most people learn one editor and then tend to use it for everything (at least when working within the Terminal). Because of this, you can set two Darwin environment variables, VISUAL and EDITOR , to the name of your preferred editor. (Specifically, to the command that launches it; so, set its name, along with any command-line arguments you might use.) These let programs know which editor you'd like to use, if the program needs to launch a text editor. (Otherwise, the program gets to choose.) So, if you're using the Z shell (zsh) and prefer to use Emacs as your Terminal text editor, add these lines to my ~/.zshrc file: export VISUAL=emacs export EDITOR=emacs See Chapter 21 for more about environment variables and shell configuration files. Why two different variables for the same value? It's because of what we