Replacing vi by vim
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
Searock
Updated on September 17, 2022Comments
-
Searock over 1 year
How do I replace
vi
byvim
so that when I typevi
in terminalvim
is opened? -
Searock over 13 yearsSorry for another silly question, but where is
.bashrc
located ? I am quite new to Ubuntu. -
Peter Smit over 13 yearsIn your home directory. Just type
vim ~/.bashrc
-
Searock over 13 yearsCan I use update-alternatives for other applications, what does update-alternatives do, does it installs extra features ?
-
RiverWay over 13 yearsYes 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 over 13 yearsActually, '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 over 13 yearsThe symlink is a bad suggestion: use update-alternatives to manage this in Ubuntu.
-
OmarOthman over 8 yearsThis should be marked as the correct answer, instead of the workaround that was accepted!