Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can't make less use my favorite editor. To my horror, it starts ed which I've never used and really am not going to.

> echo $EDITOR 
> less somefile

Pressing v starts usr/bin/editor +7 somefile. I've never seen less ignoring $EDITOR, so it may be an Ubuntu issue.

share|improve this question
up vote 3 down vote accepted

Try adding "export EDITOR". The behaviour of unexported shell variables is really confusing, but I can reproduce this problem myself.

If that still doesn't work, "sudo update-alternatives –config editor" will let you configure /usr/bin/editor

share|improve this answer
My bad... I always use things like export EDITOR=emacsclient; export VISUAL="$EDITOR"; export LESSEDIT="$EDITOR '%f'" and this time I copied it from somebody else... – maaartinus Feb 15 '12 at 20:37

less pays attention to three environment variables to determine what editor to invoke for the v command: $VISUAL, $EDITOR, and $LESSEDIT. man less and search for LESSEDIT for details.

Normally it probably makes sense to set $EDITOR to your favorite editor and leave $VISUAL and $LESSEDIT undefined. (The distinction between $EDITOR and $VISUAL is probably not useful these days; it used to be a way to distinguish between a full-screen editor like vi and a line-oriented editor like ed.)

And as pjc50 says, be sure the $EDITOR variable is exported.

share|improve this answer

Your Answer


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.