From 3b16cb33d520c64e139f2e79f0825d8446e27527 Mon Sep 17 00:00:00 2001 From: Maxim Date: Sat, 18 Apr 2020 03:12:01 -0400 Subject: [PATCH] add less and css support --- autoload/sass-colors.rb | 2 +- autoload/vim_sass_colors.vim | 4 ++-- ftplugin/css.vim | 5 +++++ ftplugin/less.vim | 5 +++++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 ftplugin/css.vim create mode 100644 ftplugin/less.vim diff --git a/autoload/sass-colors.rb b/autoload/sass-colors.rb index bebb57e..6abbd69 100644 --- a/autoload/sass-colors.rb +++ b/autoload/sass-colors.rb @@ -431,7 +431,7 @@ CSS_COLORS_INVERSE[v] = k end -prefix_regex = /\/(?:stylesheets|sass|scss|style|styles)\// +prefix_regex = /\/(?:stylesheets|sass|scss|less|style|styles)\// if ENV['VIM_SASS_COLORS_BASE_FOLDERS'] prefix_regex = /\/(?:#{ENV['VIM_SASS_COLORS_BASE_FOLDERS'].split(',').join('|')})\// end diff --git a/autoload/vim_sass_colors.vim b/autoload/vim_sass_colors.vim index 465d90e..df39870 100644 --- a/autoload/vim_sass_colors.vim +++ b/autoload/vim_sass_colors.vim @@ -66,8 +66,8 @@ function! vim_sass_colors#run() " only add $variable name to group if l:cname != 'placeholder' - let l:new_match = matchadd(l:group, '\v\$'.l:cname.'([^a-zA-Z0-9-_])@=') - let l:new_match2 = matchadd(l:group, '\v\$'.l:cname.'($)@=') + let l:new_match = matchadd(l:group, '\v[$@]'.l:cname.'([^a-zA-Z0-9-_])@=') + let l:new_match2 = matchadd(l:group, '\v[$@]'.l:cname.'($)@=') call add(w:vim_sass_color_matches, l:new_match) call add(w:vim_sass_color_matches, l:new_match2) endif diff --git a/ftplugin/css.vim b/ftplugin/css.vim new file mode 100644 index 0000000..cb82d58 --- /dev/null +++ b/ftplugin/css.vim @@ -0,0 +1,5 @@ +if exists("w:did_vim_sass_colors") + finish +endif +let w:did_vim_sass_colors = 1 +call vim_sass_colors#init() diff --git a/ftplugin/less.vim b/ftplugin/less.vim new file mode 100644 index 0000000..cb82d58 --- /dev/null +++ b/ftplugin/less.vim @@ -0,0 +1,5 @@ +if exists("w:did_vim_sass_colors") + finish +endif +let w:did_vim_sass_colors = 1 +call vim_sass_colors#init()