Change the default UNIX editor

Jun 17, '05 09:39:00AM

Contributed by: Trunkmonkey

Although this is a UNIX hint, it applies to Mac OS X as well. A previous hint, Remove insecure root 'grace period' from sudo, had a comment about not knowing vi, and that any editor could be used since visudo is just a wrapper that does some sanity checking before writing to disk. To stay on the safe side, it's best to change the default command line editor with the $EDITOR variable. An added benefit is that any command line tools that take advantage of the $EDITOR variable will also use your editor of choice.

The $EDITOR variable can be set from the command line by executing export EDITOR=youreditor for the bash shell, or setenv EDITOR youreditor for the tcsh shell.

To make the variable persistent, add the export statement to your .bashrc or .bash_profile, or the setenv statement to your .cshrc or .tcshrc file.

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050601124919803