This is a long hint, but only because I've put in a lot of words to help people unfamiliar with installing software. I found the installation really quite easy and quick to do.
Download nvi (e.g., nvi-1.79.tar.gz) from a suitable web site. I used the Vi homepage/ (use the "Download the Vi editor" link at the bottom of the page). Uncompress it in the Terminal by typing:
tar -xvzf nvi-1.79.tar.gz
This creates the directory nvi-1.79 (the numbers in the tar file and in the directory it creates will be different if you install a difference release of nvi). I recommend that you read the FAQ, LAYOUT, LICENSE, and README in that directory, and README in the build subdirectory.
When you are ready to install, go into the build subdirectory (all further commands will be run from here) and type:
cd nvi-1.79/build
./configure
You will probably see a few messages and then this one:
checking host system type... configure: error: can not guess host type; you must specify one
This means that the configure script can't work out exactly what operating system you are running. To fix that, do these two commands:
sudo cp /usr/share/automake-1.6/config.sub .
sudo cp /usr/share/automake-1.6/config.guess .
Note the space and full stop at the end of the commands (for an explanation of what this does, see my reply dated May 8 '04 to this hint). NOTE: If you get a different error, then you should stop following these instructions and fix the error yourself. Sorry! Now run configure again:
./configure
This time, a lot of output lines should appear. If they all start with loading, checking, updating, and creating, all is well. If you get another error message, then you should stop following these instructions and fix the error. I didn't get any other errors. When configure has run successfully, enter this command:
make
You will see a lot of code appearing in the output (e.g., cc -c -O -I. -I./../include -I./../regex). This is okay! You will probably also see some messages containing warning:... -- they are probably not anything you need to be concerned about (I did not have to do anything about them to get nvi to work for me). The last two lines of output from the make command will probably be:
rm -f nex
ln nvi nex
If you see an error message instead, then stop following these instructions and fix the error. When make has run successfully, enter this command (you must use sudo):
sudo make install
You will probably see a few lines of code ending with these lines:
[ -f VI.pm ] && /bin/cp VI.pm /usr/local/share/vi/perl &&
cd /usr/local/share/vi/perl && /bin/chmod 444 VI.pm)
/bin/sh: -c: line 1: syntax error near unexpected token `)'
/bin/sh: -c: line 1: `[ -f VI.pm ] && /bin/cp VI.pm /usr/local/share/vi/perl && cd /usr/local/share/vi/perl && /bin/chmod 444 VI.pm)'
make: *** [install_common] Error 2
This looks scary, but don't worry. However before proceeding further, make sure that your output DOES end with lines very similar to those -- if you have a different error message, stop and fix the error. The output lines above are saying that there's an unexpected bracket ')' in the file called Makefile. Even when I tried to fix that precise problem, I still got an error because the VI.pm file didn't exist. This is a Perl module and appears to NOT be necessary for nvi to work. I fixed this problem by CAREFULLY editing the file called Makefile:- Open Makefile in a text editor.
- Search for the characters VI.pm. You will find these two lines:
[ -f VI.pm ] && $(cp) VI.pm $(datadir)/vi/perl && cd $(datadir)/vi/perl && $(chmod) $(fmode) VI.pm)
- Comment out those lines by placing a # symbol in front of them:
# [ -f VI.pm ] && $(cp) VI.pm $(datadir)/vi/perl && # cd $(datadir)/vi/perl && $(chmod) $(fmode) VI.pm)
- You should not change ANYTHING else in that file!
- Save the file (overwriting the existing version).
/usr/local/bin/vi name_of_file_to_edit
At this stage, you can probably still run vim /path.... If you do NOT see that, then do NOT follow the rest of this hint unless you are sure you know what you are doing. Enter these two commands (you must use sudo):
sudo rm /usr/bin/vi
sudo ln -s /usr/local/bin/vi /usr/bin/vi
You can now use nvi by typing vi name_of_file_to_edit. You should still be able to use vim at any time with:
/usr/bin/vim name_of_file_to_edit
[robg adds: I haven't tested this one. Another method for typing vi instead of nvi would be to just create an alias in your shell startup file -- this is probably safer. In tcsh, it'd be something like alias vi /usr/local/bin/vi.]