HostOnNet Blog

vi, vim and nvi on FreeBSD

Looking for Linux Server Admin or WordPress Expert? We can help.

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

/usr/bin/vi
/usr/bin/nvi

“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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.