sponsor Vim development Vim logo Vim Book Ad

css3 mod : Enhanced version of CSS syntax highlighting script for vim, supports for CSS3

 script karma  Rating 11/7, Downloaded by 3749  Comments, bugs, improvements  Vim wiki

created by
fremff ff
script type

The script is based on the original css syntax file : http://fleiner.com/vim/syntax/css.vim ,
and support for CSS3 syntax highlighting .
This script include many of CSS3 Property,Attribute and Selector ,
and the prefix " -moz-,-webkit- ,-o-,-ms- " support ,
and complete the At-rule groups , see the https://developer.mozilla.org/en-US/docs/CSS/At-rule .
Also , it support the beautify CSS feature , you can use it to by the :CSSBeautify command .


As a optional, "css_default_sync" argument can be used for switch the syntax synchronization settings.
By default, to use "syn sync minlines=2000" as setting of synchronization. If you have a slow machine,
so, you can use the following option(to use "syn sync maxlines=200"):

let g:css_default_sync == 1

For the CSSBeautify command :

/* Original */


body{ width:680px ;
box-shadow: -1px 1px 3px #DDD;
padding: 10px
.class #id{border-radius:0px!important;}

/* After the command execution */


body {
width: 680px ;
background-color: #FFF ;
box-shadow: -1px 1px 3px #DDD ;
padding: 10px ;
a:nth-of-type(2n) {
background-color: #FFF !important;
.class #id {
border-radius: 0px !important;


Github repositories:
First - https://github.com/fremff/vim-css-syntax
Second - https://github.com/vim-scripts/css3-mod

install details
Put the css.vim to ~/.vim/syntax ,or $Vim/vimfiles/syntax

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
css.zip 1.3.0 2013-05-08 7.0 fremff ff add a option to switch the syntax sync setting,
add more properties and it's values,
fix bugs.
more changes, see the link : https://github.com/fremff/vim-css-syntax/commits/master
css.zip 1.2.5 2013-04-20 7.0 fremff ff Adjustment part *. Prop, * .Attr items prefix
at-rule gorup fine-tuning and remove some of the items skipnl parameters
For the cssCharset syntax group,  remove cssCharsetString syntax item, and
cssPseudoClasses syntax cluster changed its name to cssPseudo, and  added the syntax cssPseudoElement item
Fixed the bug for the CSSBeautify command, this command should not match that included in the regex () of
"{" or"}"
Continue to adjust the the syntax highlight file structure
css.zip 1.2.0 2013-04-17 7.0 fremff ff This update includes many improvements:
Adjust the syntax file structure
Add more properties,Attribute and selector
Add CSS files beautification features, use : CSSBeautify command
Bug fixes, etc.
css.zip 1.0 2013-01-28 7.0 fremff ff add a new "supports" group,
fixed some bugs
css.zip 0.98 2012-10-30 7.0 fremff ff Fixed some At-rule groups bugs,
Add a new At-rule group KeyFrame,
Some minor changes
css.zip 0.95 2012-10-21 7.0 fremff ff fixed some bugs,adjust the position of the syntax group,and some minor changes
css.zip 0.91 2012-09-23 7.0 fremff ff New added "cssDocument" and "cssNameSpace" at-rule groups,
added some  Attr item,
and some small fixed

Fixed a bug of "cssNameSpace" group  
css.zip 0.71 2012-09-07 7.0 fremff ff fixed bugs,adjust the prefix,and added a new highlight group "cssPseudoElement"
css.zip 0.50 2012-08-28 7.0 fremff ff A few little fixed ,a many minor changes,and a small amount of prefix change
css.zip 0.30 2012-06-07 7.0 fremff ff Added more "attribute",and some  "pseudoclassid"
Some small fixes
css.zip 0.15 2012-06-02 7.0 fremff ff Update a little "keyword",
some minor adjustments
css.zip 0.1 2012-05-31 7.0 fremff ff Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.