Wednesday, August 03, 2011

Unix text editor with color highlighting


I use to edit all my config files or firewall rules using the great and powerful text editor "vi" which is bult-in in almost all UNIX flavors. Some times is boring editing large files or I get lost with a lot of comments..


I installed "vim" in FreeBSD and its like if I'm using vi but with more friendly features. I installed vim without using X by running the following command:


$ cd /usr/ports/editors/vim
$ make WITHOUT_X11=yes install clean


The WITHOUT_X11=yes option tells make to build vim without all the X11 dependencies which saves time compiling the port and saves space on disk. Once it finishes installing, you must add one line to the file .vimrc in order to enable the color highlighting:



$ cd ~/
$ echo "syntax on" >> ~/.vimrc


Vim recognizes many programming languages and configuration files or firewall rules like OpenBSD's pf. This tool its used by many experienced programmers, advanced sysadmins and bby anyone who wants to use a friendy view text editor. This image is from the example file pf.conf located in /usr/share/examples/pf/pf.conf




As you can see its a better look of the file..  Don't wait..  if you use vi, install vim and take a look at it, it has a lot of more features, check its web page.