Enable syntax highlighting in vim with Ubuntu

by
Ryan
on
January 14, 2009

Many distributions have syntax highlighting in vim enabled with their default installation. In Ubuntu as well as other Debian based distributions, this is not the case. By default Ubuntu installs the vim-tiny package which does not support syntax highlighting or many other advanced features.

You can see by following the chain of symlinks that in the default installation vim calls vim.tiny.

$ which vim
/usr/bin/vim

/usr/bin/vim -> /etc/alternatives/vim -> /usr/bin/vim.tiny

If you want additional features including syntax highlighting you need to install the vim package.

$ sudo apt-get install vim

Now vim uses vim.basic which is what we want. This version supports all the advanced features.
/usr/bin/vim -> /etc/alternatives/vim -> /usr/bin/vim.basic

The last step is to actually enable syntax highlighting.

To enable it for a single session go into command mode and enter this command:

:syn on

Make these changes permanent for every vim session by opening or creating the .vimrc configuration file in your home directory.
/home/username/.vimrc

Insert the following lines.

if has ("syntax")
        syntax on
endif
1 Comment
ubuntu
, , , , , , ,

Related posts:

  1. Install Boxee on 64-bit Ubuntu 9.10 Karmic
    Installing Boxee turns your computer into an incredible HTPC. These instructions will help you get...

Comments (1)

THANX
(Im just new in Linux system and this helped me :) )

Trackbacks (0)

No trackbacks yet

Leave a Comment

(displayed with your post)
(will not be published)
(optional)
Copyright 2008-2010 WiredRevolution.com. All rights reserved.