mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2026-02-25 19:17:26 +08:00
Support third party scss plugins
This commit is contained in:
@@ -37,6 +37,8 @@ let s:use_pug = exists("g:vim_vue_plugin_use_pug")
|
|||||||
\ && g:vim_vue_plugin_use_pug == 1
|
\ && g:vim_vue_plugin_use_pug == 1
|
||||||
let s:use_sass = exists("g:vim_vue_plugin_use_sass")
|
let s:use_sass = exists("g:vim_vue_plugin_use_sass")
|
||||||
\ && g:vim_vue_plugin_use_sass == 1
|
\ && g:vim_vue_plugin_use_sass == 1
|
||||||
|
let s:use_scss = exists("g:vim_vue_plugin_use_scss")
|
||||||
|
\ && g:vim_vue_plugin_use_scss == 1
|
||||||
let s:use_stylus = exists("g:vim_vue_plugin_use_stylus")
|
let s:use_stylus = exists("g:vim_vue_plugin_use_stylus")
|
||||||
\ && g:vim_vue_plugin_use_stylus == 1
|
\ && g:vim_vue_plugin_use_stylus == 1
|
||||||
let s:use_coffee = exists("g:vim_vue_plugin_use_coffee")
|
let s:use_coffee = exists("g:vim_vue_plugin_use_coffee")
|
||||||
@@ -84,6 +86,11 @@ if s:use_sass
|
|||||||
runtime! indent/sass.vim
|
runtime! indent/sass.vim
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if s:use_scss
|
||||||
|
unlet! b:did_indent
|
||||||
|
runtime! indent/scss.vim
|
||||||
|
endif
|
||||||
|
|
||||||
if s:use_stylus
|
if s:use_stylus
|
||||||
unlet! b:did_indent
|
unlet! b:did_indent
|
||||||
runtime! indent/stylus.vim
|
runtime! indent/stylus.vim
|
||||||
@@ -163,11 +170,20 @@ function! GetVueIndent()
|
|||||||
elseif s:SynSASS(cursyn)
|
elseif s:SynSASS(cursyn)
|
||||||
call vue#Log('syntax: sass')
|
call vue#Log('syntax: sass')
|
||||||
let ind = GetSassIndent()
|
let ind = GetSassIndent()
|
||||||
|
elseif s:SynSCSS(cursyn)
|
||||||
|
call vue#Log('syntax: scss')
|
||||||
|
if exists('*GetSCSSIndent')
|
||||||
|
call vue#Log('indent: scss')
|
||||||
|
let ind = GetSCSSIndent()
|
||||||
|
else
|
||||||
|
call vue#Log('indent: css')
|
||||||
|
let ind = GetCSSIndent()
|
||||||
|
endif
|
||||||
elseif s:SynStylus(cursyn)
|
elseif s:SynStylus(cursyn)
|
||||||
call vue#Log('syntax: stylus')
|
call vue#Log('syntax: stylus')
|
||||||
let ind = GetStylusIndent()
|
let ind = GetStylusIndent()
|
||||||
elseif s:SynStyle(cursyn)
|
elseif s:SynStyle(cursyn)
|
||||||
call vue#Log('syntax: style')
|
call vue#Log('syntax: css')
|
||||||
let ind = GetCSSIndent()
|
let ind = GetCSSIndent()
|
||||||
else
|
else
|
||||||
call vue#Log('syntax: javascript')
|
call vue#Log('syntax: javascript')
|
||||||
@@ -228,6 +244,10 @@ function! s:SynSASS(syn)
|
|||||||
return a:syn ==? 'sassVueStyle'
|
return a:syn ==? 'sassVueStyle'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:SynSCSS(syn)
|
||||||
|
return a:syn ==? 'cssScssVueStyle'
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:SynStylus(syn)
|
function! s:SynStylus(syn)
|
||||||
return a:syn ==? 'cssStylusVueStyle'
|
return a:syn ==? 'cssStylusVueStyle'
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ let s:use_less = exists("g:vim_vue_plugin_use_less")
|
|||||||
\ && g:vim_vue_plugin_use_less == 1
|
\ && g:vim_vue_plugin_use_less == 1
|
||||||
let s:use_sass = exists("g:vim_vue_plugin_use_sass")
|
let s:use_sass = exists("g:vim_vue_plugin_use_sass")
|
||||||
\ && g:vim_vue_plugin_use_sass == 1
|
\ && g:vim_vue_plugin_use_sass == 1
|
||||||
|
let s:use_scss = exists("g:vim_vue_plugin_use_scss")
|
||||||
|
\ && g:vim_vue_plugin_use_scss == 1
|
||||||
let s:use_stylus = exists("g:vim_vue_plugin_use_stylus")
|
let s:use_stylus = exists("g:vim_vue_plugin_use_stylus")
|
||||||
\ && g:vim_vue_plugin_use_stylus == 1
|
\ && g:vim_vue_plugin_use_stylus == 1
|
||||||
let s:use_coffee = exists("g:vim_vue_plugin_use_coffee")
|
let s:use_coffee = exists("g:vim_vue_plugin_use_coffee")
|
||||||
@@ -125,6 +127,12 @@ if s:use_sass
|
|||||||
runtime! after/syntax/sass.vim
|
runtime! after/syntax/sass.vim
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" If scss is enabled, load sass syntax
|
||||||
|
if s:use_scss
|
||||||
|
call s:LoadSyntax('@ScssSyntax', 'scss')
|
||||||
|
runtime! after/syntax/scss.vim
|
||||||
|
endif
|
||||||
|
|
||||||
" If stylus is enabled, load stylus syntax
|
" If stylus is enabled, load stylus syntax
|
||||||
if s:use_stylus
|
if s:use_stylus
|
||||||
call s:LoadFullSyntax('@StylusSyntax', 'stylus')
|
call s:LoadFullSyntax('@StylusSyntax', 'stylus')
|
||||||
@@ -197,7 +205,7 @@ syntax region sassVueStyle fold
|
|||||||
syntax region cssScssVueStyle fold
|
syntax region cssScssVueStyle fold
|
||||||
\ start=+<style[^>]*lang=["']scss["'][^>]*>+
|
\ start=+<style[^>]*lang=["']scss["'][^>]*>+
|
||||||
\ end=+</style>+
|
\ end=+</style>+
|
||||||
\ keepend contains=@SassSyntax,vueTag
|
\ keepend contains=@ScssSyntax,vueTag
|
||||||
syntax region cssStylusVueStyle fold
|
syntax region cssStylusVueStyle fold
|
||||||
\ start=+<style[^>]*lang=["']stylus["'][^>]*>+
|
\ start=+<style[^>]*lang=["']stylus["'][^>]*>+
|
||||||
\ end=+</style>+
|
\ end=+</style>+
|
||||||
@@ -237,26 +245,37 @@ endif
|
|||||||
" enable emmet-vim css type.
|
" enable emmet-vim css type.
|
||||||
if s:use_less
|
if s:use_less
|
||||||
silent! syntax clear lessDefinition
|
silent! syntax clear lessDefinition
|
||||||
syntax region cssLessDefinition matchgroup=cssBraces contains=@LessSyntax
|
syntax region cssLessDefinition matchgroup=cssBraces
|
||||||
|
\ contains=@LessSyntax,cssLessDefinition
|
||||||
\ contained containedin=cssLessVueStyle
|
\ contained containedin=cssLessVueStyle
|
||||||
\ start="{" end="}"
|
\ start="{" end="}"
|
||||||
endif
|
endif
|
||||||
if s:use_sass
|
if s:use_sass
|
||||||
silent! syntax clear sassDefinition
|
silent! syntax clear sassDefinition
|
||||||
syntax region cssSassDefinition matchgroup=cssBraces contains=@SassSyntax
|
syntax region sassDefinition matchgroup=cssBraces
|
||||||
\ contained containedin=sassVueStyle,cssScssVueStyle
|
\ contains=@SassSyntax,sassDefinition
|
||||||
|
\ contained containedin=sassVueStyle
|
||||||
|
\ start="{" end="}"
|
||||||
|
endif
|
||||||
|
" Active if not loading https://github.com/cakebaker/scss-syntax.vim
|
||||||
|
if s:use_scss && hlexists('scssNestedProperty') == 0
|
||||||
|
silent! syntax clear scssDefinition
|
||||||
|
syntax region cssScssDefinition transparent matchgroup=cssBraces
|
||||||
|
\ contains=@ScssSyntax,cssScssDefinition
|
||||||
|
\ contained containedin=cssScssVueStyle
|
||||||
\ start="{" end="}"
|
\ start="{" end="}"
|
||||||
endif
|
endif
|
||||||
if s:use_stylus
|
if s:use_stylus
|
||||||
silent! syntax clear stylusDefinition
|
silent! syntax clear stylusDefinition
|
||||||
syntax region cssStylusDefinition matchgroup=cssBraces contains=@StylusSyntax
|
syntax region cssStylusDefinition matchgroup=cssBraces
|
||||||
|
\ contains=@StylusSyntax,cssStylusDefinition
|
||||||
\ contained containedin=cssStylusVueStyle
|
\ contained containedin=cssStylusVueStyle
|
||||||
\ start="{" end="}"
|
\ start="{" end="}"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Avoid css syntax interference
|
" Avoid css syntax interference
|
||||||
silent! syntax clear cssUnitDecorators
|
|
||||||
" Have to use a different name
|
" Have to use a different name
|
||||||
|
silent! syntax clear cssUnitDecorators
|
||||||
syntax match cssUnitDecorators2
|
syntax match cssUnitDecorators2
|
||||||
\ /\(#\|-\|+\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|ch\|rem\|vh\|vw\|vmin\|vmax\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)\ze\(;\|$\)/
|
\ /\(#\|-\|+\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|ch\|rem\|vh\|vw\|vmin\|vmax\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)\ze\(;\|$\)/
|
||||||
\ contained
|
\ contained
|
||||||
|
|||||||
Reference in New Issue
Block a user