Unable to change the default editor in terminal

后端 未结 9 1615
南笙
南笙 2020-12-09 07:55

My default editor is pico at my server. I use Bash and Linux.

I tried to change Vim to be my default editor unsuccessfully by

echo vim > $EDITOR
         


        
相关标签:
9条回答
  • 2020-12-09 08:20

    if you want vi to be your default history editor (which is why I'm here)

    edit ~/.bashrc and add

    set -o vi

    anywhere in the file. Then all the lovely vi command history is available (esc k etc).

    Sorry if this is slightly off topic, but my search landed me here....

    0 讨论(0)
  • 2020-12-09 08:22

    I don't have an EDITOR environmental variable. Perhaps you could specify your distribution? My bashrc does define this:

    alias vi='vim'
    

    and supposedly if vim can't find a file called .vimrc in your home directory it runs in "compatibility mode" and you only get vi features until you say type :nocp

    If it is based on your EDITOR environmental variable you would set it like this in BASH:

    export EDITOR='vim'
    
    0 讨论(0)
  • 2020-12-09 08:22

    I needed to install Vim manually in a virtual environment. The only command that worked for me was:

    `sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 100
    

    Source

    0 讨论(0)
提交回复
热议问题