Having fun with FreeBSD on my Libretto this afternoon, I didn't have internet access to install Vim from ports so I decided to finally learn more about the bundled nvi editor. I missed syntax highlighting, but if you customise it right it's still a nice, lightweight, capable editor.
They’re similar, sort of, in some ways, kinda
Because Vim and nvi are both implementations of the classic vi/ex they have a number of functional similarities, but because nvi has been essentially static for licencing reasons in the BSDs and given Vim's continuous and rapid development, the gap between the two editors has been widening for quite some time. That was a needlessly long sentence.
Historians with complex flowcharts showing the origins of software would faint in horror at this assertion, but I like to think of nvi as a sort of "Vim-lite". In that context I don't fret about lost features, I just learn what they have in common and work with it, just like a guy with a scooter doesn't expect it to perform the same as his dad's Ducati. Does that make sense?
~/.vimrc, Nvi reads from the historically named
I like to include plenty of comments in my dotfiles, but as I learned from trial and error (and error, and error!) nvi is more picky about what you can include. You can't place comments on the same line as settings, and if you include a blank line anything below it is ignored!
This is part of my
~/.nexrc file, you can check out the full version on my dotfiles site if you're interested.
" GENERAL SETTINGS set columns=80 set secure " " I LIKE 2 SPACE INDENTATION set autoindent set shiftwidth=2 set tabstop=2 set ts=2 " " TELL ME WHEN I DO SOMETHING STUPID set errorbells set flash set verbose " " SHOW LINE NUMBERS, COLUMN/ROW POSITION set number set ruler " " ABBREVIATIONS abbr _aa This is The Tale, of Alan A'Dale abbr _bw The Bird is The Word abbr _gc Grilled cheese sandwiches abbr _nc #include <ncurses.h>
Why not just install Vim Ruben? Gosh!
Even if the first thing you do on a fresh system is install Vim, nano or another editor, because nvi is distributed with all the major BSDs by default it's a great idea to have a working knowledge of it. It's like a dependable friend :).