Change default editor in FreeBSD and FreeNAS for root and ordinary user

Do you feel that you get the wrong editor when you type ‘crontab -e’ or have the wrong default editor in general in FreeBSD and/or FreeNAS? Here is how to change the default editor.

Change default editor in FreeBSD and FreeNAS

To change the default editor for an ordinary user, login as that user and type:

nano ~/.profile

and change the row with ‘EDITOR’ in it to:

EDITOR=/usr/local/bin/nano; export EDITOR

To change the default editor for root, login as root and type:

nano ~/.cshrc

and change the row with ‘setenv EDITOR’ in it to:

setenv EDITOR /usr/local/bin/nano

That’s it! The next time you reboot/login as that user the default editor is changed.