0

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)? – user364819 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
  • 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
  • 1
    @ParanoidPanda vim-tiny is. – muru Mar 30 '16 at 20:33
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.

| improve this answer | |
  • 2
    Hmm, no, ex-vi is the closest, since it is a port. nvi is a clone. – muru Mar 30 '16 at 20:50
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.

| improve this answer | |
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

| improve this answer | |
  • 3
    I don't need to know why, I need to know how to make it work differently. – user364819 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy