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.

  • Install one through Software Center or Terminal, and the other compile from source.

    You can even install both packages and have the binaries links point to the correct binary.

    – LnxSlck Mar 30 '16 at 19:42
  • @LnxSlck: Is there any way of doing it if both are installed through Terminal (not from source)? –  Mar 30 '16 at 19:52
  • 3
    vi doesn't exist anymore, default is vim. tiny if that's what your friend wants. That exists, that never disappears if you install vim. There's also nvi which is the closest to original vi – Sergiy Kolodyazhnyy Mar 30 '16 at 19:56
  • @Serg: Is there any way to have them both installed under different users or something and then have it so that vi accesses vi under the user who has it, and then vim accesses vim under the user who has it? Or a similar system of sorts? –  Mar 30 '16 at 20:00
  • I don't mind if it's crazy and elaborate, just as long as it works... :D –  Mar 30 '16 at 20:01
  • 2
    The original vi is not available easily on Ubuntu. Can you clarify with the idiot what exactly they want from vi? What system is the idiot using where they can access vi? – muru Mar 30 '16 at 20:13
  • If your someone that you are sharing a computer with prefers vi to vim, I hardly imagine that they will be OK with using GNOME. – user530873 Mar 30 '16 at 20:22
  • @ParanoidPanda you can have aliases for each user in .bashrc . For example, for your friend you can make alias vi = vim.tiny – Sergiy Kolodyazhnyy Mar 30 '16 at 20:23
  • @Serg: That would be a nice thing. –  Mar 30 '16 at 20:32
  • @muru: vi is installed by default on Ubuntu, is it not? –  Mar 30 '16 at 20:32
  • 1
    @ParanoidPanda vim-tiny is. – muru Mar 30 '16 at 20:33
  • ParanoidPanda , I already told you but you probably didn't see : vi , the real vi does not exist anymore. It's gone a long with the days of old Unix systems. By default Ubuntu uses vim.tiny , the trimmed down version of vim. This is what muru is referent to – Sergiy Kolodyazhnyy Mar 30 '16 at 20:37
  • @muru: Well, my friend is pretty sure that he is using the original... –  Mar 30 '16 at 20:38
  • @Serg: Ok, well my friend must be confused then... Anyhow, I want vim, and he probably wants that vim.tiny thing... –  Mar 30 '16 at 20:39
  • @ParanoidPanda Unless someone compiled and installed it, he's not using the original vi on Ubuntu. He might be using Arch Linux, which uses this port: http://ex-vi.sourceforge.net/ – muru Mar 30 '16 at 20:40
  • Given the edit, I fail to see what more my answer needs. – muru Mar 31 '16 at 11:11

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
  • 197,895
  • 55
  • 485
  • 740
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.

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
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

  • 3
    I don't need to know why, I need to know how to make it work differently. –  Mar 30 '16 at 19:54
  • 1
    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 – user6031769 Mar 30 '16 at 20:04