Replace the Default Text Editor

In FreeBSD 'vi' is the default text editor. But the choice of a default text editor is customizable as everything else in the free software world.

I don't like 'vi', the default text editor in FreeBSD. I don't know why, I just don't like it. So why not replace 'vi' with my preferred choice of a text editor, 'nano'?

The default text editor is configured with the environment variable 'EDITOR'. You can export it from a command line:

$ export EDITOR=nano

You can choose your favorite text editor the same way.

The thing is, the 'EDITOR' variable is only exported for this session only. After a reboot the default text editor is reset back to 'vi'.

To change it permanently you will need to edit the profile. To change it for your user only, the profile is stored in '~/.profile'. Globally the profile is stored in '/etc/profile'.

Open the profile file in a text editor and add these two lines:

EDITOR=nano
export EDITOR

Re-open the terminal or shell to let the changes take effect.