Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In my college our Admin has replaced vi by vim.

So how do I replace vi by vim so that, when I type vi in terminal, then vim should get opened.

I know doing so is silly, but I am asking it just out of curiosity.

Thanks.

share|improve this question

3 Answers 3

up vote 5 down vote accepted

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.

(I btw think it's not silly. It saves typing ;) )

share|improve this answer
    
Sorry for another silly question, but where is .bashrc located ? I am quite new to Ubuntu. –  Searock Oct 12 '10 at 17:46
    
In your home directory. Just type vim ~/.bashrc –  Peter Smit Oct 12 '10 at 17:47
    
+1 Thanks a lot : ) –  Searock Oct 12 '10 at 17:48
3  
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). –  JanC Oct 13 '10 at 6:31

'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
share|improve this answer
    
Can I use update-alternatives for other applications, what does update-alternatives do, does it installs extra features ? –  Searock Oct 12 '10 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. –  Martin Oct 12 '10 at 18:36
    
@Martin Thanks. –  Searock Oct 13 '10 at 4:44

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|improve this answer
    
+1 Thanks a lot : ) –  Searock Oct 12 '10 at 17:54
2  
The symlink is a bad suggestion: use update-alternatives to manage this in Ubuntu. –  Roger Pate Oct 13 '10 at 17:45
1  
yes I agree do it the correct way. I didn't know that vim was using the alternatives system. –  3dinfluence Oct 13 '10 at 17:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.