t e c h i e - t a l k s ::: technology at its best

technology at its best

t e c h i e  -  t a l k s ::: technology at its best header image 2

How to: Enable syntax colouring in VIM

March 9th, 2008 · 1 Comment

The motivation for this “HOW-TO” started when I was doing some coding on my Ubuntu. Although some may prefer in-built text editors with syntax colouring like Gedit, I still prefer Vim for its ease in usage. This is just a simple how-to for those in need.

Vim had served me well before on Fedora but somehow the syntax colouring was disabled by default. What I did prior to enabling it permanently was to key in,

:syntax on

when I run Vim. Well, it wasn’t long until I got quite frustrated and tried looking for alternative ways to switch the syntax colouring to be ‘on’ by default.

First, you’ll need to find where your Vim program is installed.

$>whereis vim

On Gutsy, vim is usually installed in /etc/vim folder (note that vim can also be installed on your HOME folder). Go to the installed vim folder and look for a file named ‘vimrc’. Use your favourite text editor to open up the file.

$>sudo gedit vimrc

Look for the following line in the file:

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

Uncomment the ’syntax on’ line by removing the quote character and save the file. There you go! You’ll be greeted with colourful syntax from now on!

Beats debugging in black&white anytime!

 

 

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Tags: HOW TO guides

1 response so far ↓

  • 1 Wabbit // Apr 9, 2008 at 5:03 pm

    Thanks, it was helpful :)

Leave a Comment



Your Ad Here