Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I generally set both VISUAL and EDITOR environment variables to the same thing, but what's the difference? Why would I set them differently? When developing apps, why should I choose to look at VISUAL before EDITOR or vice versa?

share|improve this question

1 Answer 1

up vote 40 down vote accepted

The EDITOR editor should be able to work without use of "advanced" terminal functionality (like old ed or ex mode of vi). It was used on teletype terminals.

A VISUAL editor could be a full screen editor as vi or emacs.

E.g. if you invoke an editor through bash (using C-x C-e), bash will try first VISUAL editor and then, if VISUAL fails (because terminal does not support a full-screen editor), it tries EDITOR.

Nowadays, you can leave EDITOR unset or set it to vi -e.

share|improve this answer
5  
Most applications treat $VISUAL as a shell snippet that they append the (shell-quoted) file name to, but some treat it as the name of an executable which they may or may not search in $PATH. So it's best to set VISUAL (and EDITOR) to the full path to an executable (which could be a wrapper script if you want e.g. options). –  Gilles Dec 15 '10 at 18:27
    
In modern times, ed and similar are not very popular so I believe it is OK to just ignore VISUAL and use EDITOR. –  Pavel Šimerda Mar 30 at 17:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.