Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My students get syntax coloring in vim, but I don't!

Even when I "syntax on" as a command syntax on or put it in my .vimrc and/or .exrc.

The terminal is xterm.

I am missing something in vim or is there something in my .profile -- it has been growing for 30 years... And I've been hacking at this problem for a year.

Thanks for listening

share|improve this question
Are you all using the same machine? Do you get syntax coloring if you run \vim -u /dev/null and run :syntax on? Are the tildes blue, by the way? Do you get colors in the same terminal with other programs, e.g. ls --color? – Gilles May 3 '12 at 23:53
Also, what does tput colors (from the shell) print? What about :echo has("syntax") inside vim? – Mikel May 4 '12 at 2:56
I do get colors in ls and colored tilders and numbers in vi/vim.@ Gilles. I ran tput colors and got the output 8..... And now I have colors in vim! WTF! – Richard John Botting May 7 '12 at 21:56
OK. Got it. Two versions of "vi". /bin/vi and /usr/bin/vim.And I'm old enough to type 'vi' rather than 'vim'. – Richard John Botting May 7 '12 at 22:36
I added alias vi='vim' so I can't type vi. Not without overriding the alias. I'd only typed 'vi' once or twice before adding the alias to my .bashrc, but it sure is jarring to not see my familar colors and setup. – lornix Jul 9 '12 at 11:44

The right command is this one :

:syntax enable
share|improve this answer
:syntax on has worked perfectly well on every machine I've used. Do you have a citation for enable being better? – Kevin Jun 9 '12 at 1:38
And I always used enable, just learned the existence of "on" here ! In fact after typing :help syntax-on I saw it worked. just do :help syntax-enable to see it's ok too. The differences I see (after test) is that "enable" allow to use different syntax highlighter as the automatic detection made with the file extension, while "syntax on" didn't. To test : open vim for a file called "sample", and one other "sample.txt", you will see the difference – Asenar Jun 9 '12 at 14:15
I saw that, on is the same unless you have some particular customization. That's not the problem here (he actually solved the problem, see the last comment on the question). – Kevin Jun 9 '12 at 14:20
:sy on is shorter – Alexander Jul 11 '13 at 9:21

Check the output for dpkg -l | grep vim. Either vim-gtk for Kubuntu or vim-gnome should be in the list, otherwise you're probably working with vim-tiny which doesn't support syntax highlighting.

To solve it:

  • On Kubuntu: apt-get install vim-gtk
  • On Ubuntu apt-get install vim-gnome
share|improve this answer
If you work only with vim and not with gvim, installing vim-nox would be enough. However, if you want to access the X clipboard in vim, you need to install either vim-gtk or vim-gnome. – jofel May 4 '12 at 9:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.