May
11

CSS Syntax highlighting in nano

If your server’s version of nano doesn’t have syntax highlighting for CSS you can turn it on yourself.

Just edit your nano config file (which may not exist yet):

nano -w ~/.nanorc

And add the following:

syntax “css” “\.css$”
color brightred “.”
color brightyellow start=”\{” end=”\}”
color brightwhite start=”:” end=”[;^\{]“
color brightblue “:active|:focus|:hover|:link|:visited|:link|:after|:before|$”
color brightblue start=”\/\*” end=”\\*/”
color green “;|:|\{|\}”

 

Save and exit. The next time you open a .css file your code will be highlighted.

Tip courtesy of the nanosyntax project where you can also find code for HTML and lots of other file types.

Leave a comment

Sponsored links