vi, vim and nvi on FreeBSD

On FreeBSD, vi text editor won’t show the mod by default. Also it work differently from vi in linux. To get FreeBSD vi display the mod, you can enter

:set showmod

But doing this every time is difficult. Solution for this is, create a .exrc file with following content

set number
set ruler
set verbose
set showmode
set showmatch
set shiftwidth=4
set autoindent

You can remove any of the entries, just experiment with it and find out which one suit your style of editing 🙂

vi on FreeBSD is not vi on Linux, it is another program called nvi.

vi is symlink to nvi, you can find them at


“vim” you can install ut from ports.

But it behave totally different from that in Linux, i don’t know why.

But all these vi, nvi and vim uses the file .exrc on start up.

FreeBSD uses csh (c shell) and linux use bash, you can find which shell you are using by the command

echo $SHELL

I think the change in “vi” behaviour in linux and freebsd may be because of these different shells.

Posted in Uncategorized. Bookmark the permalink.