Improving CSS syntax highlighting in vim

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

div.special_class

stops the selection on _.

Is there an improved marker that does not bite the underscore?

Update: I am using VIM-Vi IMproved 7.1 (2007 May 12, compiled 06/17/2008 15:22:40)

and the title of my css.vim:

" Vim syntax file
" Language:     Cascading Style Sheets
" Maintainer:   Claudio Fleiner <claudio@fleiner.com>
" URL:          http://www.fleiner.com/vim/syntax/css.vim
" Last Change:  2006 Jun 19
" CSS2 by Nikolai Weibull
" Full CSS2, HTML4 support by Yeti
+3
source share
2 answers

I do not have this problem. This is the header of my syntax file:

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

Corresponding syntax file line:

syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+"
+5
source

What version of vim are you using?

My css.vim

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

shipped with vim 7.0 and does not reveal the behavior you described.

+1
source

Source: https://habr.com/ru/post/1698242/


All Articles