≡ Menu

Change default Linux / UNIX text editor from VI to Pico

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

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 16 comments… add one }
  • soraver May 6, 2008, 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)

    • Ray March 3, 2013, 5:23 pm

      Nice tips :)

  • Dan July 6, 2008, 6:58 pm

    Thanks for the handy reference!

  • John August 6, 2008, 8:48 am

    Thanks for the help. Very useful and concise explanation.

  • Stan July 8, 2011, 7:52 pm

    “alias vi=/usr/bin/pico”

    Blasphemy!!

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

  • Slobo January 26, 2012, 8:57 pm

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

  • FOppe February 29, 2012, 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.

  • Jose June 17, 2012, 10:32 pm

    Thanks a thousand times!

    I hate vim too !!!

  • test June 26, 2012, 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.

  • test June 26, 2012, 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

  • adeel September 26, 2012, 7:15 am

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

  • al1reza February 27, 2013, 7:54 pm

    just vim I love vim

  • Jarod Chiang April 8, 2013, 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.

  • Whyvi July 2, 2013, 5:53 pm

    Why set an alias of vi as pico.

    That is pure evil.

  • Anonymouse September 4, 2013, 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.

  • Tanker March 1, 2015, 10:00 pm

    Thanks guys! :D
    Keep on linuxin in the free world – Neil Young.

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , , , , , ,