Tested on OpenBSD 6.3 and 6.4
On OpenBSD vi(1) is based on nvi 1.79, written by Keith Bostic.
You can’t record macros in nvi, but you still can use them. Add
a sequence of commands into a buffer (for example,
apply the macro as usual (with
To edit multiple files:
vi file1 file2, then
:ar[gs] to list them all.
To open one more file
:e[dit] file, then
^6 to alternate between
two, or use
To open in a split
:E[dit] file, then
^W to switch between windows,
and to set the window height to 20 lines
To scroll current line to the top
z<Enter>, to the center
and to the bottom of screen
z-. Scroll lines with
^E as usual.
To search for the “expression” and place the next occurence of it
to the center of screen:
Undo and redo: Press
u to undo previous edit, then press
to undo, to redo press
Increment a number: place cursor at the first digit and press
To redraw the screen press
If you miss Visual mode, try marks. For example, mark the line
mm, move to another line, then delete from the current
to the marked line with
d'm. Or copy to the buffer with
Break lines at column 72 in Insert and Append modes.
Format a paragraph with goal line length 72, allow indented paragraphs.
:?^$?,//!fmt -pw 72
Sort lines in a paragraph (in Command mode):
To remove trailing spaces:
To edit command-history:
<TAB> is the actual tab character: press
To read help:
If you need Unicode, use nvi2:
# pkg_add nvi ... nvi-2.1.3p1-iconv: ok #
Why vi Rocks,
vi command help guide by Jeff W.