TIL #OpenBSD nvi can do split window... Thanks @romanzolotarev!"
— ParadeGrotesque (@ParadeGrotesque)
On OpenBSD vi(1) is actually nvi based on version 1.79, written by Keith Bostic.
For several Vim features, I couldn't find any workarounds and really miss them:
Insert-mode completion, text objects, viminfo (save command history, marks, registers), search for words under the cursor.
For some features, I managed to find workarounds.
For example, for rare cases when I need Unicode, I use nvi2:
# pkg_add nvi
Instead of syntax highlighting, I use cleaner formatting and linters,
but I understand that this may not work for
I've replaced some features with utilities and shell scripts:
|Vim feature||nvi workaround|
|text formatting (
|extended search patterns||
|scripts and expressions||
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.
To open in a split
:E[dit] file, then
^W to switch between windows,
and to set the window height to 20 lines
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, then move to the line you need, then delete from
the current to the marked line 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:
To read help:
Tested on OpenBSD 6.3