University Systems --> WAM --> All WAM Pages --> General information on Unix editors -->

General information on Unix editors

There is no one single source of information on the various Unix text editors. It depends upon which editor you invoke. We have three different full-screen editors on the system we support: vi, emacs and pico. How did you invoke the editor? Did you call it by name or was it invoked automatically by another process? You can check to see if you have an environment variable set for a particular editor by typing:

    printenv | grep VISUAL   and
    printenv | grep EDITOR

If you see something like:

    VISUAL=/usr/local/bin/emacs  or
    EDITOR=/usr/local/bin/emacs

then that's the editor which is called by default, if an application calls an editor. If you don't get any response, then you have no default editor chosen, and applications will call vi by default.

If you wish to customize what editor you get by default when running certain applications (posting news, using ~v in mail, etc.), you can do so with the commands:

    setenv VISUAL (editor path)     and
    setenv EDITOR (editor path)

To find out where your favorite editor lives, type:

which editor

For example:

    % which pico
    /usr/local/bin/pico
    % setenv VISUAL /usr/local/bin/pico
    % setenv EDITOR /usr/local/bin/pico
    %

If you place the two 'setenv' commands in your .login file (or in your .environment file on WAM or Glue) they'll be executed automatically whenever you log in.

To be even slicker about dealing with this, an alternate method will work better if you move your ~/.login (or .environment) file between systems. You can combine the 'which' command and the 'setenv' command to make things more robust with:

    % setenv VISUAL `which pico`
    % setenv EDITOR `which pico`

Anything between back-quotes will be evaluated before being inserted into the current command, so the above commands will be equivalent to the earlier examples.

As for documentation, we have handouts on Using The emacs Text Editor,   Using The pico Text Editor and Using The vi Text Editor in the Information Technology Library, room 1400 Computer and Space Sciences Monday through Friday, 8:00 a.m. through 6:00 p.m. The 'pico' editor is designed with all the documentation online in the package; you can invoke help by typing Ctrl-g.

How do I:
How are we doing? Comments on this page?
Office of Information Technology
Office of Information Technology Help Desk Web Site University of Maryland Web Site Office of Information Technology Web Site