changeset 540:50fd59a959ea

Add support for lesscss.
author edogawaconan <me@myconan.net>
date Tue, 06 Jan 2015 03:25:01 +0900
parents 05785a85d603
children 5cdef8f4360f
files rc/vimrc update-vim-syntax vendor/vim-syntax/less.vim
diffstat 3 files changed, 66 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rc/vimrc	Mon Jan 05 23:00:11 2015 +0900
+++ b/rc/vimrc	Tue Jan 06 03:25:01 2015 +0900
@@ -94,6 +94,7 @@
   autocmd BufRead,BufNewFile .git/config :set noet
   autocmd BufRead,BufNewFile *.coffee :set ft=coffee
   autocmd BufRead,BufNewFile *.erb :set ft=eruby
+  autocmd BufRead,BufNewFile *.less :set ft=less
   autocmd BufRead,BufNewFile *.scss :set ft=scss
   autocmd BufRead,BufNewFile *.slim :set ft=slim
   autocmd BufRead,BufNewFile *.blade.php :set ft=blade
--- a/update-vim-syntax	Mon Jan 05 23:00:11 2015 +0900
+++ b/update-vim-syntax	Tue Jan 06 03:25:01 2015 +0900
@@ -19,3 +19,4 @@
 _get https://github.com/slim-template/vim-slim/raw/master/syntax/slim.vim
 _get https://github.com/elzr/vim-json/raw/master/syntax/json.vim
 _get https://raw.githubusercontent.com/xsbeats/vim-blade/master/syntax/blade.vim
+_get https://raw.githubusercontent.com/groenewege/vim-less/master/syntax/less.vim
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/vim-syntax/less.vim	Tue Jan 06 03:25:01 2015 +0900
@@ -0,0 +1,64 @@
+if exists("b:current_syntax")
+  finish
+endif
+
+runtime! syntax/css.vim
+runtime! after/syntax/css.vim
+" load files from vim-css3-syntax plugin (https://github.com/hail2u/vim-css3-syntax)
+runtime! after/syntax/css/*.vim
+
+syn case ignore
+
+syn region lessDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssTagName,cssPseudoClass,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,lessDefinition,lessComment,lessClassChar,lessVariable,lessMixinChar,lessAmpersandChar,lessFunction,lessNestedSelector,@cssColors fold
+
+syn match lessVariable "@[[:alnum:]_-]\+" contained
+syn match lessVariable "@[[:alnum:]_-]\+" nextgroup=lessVariableAssignment skipwhite
+syn match lessVariableAssignment ":" contained nextgroup=lessVariableValue skipwhite
+syn match lessVariableValue ".*;"me=e-1 contained contains=lessVariable,lessOperator,lessDefault,cssValue.*,@cssColors "me=e-1 means that the last char of the pattern is not highlighted
+
+syn match lessOperator "+" contained
+syn match lessOperator "-" contained
+syn match lessOperator "/" contained
+syn match lessOperator "*" contained
+
+syn match lessNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,lessAmpersandChar,lessVariable,lessMixinChar,lessFunction,lessNestedProperty
+syn match lessNestedProperty "[[:alnum:]]\+:"me=e-1 contained
+
+syn match lessDefault "!default" contained
+
+syn match lessMixinChar "\.[[:alnum:]_-]\@=" contained nextgroup=lessClass
+syn match lessAmpersandChar "&" contained nextgroup=lessClass,cssPseudoClass
+syn match lessClass "[[:alnum:]_-]\+" contained
+
+" functions {{{
+
+" string functions
+syn keyword lessFunction escape e % containedin=cssDefinition contained
+" misc functions
+syn keyword lessFunction unit containedin=cssDefinition contained
+" math functions
+syn keyword lessFunction ceil floor percentage round containedin=cssDefinition contained
+" color definition
+syn keyword lessFunction rgb rgba argb hsl hsla hsv hsva containedin=cssDefinition contained
+" color channel information
+syn keyword lessFunction hue saturation lightness red green blue alpha luma containedin=cssDefinition contained
+" color operations
+syn keyword lessFunction saturate desaturate lighten darken fadein fadeout fade spin mix greyscale contrast containedin=cssDefinition contained
+" color blending
+syn keyword lessFunction multiply screen overlay softlight hardlight difference exclusion average negation containedin=cssDefinition contained
+
+" }}}
+
+syn match lessComment "//.*$" contains=@Spell
+
+hi def link lessVariable Special
+hi def link lessVariableValue Constant
+hi def link lessDefault Special
+hi def link lessComment Comment
+hi def link lessFunction Function
+hi def link lessMixinChar Special
+hi def link lessAmpersandChar Special
+hi def link lessNestedProperty Type
+hi def link lessClass PreProc
+
+let b:current_syntax = "less"