Hubbry Logo
NviNviMain
Open search
Nvi
Community hub
Nvi
logo
8 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Nvi
Nvi
from Wikipedia
nvi
Stable release
1.81.6[1] Edit this on Wikidata / 18 November 2007
Repositoryrepo.or.cz/nvi.git
LicenseBSD-3-Clause[2]
Websitesites.google.com/a/bostic.com/keithbostic/the-berkeley-vi-editor-home-page

nvi (new vi) is a re-implementation of the classic Berkeley text editor, ex/vi, traditionally distributed with BSD and, later, Unix systems. It was originally distributed as part of the Fourth Berkeley Software Distribution (4BSD).

Due to licensing disputes between AT&T and the Computer Systems Research Group (CSRG) at the University of California, Berkeley, the CSRG was required to replace all Unix-derived portions of BSD source with new and unencumbered code. nvi was one of many components rewritten, despite the fact that the original vi was from UC Berkeley. AT&T had a legal claim over the license.

Credits and distribution

[edit]

nvi was written by Keith Bostic. It is the default vi on all major BSD systems (NetBSD, OpenBSD, and FreeBSD) as well as MINIX.[3]

It was originally derived from the first incarnation of elvis, written by Steve Kirkendall, as noted in the README file included in nvi's sources.

Sven Verdoolaege added support for Unicode in 2000.[4] He also has been developing a GTK+ front end for nvi, but this effort seems to have stalled. The aspects of nvi that are still marked preliminary or unimplemented are, for the time being, likely to remain that way.

BSD projects continue to use nvi version 1.79 due to licensing differences between Berkeley Database 1.85 and the later versions by Sleepycat Software. nvi is unusual because it uses a database to store the text as it is being edited. Sven Verdoolaege's changes after version 1.79 use locking features not available in the Berkeley DB 1.85 database. Reportedly, changes to nvi after 1.79 make it less vi-compatible.[citation needed]

nvi can vary subtly across the BSDs.

nvi is only available on POSIX/Unix platforms due to its reliance on the curses/ncurses library.[5]

An unmaintained, multilingual version by the late Jun-ichiro itojun Hagino is available as nvi-m17n. [6][7]

A currently-maintained, multibyte version is available as nvi2, and is the default vi on DragonFly BSD.[8]

See also

[edit]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
nvi (new vi) is a free and open-source that reimplements the classic Unix ex/vi editor, providing a screen-oriented interface for editing files in a terminal environment. Developed by Keith Bostic at the , nvi was created to offer a freely redistributable alternative to the original vi, which was encumbered by licensing restrictions. In the late 1980s, as BSD developers sought to avoid proprietary code from Unix, Bostic began reimplementing vi starting from Steve Kirkendall's elvis 1.8 clone, aiming for bug-for-bug compatibility with the historic Berkeley ex/vi while enhancing portability and extensibility. nvi was first released in 1991 as part of 4.4BSD Net/2 and included in 4.4BSD in 1993, becoming the default vi implementation on major BSD variants including , , and . Originally maintained by Bostic and later by Verdoolaege, development of the core version concluded around 1.81.6, though community forks like nvi2 continue to add support for multibyte characters and modern features. nvi extends the original vi with several key enhancements, including data handling, support for arbitrarily long lines and files, multiple edit buffers, infinite /redo, horizontal scrolling, filename and , tag stacks with Cscope integration, and extended regular expressions. It also supports internationalization through message catalogs in seven languages (Dutch, English, French, German, Russian, Spanish, and Swedish) and includes preliminary scripting interfaces for and Tcl/Tk. Licensed under the BSD 3-Clause License, nvi remains widely used in systems for its lightweight footprint and adherence to standards, serving as a foundational tool for programmers and system administrators.

History

Origins in BSD

In the late 1980s and early 1990s, licensing disputes arose between , the proprietor of UNIX , and the , Berkeley's Computer Systems Research Group (CSRG), which maintained the Berkeley Software Distribution (BSD). These conflicts restricted the redistribution of BSD releases containing proprietary AT&T elements, including the original ex/vi editor code, as AT&T required licensees to obtain separate permissions for derivative works and commercial distribution. To address this, the CSRG undertook systematic rewrites of AT&T-derived utilities to create a fully freely redistributable system. The need for a vi-compatible editor free of such restrictions became acute during preparations for 4.4BSD, released in 1993, which aimed to eliminate all proprietary code. Keith Bostic, a key CSRG developer, initiated a clean-room reimplementation of vi to serve as a , ensuring bug-for-bug compatibility with the historic ex/vi while avoiding any direct use of source material. This effort was part of a broader campaign to purge BSD of licensed components, allowing unrestricted sharing and modification under the BSD license. Initial groundwork for nvi began in 1990–1991 at UC Berkeley, with Elan Amir contributing essential adaptations, including integration of the curses library for robust full-screen terminal editing support tailored to 4.4BSD's environment. Bostic then expanded this foundation into the core nvi implementation, drawing design influences from contemporary vi clones such as elvis by Steve Kirkendall, which provided insights into modernizing vi's without relying on proprietary lineage. The original vi, authored by in 1976 as a visual interface to the ex line editor, had become a UNIX staple, but its AT&T-entangled evolution necessitated nvi's independent creation to preserve BSD's open distribution goals.

Development milestones

nvi's development began in the early when Keith Bostic initiated work on a freely redistributable implementation of the vi editor, starting from Kirkendall's Elvis 1.8 as a base to ensure bug-for-bug compatibility with the original ex/vi while adhering to standards where possible. The first public release occurred in 1994 as part of the 4.4BSD distribution, offering core vi/ex compatibility for use in BSD systems seeking to avoid licensing restrictions. Bostic continued leading the project, porting nvi to various Unix systems and releasing version 1.0 in under a permissive that facilitated widespread adoption. Key subsequent releases included version 1.79 in 1996, which gained prominence in BSD distributions due to its compatibility with for screen and history storage, enhancing performance and reliability in multi-user environments. The final official stable release under Bostic's direct maintenance was version 1.81.6 in November 2007, incorporating refinements to support and updates to standard BSD terms. Scripting capabilities were also integrated, with Tcl support contributed by George Neville-Neil in the mid-1990s to allow dynamic extension through Tcl scripts, followed by a interface developed by Verdoolaege around 2000 for more advanced and customization. Initial curses interface work was provided by Elan Amir to support screen-oriented operations across terminals. Following the 2007 release, maintenance shifted to an open-source model led by community contributors, with the project repository hosted on repo.or.cz to facilitate ongoing development and forks. Core development effectively ceased after 1.81.6, with only minimal updates for compatibility since then.

Key contributors

Elan Amir, a developer at the , initiated the early work on nvi by implementing curses-based screen handling and scrolling features, enabling full-screen editing capabilities for its integration into 4.4BSD. Keith Bostic served as the primary architect and lead developer of nvi starting in the early 1990s, reimplementing the editor from Steve Kirkendall's elvis clone to achieve bug-for-bug compatibility with the original vi while creating a portable suitable for BSD systems. He oversaw development and releases through version 1.81.6, the final major update under his guidance. Bostic also founded Sleepycat Software in 1996 with Margo Seltzer, where they developed , an embedded database system that nvi utilizes for file recovery and editing persistence. Sven Verdoolaege extended nvi's functionality by adding a scripting interface for advanced customization and has been the primary maintainer since the early , continuing to address bugs and incorporate improvements through the project's repository. George Neville-Neil contributed the Tcl scripting support, allowing nvi users to embed Tcl scripts for automation and extension within the editor. Among other contributors, Jun-ichiro "itojun" Hagino developed the nvi-m17n variant, introducing multilingual enhancements including file encoding detection for non-Latin scripts. Following Bostic's reduced involvement, ongoing maintenance has been handled by a community of developers via the repo.or.cz repository, with recent updates focusing on compatibility and stability.

Features

Core vi compatibility

nvi provides a bug-for-bug compatible reimplementation of the original ex and vi editors from the Fourth (4BSD), ensuring seamless backward compatibility for users of the classic vi from 1976. It fully implements the ex/vi command set, supporting modal editing across command, insert, and visual modes, as well as ex commands for line-oriented operations such as substitution, global patterns, and addressing with regular expressions. Historic vi features, including tags for navigation and macros for command repetition, are preserved to maintain fidelity to the original behaviors. All standard vi options are supported except for open mode and lisp edit mode, with the underlying ex mode fully functional to enable scripting and batch processing. Text is stored using a database backend—initially Berkeley DB with its recno access method for efficient line-number-based handling—which facilitates operations on large files and supports robust undo and redo capabilities. nvi adheres to POSIX.2 standards, including 1003.2 extended regular expressions (enabled via the extended option), and has been tested for compatibility against the original vi implementation. It omits proprietary extensions to focus on open standards and relies on the curses or library for terminal handling, limiting its use to environments. Later implementations may substitute alternative database backends for while preserving core compatibility.

Advanced editing capabilities

nvi extends the classic vi editor with several built-in features that enhance productivity for complex editing tasks, building upon the foundational vi commands for navigation and modification. One key advancement is support for multiple edit buffers, where users can name buffers with a single character and switch between them seamlessly using commands like :buffer or <control-^> for toggling to the previous buffer. This allows simultaneous management of several files without closing and reopening them. Additionally, nvi supports multiple windows through the split command for horizontal splits, enabling side-by-side viewing and editing of different buffers or sections of the same file to facilitate comparison and reference during sessions. Search functionality in nvi is improved with , activated by setting the searchincr option, which updates matches in real-time as the user types the search pattern using / or ? commands. This feature aids in locating text efficiently without completing the full query first. Searches utilize extended regular expressions when the extended option is enabled, supporting egrep-style syntax for more powerful , such as non-greedy quantifiers and alternation without escaping. completion is also integrated, triggered by the character specified in the filec option (defaulting to Tab), which expands partial paths in ex commands like :edit for quicker file access. Performance optimizations contribute to fast file opening and buffer switching, making nvi suitable for handling large files through efficient I/O mechanisms, including memory-mapped access in its implementation to minimize loading times. Hexadecimal editing is supported via input mode, where <control-X> followed by hexadecimal digits inserts the corresponding byte, useful for binary data manipulation. For spell-checking, nvi integrates with external tools like ispell through ex filter commands such as !% spell, allowing users to check and replace words across the buffer without leaving the editor.

Scripting and extensibility

nvi provides full support for ex scripting, enabling users to create macros, abbreviations, and key mappings that are compatible with the original vi editor while allowing extensions for more complex automation tasks. Macros can be defined using the :map command to bind sequences of keystrokes or ex commands to specific keys, facilitating repetitive editing operations across sessions. Abbreviations, set via the :abbreviate command, automatically expand text during insertion mode, and these features are persisted in initialization files for consistent use. This scripting layer supports automation of text manipulation, such as batch substitutions or custom navigation, building on the historic ex command syntax without introducing incompatible changes. In the mid-1990s, nvi integrated a Tcl interpreter, allowing users to embed Tcl scripts directly within editor sessions for dynamic command execution and rudimentary plugin-like functionality. This addition, initially designed by George Neville-Neil, enables Tcl code to interact with nvi's buffers and options, such as automating file operations or generating content on-the-fly through interpreted commands. By the late 1990s, preliminary support for Tcl had matured, providing a pathway for procedural scripting beyond basic ex commands. nvi further extended its extensibility in the late 1990s with a interface, added by Sven Verdoolaege, which supports advanced text processing, operations, and integration with external tools directly from within the editor. This allows Perl scripts to manipulate nvi's editing environment, such as performing complex searches or transformations on multiple buffers, enhancing automation for programming tasks. For instance, users can invoke Perl code via ex commands to process selected text or entire files, leveraging Perl's strengths in and data handling. Customizable key bindings and runtime configurations are managed through the .exrc file in the user's , where options, mappings, and abbreviations are defined using ex syntax, supplemented by environment variables like NVI for additional settings. This file loads automatically on startup, allowing persistent such as remapping keys for specific workflows or setting editor options like line numbering. nvi also supports brief references to multiple buffers as targets for scripted operations, enabling coordinated editing across files. Despite these capabilities, nvi lacks a built-in plugin system comparable to Vim's, relying instead on ex commands and the embedded Tcl or interpreters for extensibility rather than loadable modules or a dedicated plugin architecture. This design prioritizes lightweight compatibility with traditional vi but limits the ease of adding third-party extensions without scripting knowledge.

Implementations

Standard releases

Initial releases of nvi were managed by Keith Bostic up to version 1.79 in 1999; subsequent standard releases, including version 1.81.6, which was released in 2007, were managed by Verdoolaege. The source code for these releases is distributed under the BSD-3-Clause license. Version 1.79, released in 1999, became the frozen base adopted by BSD distributions to circumvent licensing changes in following its development by Sleepycat Software and acquisition by , which imposed restrictions requiring approval for certain uses. After 2007, community-driven maintenance continued via the repository at repo.or.cz/nvi.git, with updates limited to bug fixes, compatibility improvements, and minor enhancements rather than major feature additions; activity persisted into the 2020s, with the most recent commits dated December 2024. Building nvi requires the curses or library for screen handling and relies on a bundled stripped-down version of for internal text storage, though configurations may substitute alternatives such as gdbm. nvi compiles on POSIX-compliant systems including traditional Unix, , and BSD variants, but offers no native support for non-POSIX platforms like Windows or macOS without emulation layers. Later releases in the 1.81 series introduced support for wide characters and handling.

Variants and forks

One notable variant of nvi is nvi-m17n, a multilingual extension developed by Jun-ichiro "itojun" Hagino in the late and early as part of the KAME Project. This fork, based on nvi version 1.79 from November 1999, introduced support for multibyte encodings such as ISO-2022-JP, EUC-TW, and , along with input methods using libraries like Canna for Asian languages. It modified regular expressions, word boundary detection, and the curses library to handle non-ASCII characters effectively, enabling seamless editing of multilingual text files. nvi-m17n has been unmaintained since 2004, with no significant updates after the last known release; the original developer passed away in 2007. Another prominent fork is nvi2, initiated by developer Lichray (Zhihao Yuan) in the 2010s during for . This multibyte-focused version emphasizes and wide-character support, incorporating file encoding detection techniques inspired by nvi-m17n while adding modern features like NetBSD-style expandtab options and ports to macOS and . nvi2 serves as the default vi editor in , where it has been integrated and updated to handle contemporary terminal environments. Key differences from the original nvi include the use of DB1 for backend storage to sidestep licensing complexities associated with later versions, and enhanced multibyte handling without relying on external dependencies for basic functionality. Other derivatives include the portable nvi initiated by lacamera on in the , with last updates around 2022, which adapts OpenBSD's security-hardened version of nvi for broader systems, emphasizing stability, operation, and compatibility with diverse terminals. As of 2025, nvi2 remains actively developed, with its latest release (version 2.2.2) on October 9, 2025, including fixes for modern terminal compatibility, while the original nvi lineage shows limited activity beyond minor patches.

Distribution and adoption

Use in operating systems

nvi has been the default implementation of the vi editor in several BSD-derived operating systems, valued for its compatibility with traditional vi behavior while enabling free redistribution without proprietary dependencies. It was included in the 4.4BSD-Lite release in as a replacement for the original proprietary vi, which was derived from code, allowing BSD systems to provide a clean-room reimplementation that adhered closely to the original ex/vi interfaces. This historical inclusion ensured nvi's presence in base systems across subsequent BSD derivatives, where it remains for its minimal dependencies beyond the curses library and strong compliance, making it suitable for system scripting and tools without requiring additional runtime libraries. Specifically, nvi serves as the default vi in since its initial releases in 1994, since version 2.0 (1996), with version 1.79 since 4.0 (2000), with the nvi2 variant since 2013, and an embedded variant in . These adoptions stem from nvi's lightweight footprint, which avoids heavy external dependencies, and its POSIX-compliant design that supports essential editing tasks in resource-constrained environments. In modern installations, nvi is often overshadowed by more feature-rich editors like Vim or Neovim, which users install via package managers for advanced functionality, but it is retained in base system installs for compatibility and to ensure a minimal, reliable editor is always available without additional packages. For example, FreeBSD's ports collection allows easy upgrades to Vim while keeping nvi in the base for core system use. As of November 2025, nvi remains the default vi in versions 7.5 (April 2024) and later, benefiting from the project's rigorous security auditing of base system components to minimize vulnerabilities. Similarly, continues to use the nvi2 variant, which incorporates modern text handling features like multibyte support for improved . Its BSD-style licensing has facilitated this widespread inclusion in base systems by enabling free distribution and modification.

Licensing and availability

nvi has been distributed under the BSD-3-Clause license since its initial release in 1990, which permits free modification, redistribution in source or binary form, and commercial use, subject to retaining the copyright notice, conditions, and disclaimer in all copies. This permissive licensing framework stems from its origins as a reimplementation of the Berkeley ex/vi editor, necessitated by the proprietary licensing restrictions on the original vi code, which prevented unrestricted redistribution in BSD systems. Subsequent development introduced challenges with dependencies on for features like session recovery. Starting with version 1.80, nvi integrated 1.85 or later, but Oracle's 2006 acquisition of Sleepycat Software ('s maintainer) altered the database's licensing terms, requiring explicit approval for certain uses and prompting BSD distributions to retain version 1.79 to maintain compatibility without additional encumbrances. The code for the mainline nvi is available via the Git repository at repo.or.cz/nvi.git, hosting version 1.80 with recent maintenance commits as late as September 2024. Forks and variants extend availability, including nvi2—a multibyte-enhanced version under the same BSD-3-Clause license—mirrored on at github.com/lichray/nvi2, last updated in October 2025. The variant, derived from nvi 1.79 and portable for other systems, is hosted at github.com/lacamera/nvi. nvi is also available as an optional package in various distributions, such as and , for users seeking a lightweight vi-compatible editor. Documentation accompanies distributions, featuring the Vi/Ex Reference Manual (originally published March 1997 and updated in subsequent releases), which details commands, options, and scripting interfaces for nex/nvi. Online archives preserve the original 4.4BSD documentation, accessible via historical and Berkeley sites. Following Keith Bostic's departure from active maintenance, nvi lacks a formal organization, with bug reports and contributions handled through the primary repository. As of 2025, activity remains minimal but sufficient for stability in legacy environments, supported by occasional patches from contributors like Verdoolaege.

References

Add your contribution
Related Hubs
User Avatar
No comments yet.