The nvi text editor

Updated on .

nvi is a programmer’s text editor that runs inside of a terminal emulator, like the macOS Terminal.app. It descends from an early text editor named vi, and can only be controlled with the keyboard. Most fans of vi use vim, another descendent, which has seen decades of feature development and includes an entire programming language for extending its functionality, with thousands of plugins available. nvi’s limitations compared to “modern” editors like vim can seem crippling:

On the other hand, nvi does have some nice features:

In 2019, I stopped using neovim and tried out macOS GUI applications as my main text editor, eventually settling on Sublime Text. For the few terminal-based editing tasks that remained, I switched to nvi, since it felt responsive and familiar, having used vim for years. It only took a few days to finish Configuring the defaults of nvi to my preferences.

When I switched from vim, some things took getting used to. The undo command works differently under nvi: instead of typing u multiple times to continue undoing changes, uu will undo and then redo the change (the second u undoes the first). To undo multiple times, type the repeat last command . after the first u. For some reason, it’s impossible to backspace delete text that is already present in the file before the current insert mode switch. That text has to be changed or deleted in normal mode, once it’s been inserted.

Unfortunately, there is still some Missing nvi functionality that I haven’t been able to add, even with Modern nvi mappings.