1

Is it different to standard Vi/Vim, if so how and why? Is it Vi or Vim?

It does show a version string/identifier that would suggest it is Vim 8.1.320 though oddly it is opened with the 'vi' command rather than vim and also there does seem to be a separate package for Vim itself.

It's confusing to say the least.

4

In Debian and Debian-derived distributions (such as Ubuntu), vi is handled through the "alternatives" system. To see the available alternatives for vi, you can use the command:

$ update-alternatives --display vi
vi - auto mode
  link currently points to /usr/bin/vim.gnome
/usr/bin/vim.basic - priority 30
  slave vi.1.gz: /usr/share/man/man1/vim.1.gz
  slave vi.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
  slave vi.it.1.gz: /usr/share/man/it/man1/vim.1.gz
  slave vi.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
  slave vi.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
  slave vi.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz
/usr/bin/vim.gnome - priority 60
  slave vi.1.gz: /usr/share/man/man1/vim.1.gz
  slave vi.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
  slave vi.it.1.gz: /usr/share/man/it/man1/vim.1.gz
  slave vi.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
  slave vi.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
  slave vi.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz
/usr/bin/vim.tiny - priority 10
  slave vi.1.gz: /usr/share/man/man1/vim.1.gz
  slave vi.fr.1.gz: /usr/share/man/fr/man1/vim.1.gz
  slave vi.it.1.gz: /usr/share/man/it/man1/vim.1.gz
  slave vi.ja.1.gz: /usr/share/man/ja/man1/vim.1.gz
  slave vi.pl.1.gz: /usr/share/man/pl/man1/vim.1.gz
  slave vi.ru.1.gz: /usr/share/man/ru/man1/vim.1.gz
Current 'best' version is '/usr/bin/vim.gnome'.

You can see here that my laptop has vi automatically selecting the "best" alternative (vi - auto mode) and that the vi link points to /usr/bin/vim.gnome, and then a bunch of more detailed information about the files involved and their priority rankings ("best" = highest priority setting).

If you want vi to start a different alternative, you can use sudo update-alternatives --config vi to choose one manually.


As for whether it is the same as standard vim, aside from the build switches which may vary depending on which vim package is the active alternative.

You can get some information about the details of your active vim alternative by using dpkg -S to identify which package it came from and dpkg -s to view the package details:

$ dpkg -S /usr/bin/vim.gnome
vim-gnome: /usr/bin/vim.gnome
$ dpkg -s vim-gnome
Package: vim-gnome
<snip>
 This package contains a version of vim compiled with a GNOME2 GUI
 and support for scripting with Lua, Perl, Python, Ruby, and Tcl.
  • @jamessan - Thanks for the edit! I was sure I'd read that in the buster release notes, but apparently I was mistaken. – Dave Sherohman Aug 9 at 14:47
  • I think you likely confused it with the mutt/neomutt situation. :) – jamessan Aug 9 at 16:28
  • @jamessan - Yes, that's probably it. Sorry about that, in any case. – Dave Sherohman Aug 10 at 14:19
3

TL;DR

The vi on your computer is almost certainly a symlink to vim, renamed executable, or something similar rather than an actual vi executable. The Vim package(s) in the repositories are built with different switches (i.e. features).


Small note first: there is no program called Vi/Vim. Vi and Vim are two separate programs. Vi is an editor created in the 1970s. Vim is a clone (not a fork!) of Vi created in the 1990s.

Vi was, until the early 2000s, under some restrictive licensing, not to mention having limited development after the 1980s. Since Unix clones were generally expected to provide a vi executable, open source operating systems such as BSD and Linux turned to Vi clones. In Linux's case Vim is usually selected.

In order to ensure compatibility, a symlink, hardlink, renamed executable, or some other thing is created at /bin/vi (or /usr/bin/vi) that, rather than launching Vi, launches Vim.

As far as the additional package(s) in the repositories, well, Vim has a lot of build switches, controlling things such as whether Python can be used in plugins and which version of Python; whether there's a GUI and if so, which GUI (GTK+, Motif, Athena, Win32, etc.); whether there's clipboard support; whether there's mouse support; and many, many other things. Linux distributions will typically pick a somewhat limited build to include in the base image, and make additional variants available through the repos. And of course, if you're not satisfied by the options there, you can build your own and select exactly which features you want.

3

Debian (and Ubuntu) only have the vim-tiny package installed by default. The sole purpose of this package is to provide a vi binary as part of the default install. That it happens to be Vim is just an implementation detail. This is why the package doesn't install anything under the name vim, uses a separate system-wide configuration file (/etc/vim/vimrc.tiny), and tunes the default configuration towards behaving like vi.

One of the benefits of it actually being Vim is that you can install the vim-runtime package and get much of the benefit of Vim, but without pulling in a lot of other dependencies.

However, for a more standard "Vim" experience, one of the other Vim packages should be installed.

  • vim - All of Vim's features are enabled, but there are no language bindings or GUI support
  • vim-nox - Same as vim, except now language bindings are enabled
  • vim-gtk/vim-gtk3/vim-athena - Same as vim-nox, except built against the specific GUI toolkit

Your Answer

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

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