Replacing vi by vim

14,867

Solution 1

You can add

alias vi=vim

to ~/.bashrc . This will start vim whenever you type vi.

Note that in Ubuntu 10.10 (and I think also 10.04) vi is already mapped to vim.

Solution 2

'vi' in Ubuntu already starts 'vim', although by default it starts 'vim-tiny' (which comes closest to the original 'vi' in its (lack of) features). You can see this with:

sudo update-alternatives --display vi

If you want it to use another version of vim, then make sure it's installed and run:

sudo update-alternatives --config vi

Solution 3

In addition to what Peter Smit has suggested. You can do the following as well to make that change system wide rather than just your account.

add alias vi='vim' to /etc/bash.bashrc

or create a symlink to vim

sudo ln -s /usr/bin/vim /usr/bin/vi

However on my system both /usr/bin/vim and /usr/bin/vi are symlinks to /etc/alternatives/vim

Share:
14,867
Searock
Author by

Searock

Updated on September 17, 2022

Comments

  • Searock
    Searock over 1 year

    How do I replace vi by vim so that when I type vi in terminal vim is opened?

  • Searock
    Searock over 13 years
    Sorry for another silly question, but where is .bashrc located ? I am quite new to Ubuntu.
  • Peter Smit
    Peter Smit over 13 years
    In your home directory. Just type vim ~/.bashrc
  • Searock
    Searock over 13 years
    Can I use update-alternatives for other applications, what does update-alternatives do, does it installs extra features ?
  • RiverWay
    RiverWay over 13 years
    Yes you can. It updates alternatives. No, it doesn't. If you want to know more use man update-alternatives or start a new question.
  • JanC
    JanC over 13 years
    Actually, 'vi' has pointed to some variation of 'vim' since almost forever in Ubuntu (see my answer about alternatives to know how to change which variation).
  • Karoly Horvath
    Karoly Horvath over 13 years
    The symlink is a bad suggestion: use update-alternatives to manage this in Ubuntu.
  • OmarOthman
    OmarOthman over 8 years
    This should be marked as the correct answer, instead of the workaround that was accepted!