Sunday, May 25, 2008

How to enable vim syntax highlighting on ubuntu 8.04

Problem:
vim has no syntax highlighting on ubuntu 8.04.

Additional symptoms:

Error detected while processing /home/marky/.vimrc:
line 21:
E319: Sorry, the command is not available in this version: syntax enable
Press ENTER or type command to continue


Solution:

Step1: Install the full version of vim:

prompt%> sudo apt-get install vim-full


Step2-A: Edit system-wide settings to enable syntax highlighting.

prompt%> sudo vi /etc/vim/vimrc

Remove the double-quote on the "syntax on" line

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on



OR


Step2-B: Make changes only for your account.

prompt%> cp /etc/vim/vimrc ~/.vimrc
prompt%> vi ~/.vimrc

Remove the double-quote on the "syntax on" line

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on



All done! Enjoy!

2 comments:

Anonymous said...

Very nice. I use Vi like mad and it was driving me nuts.

Anonymous said...

Thank you!