Geeking Out

Syntax highlighting in Vim

In my recent frenzy for PHP programming, I’ve been using Vim as main text editor (it comes by default in Ubuntu, and in most Linux flavours actually)… I have been tempted to use many full featured applications but many more experienced developers advised me to stick to something simple – do it the hard way or just don’t do it :)

Vim offers a lot of possibilities when it comes to text file editing – and to master this tool requires years of practice (here is the official Vim book – about 570 pages). Anyways, since Vim doesn’t use syntax highlighting by default, here is a little guide to enable this feature:

  1. Open a terminal
  2. Edit the file /etc/vim/vimrc
  3. Search for the word “syntax” (in Vim, type in /syntax and hit return)
  4. Remove the double quote mark at the beginning of the line
  5. Start Vim and open any configuration file or PHP file, and you should see syntax highlighting

That’s it, you’re all set… Here is a screenshot of the result :)

Note: to install Vim, just copy and paste sudo apt-get install vim-full in your terminal

some posts that may be related

1 Comment

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Name*

Email* (Never displayed nor misused!)

Website

Spam protection: Sum of two + ten ?

*Required Fields