Change default Linux / UNIX text editor from VI to Pico

by on August 30, 2007 · 15 comments· LAST UPDATED August 30, 2007

in , ,

Q. I find vi hard to use. How do I change my default text editor from vim / vi to Pico under Debian Linux?

A. To use and change an editor to edit your text message, set the variable EDITOR to the pathname of the vi / vim binary file. You need to use export or set command for the same purpose.

Many Linux / UNIX command read shell EDITOR environment variable to determine which editor to use for editing a text file.

Set default text editor to pico

Type the command as follows:
$ which pico
Output:

/usr/bin/pico

Now setup a new text editor:
export EDITOR=/usr/bin/pico
OR
export EDITOR=pico

Add above line to ~/.bashrc file:
$ vi ~/.bashrc
Append text as follows:
export EDITOR=pico
Close and save the file. There is no no need to reboot system.

Also you can add alias if you want:
alias vi=/usr/bin/pico

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 15 comments… read them below or add one }

1 soraver May 6, 2008 at 12:38 pm

just a small suggestion:
alias pico=’nano -w’

thats because not every distro has pico symlinked to nano (nano is the open source pico) and because nano by default wraps long lines (-w).

also someone might be interested in seting TERM to linux
export TERM=linux
so he can use home/end/delete and numpad correctly in nano and also in shell

hope im not too much offtopic (a)

Reply

2 Ray March 3, 2013 at 5:23 pm

Nice tips :)

Reply

3 Dan July 6, 2008 at 6:58 pm

Thanks for the handy reference!

Reply

4 John August 6, 2008 at 8:48 am

Thanks for the help. Very useful and concise explanation.

Reply

5 Stan July 8, 2011 at 7:52 pm

“alias vi=/usr/bin/pico”

Blasphemy!!

But thanks… I needed the editor variable info :).

Reply

6 Slobo January 26, 2012 at 8:57 pm

Thanks a hundred thousand times! I hate vim !!!

Reply

7 FOppe February 29, 2012 at 11:18 pm

export EDITOR=$(which nano)
in /home/$USER/.profile
.profile is the last of the shell initialisation files to be loaded. The $(which nano) – or whatever editor of your taste- is a bash trick. everything in $(…) will be evaluated, so `which nano` will be evaluated to /usr/bin/nano or herever it’s located.

Reply

8 Jose June 17, 2012 at 10:32 pm

Thanks a thousand times!

I hate vim too !!!

Reply

9 test June 26, 2012 at 4:19 pm

Need to change the default editor (that opens files) from EMACS to VIM.

The $EDITOR env variable doesn’t help (this is already vi). If anyone knows, can they help?

Thanks.

Reply

10 test June 26, 2012 at 4:21 pm

Need to change the default editor (that opens files) from EMACS to VIM.

The $EDITOR env variable doesn’t help (this is already vi). If anyone knows, can they help?

Thanks.

Update: Solved. No need for follow-up

Reply

11 adeel September 26, 2012 at 7:15 am

I used same procedure to set default editor = kate but its not working. can anybody tell?

Reply

12 al1reza February 27, 2013 at 7:54 pm

just vim I love vim

Reply

13 Jarod Chiang April 8, 2013 at 8:21 am

for Ubuntu user:
sudo update-alternatives –config editor
# Type the number which corresponds to Vim here (after installing it) then press Enter.

Reply

14 Whyvi July 2, 2013 at 5:53 pm

Why set an alias of vi as pico.

That is pure evil.

Reply

15 Anonymouse September 4, 2013 at 4:19 pm

Because VI is not an editor as people commonly refer to, it’s a manipulator. Nano is a powerful yet simple editor.

Reply

Leave a Comment

Tagged as: , , , , , , , , , ,

Previous Faq:

Next Faq: