vi

From Gentoo Wiki
Jump to:navigation Jump to:search

vi is a powerful "modal" text-based editor with a long history in the Unix(like) operating system. The original vi has served as a basis for many clones and derivatives over the years, notably vim.

A new Gentoo installation includes nano by default - emerge a package from the following section to provide a vi-like editor. Beware that emerging a vi editor on a new installaton may allow nano to be depcleaned - see the default, fallback, and virtual packages section in the text editor article.

Although not part of the GNU Coreutils, a vi-like editor is almost universally included in Linux distributions. vi has parentage with the ed line editor.

See also
The Vim article provides general information on vi-like editors. See the Vim guide for an introductory tutorial on vi-like editor usage. See the text editor article for general information on installing and configuring text editors in Gentoo.

Available software

Name Package Description
levee app-editors/levee Really tiny vi clone.
Neovim app-editors/neovim Neovim is a hyperextensible Vim-based text editor.
pyvim app-editors/pyvim Implementation of Vim in Python.
Vim app-editors/vim Modern vi(like) editor, probably the most used clone. Optional GUI called Gvim.
vis app-editors/vis A vi-like editor based on Plan 9's structural regular expressions.

More vi-like editors can be found online in the app-editors category or by running:

user $eix "app-editors/*"

Launch vi(like) editor

A vi-like editor can usually be launched with the vi command. Vim can be launched with the vim command. Neovim is launched with the nvim command.

If a vi-like editor is not installed, busybox's vi may be available, try:

user $busybox vi -h
BusyBox v1.34.1 (2021-11-23 09:49:04 CET) multi-call binary.

Usage: vi [-c CMD] [-R] [-H] [FILE]...

Edit FILE

        -c CMD  Initial command to run ($EXINIT also available)
        -R      Read-only
        -H      List available features

/usr/bin/vi symlink

If Vim is installed, the vi and vim commands become synonymous due to the following link:

user $ls -al /usr/bin/vi
lrwxrwxrwx 1 root root 3 Nov 25 19:59 /usr/bin/vi -> vim

Use eselect vi to manage this link, from the app-eselect/eselect-vi package. eselect vi can currently select between the following: vim, nvim, nvi, elvis, vile, gvim, qvim, xvile, pyvim, and busybox.

The synonymous use also holds when setting editor defaults.

See also

  • Text editor — a program to create and edit text files.
  • Vim — a text editor based on the vi text editor.
  • Vim/Guide — explain basic usage for users new to vi-like text editors in general, and vim in particular.