How to install vim on FreeBSD

In this tutorial I will show you how to install vim on FreeBSD 9.0 and set it as a default editor:

By default, FreeBSD has only vi and gedit, which are both awful.

Use only one of the following installations. I recommand you to install packages with pkg_add because it is easier and faster, but you can also make installations from ports:

Installing vim with pkg_add:

# pkg_add -r vim-lite

Installing vim from ports:

Updating the ports :
# portsnap fetch update

Finding and instaling vim from ports:

# whereis vim
vim: /usr/ports/editors/vim
# cd /usr/ports/editors/vim
# make install clean
# rehash

Setting vim as default browser

Set both the EDITOR and the VISUAL variables with the same value in order not to have problems with the programs using the default text editor.

For the csh based shells add the following lines to the shell’s configuration file (~/.cshrc for the csh and tcsh shells):

setenv EDITOR /usr/local/bin/vim
setenv VISUAL /usr/local/bin/vim

For the sh based shells add the following lines to the user’s shell configuration file (~/.bashrc for bash, ~/.kshrc for the korn shell and ~/.zshrc for the Z shell):

export EDITOR=/usr/local/bin/vim
export VISUAL=/usr/local/bin/vim

Tagged with: , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

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




Subscribe to get the latest Linux news and how to guides directly on your e-mail!