Appendix D. vi and Vim: Source Code and Building

On the off chance that you don’t already have vi or Vim installed on your system, this appendix describes where to get source code for both editors, and prebuilt installable binaries for most popular operating systems.

Nothing Like the Original

For many, many years, the source code to the original vi was unavailable without a Unix source code license. Although educational institutions were able to get licenses at relatively low cost, commercial licenses were always expensive. This fact prompted the creation of Vim and many other vi clones.

In January 2002, the source code for V7 and 32V UNIX was made available under an open source–style license.1 This opened up access to almost all of the code developed for BSD Unix, including ex and vi.

The original code does not compile “out of the box” on modern systems, such as GNU/Linux, and porting it is difficult.2 Fortunately, the work has already been done. If you would like to use the original, “real” vi, you can download the source code and build it yourself. See https://github.com/n-t-roff/heirloom-ex-vi for more information.

We were able to build the “Heirloom” vi with no problems on an Ubuntu GNU/Linux system just by following the instructions in the README file.

Where to Get Vim

Most modern Unix-flavored OSs use Vim as the standard version of vi.3 That is, when you execute vi, you get Vim.

Many such systems lag slightly behind the most current Vim. For example, as of this publication ...

Get Learning the vi and Vim Editors, 8th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.