The file
/.cshrc is only used in single-user mode (when “
/” is the home directory). During normal operation, when you log in as the root user (which is strongly discouraged!),
/root is the home directory, so you should make that change to
/root/.cshrc. However, it is better not to log in as root. You can, for example, use
su -m
to change to root privileges while logged in as normal user. In that case, your normal user environment stays the same, including the setting of
EDITOR
that you have as normal user.
Please note that
Phishfry made a small mistake in his advice above.
csh(1) has a different syntax for setting environment variables than most other shells. So, instead of writing
EDITOR=/usr/local/bin/nano
(sh syntax) you need to write
setenv EDITOR /usr/local/bin/nano
(csh syntax).
Another point to keep in mind: For historical reasons, there are two different environment variables to specify the editor:
EDITOR
and
VISUAL
. The first is intended to be used for line editors such as
ed(1) and
ex(1), and the latter for full-screen editors such as
vi(1) and
ee(1). Applications don't use these variables consistently, so it's better to always set
both to the same value. So in your case, you need these lines for csh:
setenv EDITOR /usr/local/bin/nano
setenv VISUAL /usr/local/bin/nano