I decided to finally learn vi and as I was doing that I realized that vi wasn't behaving as I expected. I learned from another post that this was because, on Ubuntu, vim-tiny is installed by default.
After I learned that I chose to install the full version of vim using the following command:
sudo apt-get install vim
After I did that I became curious about a number of things:
- I noticed that vi and vim commands are now associated with the full version of vim and not vim-tiny. How does this happen? (i.e. How does the name look-up work?)
- How do I explicitly execute either vim-tiny or full vim?
- How does Linux/Ubuntu/apt manage libraries and executables with name clashes? How about different versions?
I'm working on Ubuntu Server 12.04 LTS.
Best Answer
On Debian-derivatives, it's handled through the alternatives system:
The package post install script (the thing that runs when dpkg says "configuring package X") told the alternative system about a new alternative for vim. The new alternative had a higher priority, so it was picked.
You can run them directly as
vim.tiny
,vim.full
,vim.gnome
, etc.You can override the default using the
update-alternatives
command.(Actually, I think vim.tiny works somewhat as a special case, as its not really intended to be used except when space is at a huge premium. At least, it doesn't show as an alternative here.)