How do I replace vi
by vim
so that when I type vi
in terminal vim
is opened?
3 Answers
'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
-
Can I use update-alternatives for other applications, what does update-alternatives do, does it installs extra features ?– SearockOct 12, 2010 at 17:52
-
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.– MartinOct 12, 2010 at 18:36 -
This should be marked as the correct answer, instead of the workaround that was accepted! Dec 24, 2015 at 14:29
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
.
-
Sorry for another silly question, but where is
.bashrc
located ? I am quite new to Ubuntu.– SearockOct 12, 2010 at 17:46 -
-
3Actually, '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).– JanCOct 13, 2010 at 6:31
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
-
2The symlink is a bad suggestion: use update-alternatives to manage this in Ubuntu.– Roger PateOct 13, 2010 at 17:45
-
1yes I agree do it the correct way. I didn't know that vim was using the alternatives system. Oct 13, 2010 at 17:52