views:

1454

answers:

3

The CSS syntax highlighting in vim is not entirely optimal. For example:

div.special_class

stops the highlighting at the _.

Is there an improved highlighter that doesn't bite on an underscore?

Update: I'm using VIM - Vi IMproved 7.1 (2007 May 12, compiled Jun 17 2008 15:22:40)

and the header of my css.vim is:

" Vim syntax file
" Language:     Cascading Style Sheets
" Maintainer:   Claudio Fleiner <[email protected]>
" URL:          http://www.fleiner.com/vim/syntax/css.vim
" Last Change:  2006 Jun 19
" CSS2 by Nikolai Weibull
" Full CSS2, HTML4 support by Yeti
A: 

What version of vim are you using?

My css.vim is

" Vim syntax file
" Language: Cascading Style Sheets
" Maintainer:   Claudio Fleiner <[email protected]>
" URL:   http://www.fleiner.com/vim/syntax/css.vim
" Last Change:  2005 Nov 23
" CSS2 by Nikolai Weibull
" Full CSS2, HTML4 support by Yeti

as shipped with vim 7.0, and it does not expose the behaviour you described.

Tomalak
same problem (vim 7.1.138, Ubuntu)" Vim syntax file" Language: Cascading Style Sheets" Maintainer: Claudio Fleiner <[email protected]>" URL: http://www.fleiner.com/vim/syntax/css.vim" Last Change: 2006 Jun 19" CSS2 by Nikolai Weibull" Full CSS2, HTML4 support by Yeti
Ken
A: 

I'm seeing the same behaviour (Vim 7.1.138 on Ubuntu Hardy Heron):

" Vim syntax file
" Language:     Cascading Style Sheets
" Maintainer:   Claudio Fleiner <[email protected]>
" URL:          http://www.fleiner.com/vim/syntax/css.vim
" Last Change:  2006 Jun 19
" CSS2 by Nikolai Weibull
" Full CSS2, HTML4 support by Yeti
Ken
+3  A: 

I don't have that problem. This is the header of my syntax file:

" Vim syntax file
" Language: Cascading Style Sheets
" Maintainer:   Claudio Fleiner <[email protected]>
" URL:   http://www.fleiner.com/vim/syntax/css.vim
" Last Change:  2007 Nov 06
" CSS2 by Nikolai Weibull
" Full CSS2, HTML4 support by Yeti

The relevant line of the syntax file, is this:

syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+"
SpoonMeiser
That URL seems to be referreing to the 2006 Jun 19 version. But changing that line fixed it. Thanks!
MDCore
Where did you get that syntax file btw?
MDCore
It's the version of vim in Debian unstable, 7.2.025-1. In the vim-runtime package.
SpoonMeiser