8

How do I install the vi editor in Ubuntu 18.04? I want to try vi, not vim. I am just curious to see how it works. Thanks!

  • vi is generally installed by default. vi didn't use arrow keys as few terminals had arrow keys in the 70s, where I think vim-tiny has the arrow keys enabled, , but if you want the full vi experience - just don't use your arrow keys. – guiverc Dec 9 '18 at 5:42
  • 1
    What exactly do you mean by vi here? – muru Dec 9 '18 at 5:52
  • Possible duplicate of How do I install applications in Ubuntu? – N0rbert Dec 9 '18 at 8:02
  • 2
    @N0rbert "How do I install applications in Ubuntu?" is a duplicate of many software installation questions, but it's not a duplicate of this question because there are multiple vim packages in the default Ubuntu repositories and the linked question does not answer how to select a package for installation when there are multiple alternative packages available in the default Ubuntu repositories. – karel Dec 9 '18 at 9:10
  • 2
    @Norbert the original vi is not in the Ubuntu repositories any more. – Warren Hill Dec 13 '18 at 10:23
8

There's no such thing as "original" vi on Linux.

If one wants to try the original flavor of vi, there's several versions he can try.

  1. vim.tiny as the other answer suggested.

  2. run busybox vi, busybox-static is default installed on 18.04/18.10. This version is a very small clone of vi.

  3. The traditional vi project, run by Gunnar Ritter, the first one who ported vi to Linux. You need to compile from source for this one.

6

To install vi in all currently supported versions of Ubuntu open the terminal and type:

sudo apt install vim-tiny

This package contains a minimal version of Vim compiled with no GUI and a small subset of features which runs with 'compatible' set, no language bindings, no X/GUI support. This package's sole purpose is to provide the vi binary for base installations.

If a vim binary is wanted, try one of the following more full-featured packages: vim, vim-nox, vim-athena, vim-gtk, or vim-gtk3.

To edit a file named FILE in vi type:

vi /path/to/FILE  

Results of which vi :

/usr/bin/vi

Results of update-alternatives :

$ update-alternatives --list vim
/usr/bin/vim.gtk3
$ update-alternatives --list vi
/usr/bin/vim.gtk3
/usr/bin/vim.tiny
$ update-alternatives --config vi
There are 2 choices for the alternative vi (providing /usr/bin/vi).

  Selection    Path               Priority   Status
------------------------------------------------------------
* 0            /usr/bin/vim.gtk3   50        auto mode
  1            /usr/bin/vim.gtk3   50        manual mode
  2            /usr/bin/vim.tiny   15        manual mode

Press <enter> to keep the current choice[*], or type selection number:
  • 1
    is vim-tiny 100% vi compatible, with no additions? I am really wanting to try out plain vi to see what it is like. – eeze Dec 9 '18 at 4:58
  • 2
    @Cee VIM stands for Vi IMproved (as per VIM official documentation). So, vim-minimal (No GUI) and vi must be somewhat same. You might like to read Biggest differences between Vim and VI - Vi and Vim Stack Exchange – Kulfy Dec 9 '18 at 9:40
  • @eeze No, vim-tiny is nowhere close to traditional vi. In fact, vim-tiny is the default vim that comes with Ubuntu. Even a minimal vim will have tons more features than vi. For example, vim-tiny supports arrows in Insert Mode, split windows (:sp), tabs (:tabnew myfile), etc. See vim faq 1.4 or :help vi_diff for the full list. To try real vi, try the other options in Alvin's answer. – wisbucky Jul 17 '19 at 0:31

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.