Recent from talks
Nothing was collected or created yet.
| nvi | |
|---|---|
| Stable release | 1.81.6[1] |
| Repository | repo |
| License | BSD-3-Clause[2] |
| Website | sites |
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]- ^ "nvi 1.81.6". 18 November 2007.
- ^ Keith Bostic. "Update the license: we're going to standard BSD, copyright UC Berkeley".
- ^ Lionel Sambuc. "Termcap update, replacing elvis by nvi".
- ^ "nvi commitlog". Archived from the original on May 1, 2001.
- ^ Thomas E. Dickey, "Types of library users", NCURSES – Frequently Asked Questions (FAQ), retrieved July 11, 2014
- ^ Jun-ichiro itojun Hagino and Yoshitaka Tokugawa. "Multilingual vi clones: past, now and the future".
- ^ Federico Biancuzzi (December 4, 2007). "The Man in the Machine". SecurityFocus.
- ^ Zhihao Yuan (17 November 2022). "nvi2 git repo". GitHub.
External links
[edit]History
Origins in BSD
In the late 1980s and early 1990s, licensing disputes arose between AT&T, the proprietor of UNIX source code, and the University of California, 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.[11][12] 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 drop-in replacement, ensuring bug-for-bug compatibility with the historic ex/vi while avoiding any direct use of AT&T 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.[11][13] 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 architecture without relying on proprietary lineage.[13][14] The original vi, authored by Bill Joy 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.[3]Development milestones
nvi's development began in the early 1990s when Keith Bostic initiated work on a freely redistributable implementation of the vi editor, starting from Steve Kirkendall's Elvis 1.8 as a base to ensure bug-for-bug compatibility with the original ex/vi while adhering to POSIX standards where possible.[15] 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 AT&T licensing restrictions.[16] Bostic continued leading the project, porting nvi to various Unix systems and releasing version 1.0 in 1993 under a permissive license that facilitated widespread adoption.[17] Key subsequent releases included version 1.79 in 1996, which gained prominence in BSD distributions due to its compatibility with Berkeley DB for screen and history storage, enhancing performance and reliability in multi-user environments.[18] The final official stable release under Bostic's direct maintenance was version 1.81.6 in November 2007, incorporating refinements to termcap support and license updates to standard BSD terms.[19] 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 Perl interface developed by Verdoolaege around 2000 for more advanced automation and customization. Initial curses interface work was provided by Elan Amir to support screen-oriented operations across terminals.[20] 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.[21]Key contributors
Elan Amir, a developer at the University of California, Berkeley, 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.[13][22] 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 codebase suitable for BSD systems. He oversaw development and releases through version 1.81.6, the final major update under his guidance.[23] Bostic also founded Sleepycat Software in 1996 with Margo Seltzer, where they developed Berkeley DB, an embedded database system that nvi utilizes for file recovery and editing persistence.[24] Sven Verdoolaege extended nvi's functionality by adding a Perl scripting interface for advanced customization and has been the primary maintainer since the early 2000s, continuing to address bugs and incorporate improvements through the project's Git repository.[13][23] George Neville-Neil contributed the Tcl scripting support, allowing nvi users to embed Tcl scripts for automation and extension within the editor.[13][22] Among other contributors, Jun-ichiro "itojun" Hagino developed the nvi-m17n variant, introducing multilingual enhancements including file encoding detection for non-Latin scripts.[25] Following Bostic's reduced involvement, ongoing maintenance has been handled by a community of developers via the repo.or.cz Git repository, with recent updates focusing on compatibility and stability.[23]Features
Core vi compatibility
nvi provides a bug-for-bug compatible reimplementation of the original ex and vi editors from the Fourth Berkeley Software Distribution (4BSD), ensuring seamless backward compatibility for users of the classic Bill Joy vi from 1976.[13] 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.[13] Historic vi features, including tags for navigation and macros for command repetition, are preserved to maintain fidelity to the original behaviors.[26] 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.[26] 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.[13][27] nvi adheres to POSIX.2 standards, including POSIX 1003.2 extended regular expressions (enabled via theextended option), and has been tested for compatibility against the original vi implementation.[13] It omits proprietary AT&T extensions to focus on open standards and relies on the curses or ncurses library for terminal handling, limiting its use to Unix-like environments.[13] Later implementations may substitute alternative database backends for Berkeley DB while preserving core compatibility.[27]
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.[28]
Search functionality in nvi is improved with incremental search, 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 pattern matching, such as non-greedy quantifiers and alternation without escaping. Filename 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.[28]
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.[28][29]
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 shorthand 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.[28][10]
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.[30]
nvi further extended its extensibility in the late 1990s with a Perl interface, added by Sven Verdoolaege, which supports advanced text processing, regular expression 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 pattern matching and data handling.[23]
Customizable key bindings and runtime configurations are managed through the .exrc file in the user's home directory, 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 personalization 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.[31][32]
Despite these capabilities, nvi lacks a built-in plugin system comparable to Vim's, relying instead on ex commands and the embedded Tcl or Perl 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.[29][33]
