How to change the default text editor in terminal

As almost everything in Linux there are always divided opinions, the terminal text editors are no exception. There are those who prefer vi, vim, others mcedit and others (a bit most I think) who prefer dwarf.

Has it happened to you that an application (when you install it or etc) opens a text file for you to edit, and it is opened with a text editor that is NOT your favorite?

For example, users who like vim open that file with nano ... this obviously does not show a smile on their face 😀

In order for the system to always use the text editor in terminal that you want, you must add the following in your .bashrc:

export EDITOR="vim"

To add it to the .bashrc it would be:

echo "export EDITOR=vim" >> $HOME/.bashrc

And voila, matter solved.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   peterczech said

    Nano is nano .. For me the best editor there is 😀

    1.    x11tete11x said

      nano is for those who don't know how to use vim ……

      among which I include myself xD hahahahaha

      1.    Katekyo said

        The problem of using vim / vi / gvim (windows) is the cumbersome combination of keys and being able to place the plugins to make it more powerful haha ​​but in my case I use gvim for windows since I know some combinations and I also think that it is the most powerful editor robust in my opinion

    2.    Wada said

      Hahahaha just like you
      Emacs http://emacsrocks.com
      And I did this a while ago in the vim forum
      http://foro.desdelinux.net/viewtopic.php?id=3219
      Believe me when you learn to use any of these you are going to say How could I live using nano? hahahaha 😀 Greetings

    3.    Jorge Varela said

      Okay, nano is nano, and it is an excellent editor for my taste, however, for those of us who are Operating System Administrators it is almost an obligation to learn the use of vi, since it is the editor that you will find in any version of UNIX or GNU / Linux distribution.

  2.   yerkorn said

    The tutorial is very good and also useful, it is appreciated 😀

  3.   kakahuete said

    It would also be nice to change the symlink of the `editor` command to make the change more global. Or else, at least, do the same with the root user.

  4.   ivanbarram said

    Well, in my particular case the first one I met was vim and I must confess that I broke several keyboards because I did not know the key combinations well, but now it is the default editor, in fact nano seems cumbersome, at least for me. Even in the distributions that bring nano by default, I change it to vim.

    Greetings.

  5.   eliotime3000 said

    Excellent. Now if I will use emacs in the console.

  6.   lecovi said

    In Debian and derivatives you can also do:
    # update-alternatives --config editor

    And there you throw the possibilities and you choose 😉

    Very good!
    Regards!

  7.   ever said

    I don't know why but since I started Linux (back in 2002) I always chose mcedit and that's where I stayed. It is integrated with mc (obviously), it has a simple interface using the function keys (which in vi seem to be decorative), syntax highlighting for almost everything, colors that for me help visualization (the black background does not convince me to nothing) among other things. There I stayed, and I'm happy.
    regards

  8.   Yeretic said

    sudo update-alternatives --config editor