Changing the Default Text Editor in Linux

By default, CentOS / RHEL 5.x ships with VIM as the default text editor. However if you prefer a different text editor you can easily modify the default text editor by changing the VISUAL environment variable.

Locate Favorite Text Editor:

[root@protious src]# whereis nano
nano: /usr/bin/nano /usr/share/nano /usr/share/man/man1/nano.1.gz

Set the VISUAL environment:

export VISUAL=”/usr/bin/nano -w”

In this example, exporting the VISUAL environment variable will change the default editor to nano (with -w) for the remainder of your session. Once you log out the default editor, vim, will be back.

To make the change permanent, you need to modify one of the two following files:

/etc/profile (for all users)
~/.bash_profile (for only your user)

1 Comment

  1. Dan says:

    Thanks, you put an end to my vi frustration :)

Post a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Blog is powered by WordPress and designed by Chico Web Design