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 onwhen 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 vimOn 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 vimrcLook 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!






1 response so far ↓
1 Wabbit // Apr 9, 2008 at 5:03 pm
Thanks, it was helpful
Leave a Comment