Enable syntax highlighting in vim with Ubuntu

by
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. Enable the backspace key in VIM
  2. Add new fonts to your Ubuntu system
  3. Enable HDMI output on Dell XPS M1530/M1330 with Ubuntu
  4. Install Unity on Ubuntu 10.10 Maverick
  5. Enable or disable boot time services in SUSE

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.