In this article I will show you how to set the default text editor in the csh and tcsh shells.
The default shell in FreeBSD and PCBSD is the C shell (csh), so this article is usefull for the *BSD users.
How to set the default text editor in csh and tcsh:
I will temporary set nano as the default text editor with:
$ setenv VISUAL /usr/local/bin/nano
$ setenv EDITOR /usr/local/bin/nano
The VISUAL and the EDITOR variables are for setting the default text editor. Set the same value to the both EDITOR and VISUAL environment variables, in order not to have issues with some programs that use the text editor.
How to set the default editor permanently:
To set nano as the default text editor permanently, for csh and tcsh do this:
$ echo "setenv VISUAL /usr/local/bin/nano" >> ~/.cshrc
$ echo "setenv EDITOR /usr/local/bin/nano" >> ~/.cshrc
For tcsh: If the ~/.tcshrc file exists, this file will be used instead of the ~/.cshrc .
Related reading: How to set the default text editor in bash, ksh and zsh.