1

I can't use vi, well, I can, but I would much prefer vim, however I need to share a computer with someone who hates vim and can only use vi...

After installing vim I find that if I use the vi command it just opens vim, so is there any way to have them both installed at the same time but have it so that both can be used and they stay separate?

The machine will have Ubuntu GNOME 15.10 with GNOME 3.18 running on it.

Clarification: As this seems to have confused some I will state it more clearly here, I wish for vi to point to /usr/bin/vim.tiny and for vim to point to /usr/bin/vim.basic.

3 Answers3

3

As user1326419 notes, vi is part of the Debian alternatives system. To change what vi runs, do:

$ sudo update-alternatives --config vi
There are 3 choices for the alternative vi (providing /usr/bin/vi).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/vim.gnome   60        auto mode
  1            /usr/bin/vim.basic   30        manual mode
  2            /usr/bin/vim.gnome   60        manual mode
  3            /usr/bin/vim.tiny    10        manual mode

Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/vi (vi) in manual mode

Then:

$ vi --version| head -5
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  2 2014 19:39:02)
Included patches: 1-52
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Small version without GUI.  Features included (+) or not (-):
$ vim --version| head -5     
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  2 2014 19:39:47)
Included patches: 1-52
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):

vim.tiny is the minimal version you get when you first install Ubuntu.

muru
  • 207,228
2

It's been already explained what is the difference between vim and vim.tiny, and your friend will somewhat have to break his beliefs and get up to speed with the times, because what he or she really wants is vim.tiny

Like I've mentioned in the comments, ask your friend to make an alias for him/her self in .bashrc

alias vi = vim.tiny

That way he or she can use the minimalistic version of vi while you can continue using vim.

Additional small setup that you may need is to $ cp /etc/vim/vimrc.tiny ~/.vimrc

In case they want the "real vi" you can sudo apt-get install nvi and alias vi to nvi. nvi is the closest to the original.

1

This was answered by @muru in this question (Why does vi start vim but typing vim says vim needs to be installed?)

The vi command itself is actually a symbolic link, and points to whichever preferred version is installed through the Debian alternatives system.

--- Edit to include my comment below and answer the question ---

Change the sym link in /etc/alternatives for vi to point to your installation of vi. The sym link for vim should point at your installtion of vim