Configuring the defaults of nvi

Updated on .

The nvi text editor’s settings are controlled in a ~/.nexrc startup file. Type :set all in the editor to see all of its options. Any caret followed by a letter was written by Entering control key chords into nvi.

Here’s my .nexrc file:

set autoindent
" command editor opens on (^V^R)
set cedit=^R
" extended regular expressions
set extended
" file completion on tab (^V^V^V<tab>)
set filec=^V	
set noflash
" case-insensitive searches unless upper-case
set iclower
set matchtime=1
" no read-only lock
set nolock
set path=.
set ruler
set searchincr
set showmatch
set tags=./TAGS
set tildeop
set windowname
" wrap through end of file when searching
set wrapscan

This is some boilerplate to make nvi behave as I’m used to from my experience with vim. There are more subjective settings:

set shell=/bin/sh
set shiftwidth=4
set tabstop=4
set wrapmargin=4