Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
O

OpenVi

> 开发工具
Open source

OpenVi: Portable OpenBSD vi for UNIX systems

194 stars0 likes0 views
WebsiteGitHub

About

OpenVi: Portable OpenBSD vi for UNIX systems

Uma tradução em português está disponível.

OpenVi

OpenVi — Portable OpenBSD vi / ex

Table of Contents

  • Overview
    • Why?
      • Why not?
  • Building
    • Prerequisites
      • Required prerequisites
      • Optional prerequisites
      • Supported platforms
        • Unsupported platforms
    • Compilation
      • Platform Specifics
        • AIX
        • NetBSD
        • illumos
        • Solaris
        • Windows
          • Cygwin
  • Availability
    • Source Code
    • Packages
  • Versioning
  • History
  • License
  • Acknowledgements
  • Similar Projects
  • See Also

Overview

OpenVi is an enhanced and portable implementation of the Berkeley vi / ex text editor, originally developed by Bill Joy.

OpenVi is a fork of the vi / ex editor included with OpenBSD, which is derived from version 1.79 of the nvi editor originally distributed as part of the Fourth Berkeley Software Distribution (4BSD).

The nvi editor was developed by Keith Bostic of the Computer Systems Research Group (CSRG) at the University of California, Berkeley, Sven Verdoolaege, and other contributors. Nvi itself was derived from Steve Kirkendall's Elvis editor.

Why?

Why would you want to use OpenVi instead of AnotherVi?

  • Derived from the (extensively audited) OpenBSD base system code
    • Focus on readability, simplicity, and correctness of implementation
    • Adherence to OpenBSD's standard secure coding practices
      • Uses secure functions (e.g. strlcpy, snprintf, mkstemp, pledge)
    • Reduced complexity for hopefully fewer program defects
  • Clean source code, distributed under a permissive 3-clause BSD license
    • Some support code is distributed under the (more permissive) ISC license
  • Mostly conforming to relevant standards (POSIX, SUS), where applicable
    • Enhancements, non-standard behaviors, and new features are conservatively and sanely implemented with care taken to balance user expectations, complexity, and historical accuracy
  • Extensions such as bserase, cwerase, expandtab, imctrl, visibletab, globbrace, globdot, etc.
  • Build requires only GNU Make and standard POSIX utilities
    • Easy integration with embedded, minimal, or iteratively bootstrapped environments and distributions (such as Linux From Scratch builds)
  • No compile-time or build-time configuration options
    • Single standard build configuration with no incompatible variants
    • No configuration-specific bugs resulting from untested combinations or rarely exercised code paths
    • Concise and understandable documentation; no subtle platform variations
  • Consistent user interface, script, and map behavior across all platforms
  • Utilizes OpenBSD's extended Spencer-based regular expression engine (also adopted by LLVM, Tcl, etc.) on all supported systems
  • Single, compact, self-contained binary
    • No external data files required at run-time
    • No external library dependencies (other than curses)
      • Suitable for static linking and emergency “rescue” usage
  • All the various tweaks, fixes, improvements, and clean-ups accumulated over 25+ years as part of the OpenBSD base system

Why not?

So, why might you not want to use OpenVi, then?

Some of these points might be desirable features, depending on your point of view.

  • Internationalization support is currently lacking
    • No support for Unicode / UTF-8 / wide character display
      • Multibyte characters are shown as individual bytes, rather than glyphs
      • Multibyte support is planned, but is unfortunately non-trivial, see:
        • Schwarze, I. (2016, September 25). Keep multibyte character support simple [Conference presentation]. EuroBSDCon 2016 Convention, Belgrade, Serbia. [pdf:OpenBSD]
        • Jun-ichiro itojun Hagino [KAME Project] and Yoshitaka Tokugawa [WIDE Project]. (1999, 6 June). Multilingual vi clones: past, now and the future [Conference presentation]. In Proceedings of the annual conference on USENIX, Annual Technical Conference (USENIX ATEC '99). USENIX Association, Monterey, CA, USA, Page 45. [doi:10.5555/1268708.1268753], [abstract:USENIX] (legacy)
    • No support for bidirectional text
    • No support for regional localization or message translation
  • Inefficient handling of extremely large (e.g. multi-GB) files
  • No support for syntax highlighting, context-aware code completion, code folding, or “language server” integrations
  • No interactive macro recording and debugging functionality
  • No advanced scripting support (no BASIC, COBOL, JavaScript, Lua, Perl, PHP, Python, REXX, Ruby, S-Lang, Tcl, or anything else)
  • Only curses-based visual-mode and line-based ex-mode interfaces available
    • No support for X11/Wayland, OpenGL/Vulkan, Neuralink, augmented / virtual reality, or any other graphical user interfaces

Building

Prerequisites

Required prerequisites

  • POSIX.1-2008 environment: POSIX shell (sh) and utilities, Awk (mawk, nawk), etc.
  • GNU Make (version 3.81 or later)
  • C99 compiler (e.g. xlc, suncc, clang, gcc, etc.)
  • Curses (ncurses, NetBSD curses V8+, PDCurses V2.8+, PDCursesMod, etc.)

Optional prerequisites

  • pkg-config
  • Perl 5+
  • C shell (csh, tcsh, etc.)
  • nroff, groff, etc.

Supported platforms

  • OpenVi is easily portable to most platforms with UNIX-like operating systems that are mostly conforming to the programming interface described by IEEE Std 1003.1-2008 and user environment described by IEEE Std 1003.2-2008, also known as POSIX.1-2008 and POSIX.2-2008, respectively.

  • The following operating systems are fully supported and regularly tested using ix86/AMD64, ARM/AArch64, m68k, MIPS, POWER, and RISC-V processors:

    • IBM AIX 7.1+
    • Apple Darwin (macOS / Mac OS X) (ARM64, Intel, PowerPC)
    • FreeBSD 12.3+
    • GNU/Linux distributions (glibc, musl)
    • illumos OpenIndiana Hipster
    • NetBSD 9+
    • OpenBSD 6.9+
    • Oracle Solaris 11+
    • Microsoft Windows (Cygwin, Midipix, MSYS2, WSL)
    • Managarm
  • The following compilers are fully supported and regularly tested:

    • LLVM Clang (BSD, Darwin, illumos, Linux, Solaris, Windows) V6+
    • AMD Optimizing C/C++ (Linux) V3+
    • GNU GCC (AIX, BSD, Darwin, illumos, Linux, Solaris, Windows) V4.6+
    • IBM Advance Toolchain (Linux on POWER) V14.0+
    • IBM Open XL C/C++ (AIX) V17.1+
    • IBM XL C/C++ (AIX, Linux) V16.1+
    • Intel oneAPI DPC++/C++ (Linux) V2021+
    • Intel C Compiler Classic (Darwin, Linux) V19.1+
    • Oracle Developer Studio (Linux, Solaris) V12.6+
    • PCC Portable C Compiler (NetBSD) V1.0.0+

Newer or older operating system and compiler releases, within reason, should work. The versions listed above are those regularly tested and known working.

Unsupported platforms
  • The following platforms are not currently supported, but support is planned for a future release:
    • Haiku Walter
    • SGI IRIX

User contributions to enhance platform support are welcomed.

Compilation

  • Compilation can be performed by invoking GNU Make (usually gmake or make) from the top-level directory of a source release or git checkout.
  • GNU Make's -j N flag may be used to parallelize the compilation, where N is a positive integer representing the number of parallel jobs requested.
  • The following environment variables influence compilation and installation:
    • CC - C compiler to use
      • (e.g. CC=gcc)
    • OPTLEVEL - Optimization flags
      • (e.g. OPTLEVEL=-O2)
    • CFLAGS - Flags to pass to the C compiler
      • (e.g. CFLAGS="-Wall -pipe")
    • LIBS - Libraries (overriding defaults) to pass to the linker
      • (e.g. LIBS="-lpdcurses -lflock")
    • LDFLAGS - Flags to pass to the linker
      • (e.g. LDFLAGS="-L/lib/path -static")
    • V - Set to enable verbose compilation output
      • (e.g. V=1)
    • DEBUG - Set to compile a debugging build
      • (e.g. DEBUG=1)
    • LGC - Set to enable link-time garbage collection
      • (e.g. LGC=1)
    • LTO - Set to enable link-time optimization
      • (e.g. LTO=1)
    • EXTRA_LIBS - Extra libraries for linking
      • (e.g. EXTRA_LIBS=-lmtmalloc)
    • PREFIX - Directory prefix for use with install and uninstall targets
      • (e.g. PREFIX=/opt/OpenVi)
  • The usual targets (all, strip, superstrip, clean, distclean, install, install-strip, uninstall, upx, etc.) are available; review the GNUmakefile to see all the available targets and options.

For example, to compile an aggressively size-optimized build, enabling link-time optimization and link-time garbage collection, explicitly using GCC:

env CC=gcc OPTLEVEL=-Os LGC=1 LTO=1 gmake sstrip

or, to verbosely compile a debugging build, explicitly using Clang:

env CC=clang DEBUG=1 V=1 gmake

For systems with GNU Make as make (e.g. GNU/Linux), basic compilation should succeed without any options or additional configuration needed:

make

With the appropriate privileges to manipulate files within the chosen PREFIX (using doas, sudo, su, etc.), the compiled executable may be installed — as-is or stripped — using an invocation such as:

doas gmake install-strip

or

sudo env PREFIX=/usr/local make install

Platform Specifics

The following sections document only platform specific differences, and are not intended to be a general or exhaustive reference. For installation of prerequisite software packages or other system configuration, consult the vendor's documentation.

AIX
  • Before building OpenVi on AIX, install the ncurses libraries and headers. IBM provides the necessary packages, ncurses and ncurses-devel, in RPM format as part of the AIX Toolbox for Linux and Open Source Software. With the appropriate permissions (e.g. root), these packages are installable on most systems using the dnf or yum utilities, for example:

    dnf install ncurses ncurses-devel
    

    or

    yum install ncurses ncurses-devel
    

    The IBM AIX base system (and PASE for i, an integrated runtime environment for AIX applications on the IBM i operating system) provides libxcurses, an XPG4/XSI Extended Curses implementation derived from AT&T System V, which is not yet supported for use with OpenVi.

  • Compilation is supported using IBM XL C/C++ V16.1+ (gxlc or xlclang), IBM Open XL C/C++ V17.1+ (ibm-clang), or GNU GCC (usually gcc, gcc-8, gcc-9, gcc-10, gcc-11):

    • Link-time optimization (LTO=1) requires Open XL C/C++ V17.1+. The IBM (AIX Toolbox) and Bull/Atos (Bull Freeware) GCC packages, and IBM XL C/C++ versions earlier than V17.1 are not LTO-enabled.
    • Link-time garbage collection (LGC=1)

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Cbsdceditornvi

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具