24

On some unixes sometime I found a command named nvi. It was a vi-like editor, without much of its functionality. Maybe it was a fork of the old vi?

Anyways, which vi versions are a fork of the others, and which are independent developments? Do they have a "family tree", similar to the unixes?

2 Answers 2

29

From nvi(1):

HISTORY
    The ex editor first appeared in 1BSD.  The nex/nvi replacements for the
    ex/vi editor first appeared in 4.4BSD.

Some background, from memory, so I hope got the details correct:

In the beginning, UNIX was free. Everyone could request a copy from Ken, and he would send you a tape with the source (allegedly with the text "love, Ken" on them). The terms "free software" or "open source" didn't exist yet, but for all intents and purposes it was "open source".

The reason for this was because UNIX was developed at Bell labs. Bell labs is part of AT&T which, at the time, had an effective monopoly on telephony. As part of an agreement with the U.S. government, it was agreed that AT&T was not allowed to enter other fields of businesses (such as computers).

Somewhere along the way this changed, and UNIX became proprietary software. As a result, BSD (which stems from UNIX) also became proprietary software. vi was written as part of BSD, so it also became proprietary.

This is why in the late '80s to early '90s some "vi clones" appeared, such as stevie (later the basis for vim) and nvi.

In the early '90s, people wanted a free BSD system, so nvi was created for 4.4BSD-lite (lite meaning, not encumbered by AT&T code), so nvi was created as a "bug-for-bug compatible" replacement for the encumbered vi. It has all of the vi features, but not the more advanced features you might find in vim.

FreeBSD & NetBSD both descend from 4.4BSD-Lite (and OpenBSD & DragonflyBSD descend from NetBSD and FreeBSD, respectively), which is why they ship with nvi installed by default.

Unlike Linux, BSD systems have a single "base" system of which nvi is part of, so there are really 4+ versions of nvi. But in reality the changes are small to non-existent, the BSD projects exchange code, so most bugfixes and enhancements are shared (but perhaps not all?). I believe FreeBSD added multibyte support a few years ago, for example.

The vim story is more boring: Bram was running on Amiga, wanted to run vi, but couldn't find a vi for Amiga. So he took the stevie code, ported it to Amiga, and continued to improved it further. This is why you can still find many Amiga-related notes in the docs even today.

In the meanwhile, UNIX is "free" once more, and you can run original vi.

2
  • 1
    Wikipedia claims nvi is based on elvis which shipped with the original 386BSD, and was an effort to make a more purely vi-compatible version. Is this correct?
    – Random832
    Feb 27, 2015 at 17:06
  • nvi is missing some features of "original vi". For example, Lisp mode (set lisp) is not implemented in nvi.
    – Flux
    Dec 24, 2021 at 7:28
5

The roots of the family trees of vi clones seem to be:

  • 1977: "Traditional vi", Bill Joy's original source, ported and free to use since 2002.
  • 1985: microEmacs, from which the vi-alike "vile" was developed.
  • 1987: stevie, from which vim and xvi were developed.
  • 1990: elvis, from which nvi was developed.
  • 2000: busybox's "tiny vi"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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