OpenVi: Portable OpenBSD vi for UNIX systems
Uma tradução em português está disponível.
OpenVi — Portable OpenBSD vi
/ ex
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 would you want to use OpenVi instead of AnotherVi?
strlcpy
, snprintf
, mkstemp
, pledge
)bserase
, expandtab
, imctrl
, visibletab
, etc.So, why might you not want to use OpenVi, then?
Some of these points might be desirable features, depending on your point of view.
ex
-mode interfaces available
sh
) and utilities,
Awk (mawk
, nawk
), etc.xlc
, suncc
, clang
, gcc
, etc.)ncurses
, NetBSD curses
V8+, PDCurses
V2.8+,
PDCursesMod
, etc.)csh
, tcsh
, etc.)nroff
, groff
, etc.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:
The following compilers are fully supported and regularly tested:
Newer or older operating system and compiler releases, within reason, should work. The versions listed above are those regularly tested and known working.
User contributions to enhance platform support are welcomed.
gmake
or make
)
from the top-level directory of a source release or git checkout.-j N
flag may be used to parallelize the compilation, where N
is a positive integer representing the number of parallel jobs requested.CC
- C compiler to use
CC=gcc
)OPTLEVEL
- Optimization flags
OPTLEVEL=-O2
)CFLAGS
- Flags to pass to the C compiler
CFLAGS="-Wall -pipe"
)LIBS
- Libraries (overriding defaults) to pass to the linker
LIBS="-lpdcurses -lflock"
)LDFLAGS
- Flags to pass to the linker
LDFLAGS="-L/lib/path -static"
)V
- Set to enable verbose compilation output
V=1
)DEBUG
- Set to compile a debugging build
DEBUG=1
)LGC
- Set to enable link-time garbage collection
LGC=1
)LTO
- Set to enable link-time optimization
LTO=1
)EXTRA_LIBS
- Extra libraries for linking
EXTRA_LIBS=-lmtmalloc
)PREFIX
- Directory prefix for use with install
and uninstall
targets
PREFIX=/opt/OpenVi
)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
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.
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
):
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.LGC=1
) is not supported on IBM
AIX.MAIXBITS
environment variable to
32
(e.g. export MAIXBITS=32
).CC
environment variable must be set to the full path
of the compiler (e.g. /opt/freeware/bin/gcc
,
/opt/IBM/xlC/16.1.0/bin/gxlc
, /opt/IBM/openxlC/17.1.0/bin/ibm-clang
,
etc.) unless the compiler directory is already part of the current PATH
.File locking (via flock()
as provided by the AIX libbsd
library) is
non-functional; this will be investigated and corrected in a future release.
OpenVi man pages are authored with mandoc
and require conversion
before use with the AIX man
software (which is derived from AT&T
UNIX System V.)
On NetBSD installations, the default OpenVi builds use the BSD
curses
library provided by the NetBSD base system. To use ncurses
instead, set the values of the CFLAGS
, LDFLAGS
, and CURSESLIB
environment variables appropriately (i.e. CFLAGS=-I/usr/pkg/include
LDFLAGS=-L/usr/pkg/lib
CURSESLIB=-lncurses
).
The LLVM LLD linker is required for link-time optimization (LTO=1
)
using Clang. It is available as an installable package (i.e. pkgin install lld
).
Before building OpenVi on an illumos distribution (i.e.
OpenIndiana), install the ncurses
libraries and headers. The
OpenIndiana distribution provides the necessary ncurses
package in
IPS format. With the appropriate permissions (e.g. root
), the package
can be installed using the OpenIndiana pkg
utility, for example:
pkg install ncurses
The OpenIndiana base system provides libcurses
, an XPG4/XSI
Extended Curses implementation derived from AT&T System V, which is not
yet supported for use with OpenVi.
Link-time garbage collection (LGC=1
) is not supported on
OpenIndiana.
Before building OpenVi on Oracle Solaris 11, install the
ncurses
libraries and headers. Oracle provides provides the necessary
ncurses
package for Solaris 11 in IPS format. With the appropriate
permissions (e.g. root
), the package can be installed using the Solaris
pkg
utility, for example:
pkg install ncurses
The base Oracle Solaris system provides libcurses
, 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 Oracle Developer Studio, GCC, and Clang:
suncc
or set the value of the _OSLCC
environment variable to 1
.LTO=1
) is currently supported only when using
GCC or Clang.LGC=1
) is not supported on Solaris.suncc
) compiler, a 64-bit
build is the default on systems operating in 64-bit mode; for a 32-bit
build, set the value of the SUNBITS
environment variable to 32
(e.g.
export SUNBITS=32
).File locking is unavailable due to the absence of flock()
on Solaris.
This will be addressed by supporting System V-style fcntl()
locking in a
future release.
apt-cyg
), which can result in
missing files and dangling or missing symbolic links.setup.exe
application to the latest available
version.setup.exe
application.make
, gcc
, ncurses
,
ncurses-devel
) using the Cygwin setup.exe
application.cygcheck
utility (i.e. cygcheck -cv | grep -v "OK$"
) to
verify the integrity of all currently installed packages.OpenVi is available to Linux and macOS users via the Homebrew package manager.
brew install openvi
Other (unofficial) distribution packages may be available.
The OpenVi version number is based on the version of the corresponding
OpenBSD release, followed by the OpenVi release number. The version
command can be used to display this information in the format shown below.
Version 7.0.1 (OpenVi) 10/25/2021.
This message indicates the editor in use is OpenVi, release 1,
derived from OpenBSD version 7.0, and is fully synchronized with the
OpenBSD versions of vi
, ex
, db
, and regex
as of 10/25/2021 (October 25th 2021).
Changes not derived from OpenBSD commits do not advance this date. New OpenBSD releases do not reset the OpenVi release number.
OpenVi
OpenBSD vi
vi
/ ex
db
regex
LICENSE.md
file for the full license and
distribution terms.vi
acknowledgements (by Bill Joy & Mark Horton):
Xvi
, an enhanced
fork of Tim Thompson's STEVIE
Sivle
, a
cleaned-up fork of Steve Kirkendall's
Elvis
Vim57
, a
simplified fork of version 5.7 of Bram Moolenaar's
Vim
vi
is a currently maintained fork of the original (1BSD/2BSD) branch
of the vi
/ ex
editor, derived from Gunnar Ritter's enhanced
version of the traditional vi
editor.Nvi2
is a currently maintained
feature branch of the new (4BSD) version of the nvi
/ nex
editor, with a focus on extensibility and new features.Nvi1
(version 1.8+) is the
currently maintained traditional branch of the new (4BSD) version of
the nvi
/ nex
editor, now developed by Sven Verdoolaege.