Change scss provider to cakebaker, closes #173
This commit is contained in:
parent
462bb76e06
commit
6e9529be4e
@ -55,7 +55,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [glsl](https://github.com/tikhomirov/vim-glsl) (syntax, indent, ftdetect)
|
||||
- [go](https://github.com/fatih/vim-go) (syntax, compiler, indent, ftdetect)
|
||||
- [groovy](https://github.com/vim-scripts/groovy.vim) (syntax)
|
||||
- [haml](https://github.com/tpope/vim-haml) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||
- [haml](https://github.com/sheerun/vim-haml) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||
- [handlebars](https://github.com/mustache/vim-mustache-handlebars) (syntax, indent, ftplugin, ftdetect)
|
||||
- [haskell](https://github.com/neovimhaskell/haskell-vim) (syntax, indent, ftplugin, ftdetect)
|
||||
- [haxe](https://github.com/yaymukund/vim-haxe) (syntax, ftdetect)
|
||||
@ -102,6 +102,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [rust](https://github.com/rust-lang/rust.vim) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
|
||||
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax, ftdetect)
|
||||
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin, ftdetect)
|
||||
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, autoload, ftplugin, ftdetect)
|
||||
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin, ftdetect)
|
||||
- [solidity](https://github.com/ethereum/vim-solidity) (syntax, indent, ftdetect)
|
||||
- [stylus](https://github.com/wavded/vim-stylus) (syntax, indent, ftplugin, ftdetect)
|
||||
|
41
autoload/scss_indent.vim
Normal file
41
autoload/scss_indent.vim
Normal file
@ -0,0 +1,41 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scss') == -1
|
||||
|
||||
" usage:
|
||||
" set indentexpr=scss_indent#GetIndent(v:lnum)
|
||||
fun! scss_indent#GetIndent(lnum)
|
||||
" { -> increase indent
|
||||
" } -> decrease indent
|
||||
if a:lnum == 1
|
||||
" start at 0 indentation
|
||||
return 0
|
||||
endif
|
||||
|
||||
" try to find last line ending with { or }
|
||||
" ignoring // comments
|
||||
let regex = '\([{}]\)\%(\/\/.*\)\?$'
|
||||
let nr = search(regex, 'bnW')
|
||||
if nr > 0
|
||||
let last = indent(nr)
|
||||
let m = matchlist(getline(nr), regex)
|
||||
let m_curr = matchlist(getline(a:lnum), regex)
|
||||
echoe string(m).string(m_curr)
|
||||
if !empty(m_curr) && m_curr[1] == '}' && m[1] == '{'
|
||||
" last was open, current is close, use same indent
|
||||
return last
|
||||
elseif !empty(m_curr) && m_curr[1] == '}' && m[1] == '}'
|
||||
" } line and last line was }: decrease
|
||||
return last - &sw
|
||||
endif
|
||||
if m[1] == '{'
|
||||
" line after {: increase indent
|
||||
return last + &sw
|
||||
else
|
||||
" line after } or { - same indent
|
||||
return last
|
||||
endif
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfun
|
||||
|
||||
endif
|
3
build
3
build
@ -128,7 +128,7 @@ PACKS="
|
||||
glsl:tikhomirov/vim-glsl
|
||||
go:fatih/vim-go:_BASIC
|
||||
groovy:vim-scripts/groovy.vim
|
||||
haml:tpope/vim-haml
|
||||
haml:sheerun/vim-haml
|
||||
handlebars:mustache/vim-mustache-handlebars
|
||||
haskell:neovimhaskell/haskell-vim
|
||||
haxe:yaymukund/vim-haxe
|
||||
@ -175,6 +175,7 @@ PACKS="
|
||||
rust:rust-lang/rust.vim
|
||||
sbt:derekwyatt/vim-sbt
|
||||
scala:derekwyatt/vim-scala
|
||||
scss:cakebaker/scss-syntax.vim
|
||||
slim:slim-template/vim-slim
|
||||
solidity:ethereum/vim-solidity
|
||||
stylus:wavded/vim-stylus
|
||||
|
@ -1,34 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
|
||||
" Vim compiler file
|
||||
" Compiler: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2013 May 30
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "sass"
|
||||
|
||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo-=C
|
||||
|
||||
CompilerSet makeprg=sass
|
||||
|
||||
CompilerSet errorformat=
|
||||
\%f:%l:%m\ (Sass::Syntax%trror),
|
||||
\%ESyntax\ %trror:%m,
|
||||
\%C%\\s%\\+on\ line\ %l\ of\ %f,
|
||||
\%Z%.%#,
|
||||
\%-G%.%#
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim:set sw=2 sts=2:
|
||||
|
||||
endif
|
@ -326,7 +326,6 @@ endif
|
||||
" ftdetect/haml.vim
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
|
||||
autocmd BufNewFile,BufRead *.haml,*.hamlbars,*.hamlc setf haml
|
||||
autocmd BufNewFile,BufRead *.sass setf sass
|
||||
autocmd BufNewFile,BufRead *.scss setf scss
|
||||
|
||||
@ -882,6 +881,14 @@ au BufRead,BufNewFile *.sbt setfiletype sbt.scala
|
||||
|
||||
endif
|
||||
|
||||
" ftdetect/scss.vim
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scss') == -1
|
||||
|
||||
au BufRead,BufNewFile *.scss setfiletype scss
|
||||
au BufEnter *.scss :syntax sync fromstart
|
||||
|
||||
endif
|
||||
|
||||
" ftdetect/slim.vim
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'slim') == -1
|
||||
|
||||
|
@ -1,27 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
|
||||
" Vim filetype plugin
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2010 Jul 26
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let b:undo_ftplugin = "setl com< cms< def< inc< inex< ofu< sua<"
|
||||
|
||||
setlocal comments=://
|
||||
setlocal commentstring=//\ %s
|
||||
setlocal define=^\\s*\\%(@mixin\\\|=\\)
|
||||
setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
|
||||
setlocal omnifunc=csscomplete#CompleteCSS
|
||||
setlocal suffixesadd=.sass,.scss,.css
|
||||
|
||||
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
@ -1,17 +1,17 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scss') == -1
|
||||
|
||||
" Vim filetype plugin
|
||||
" Language: SCSS
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2010 Jul 26
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
if exists('b:did_indent') && b:did_indent
|
||||
" be kind. allow users to override this. Does it work?
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! ftplugin/sass.vim
|
||||
setlocal indentexpr=scss_indent#GetIndent(v:lnum)
|
||||
|
||||
" Automatically insert the current comment leader after hitting <Enter>
|
||||
" in Insert mode respectively after hitting 'o' or 'O' in Normal mode
|
||||
setlocal formatoptions+=ro
|
||||
|
||||
" SCSS comments are either /* */ or //
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,://
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
||||
|
@ -1,42 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2010 May 21
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal autoindent sw=2 et
|
||||
setlocal indentexpr=GetSassIndent()
|
||||
setlocal indentkeys=o,O,*<Return>,<:>,!^F
|
||||
|
||||
" Only define the function once.
|
||||
if exists("*GetSassIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)'
|
||||
let s:extend = '^\s*\%(@extend\|@include\|+\)'
|
||||
|
||||
function! GetSassIndent()
|
||||
let lnum = prevnonblank(v:lnum-1)
|
||||
let line = substitute(getline(lnum),'\s\+$','','')
|
||||
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
|
||||
let lastcol = strlen(line)
|
||||
let line = substitute(line,'^\s\+','','')
|
||||
let indent = indent(lnum)
|
||||
let cindent = indent(v:lnum)
|
||||
if line !~ s:property && line !~ s:extend && cline =~ s:property
|
||||
return indent + (exists('*shiftwidth') ? shiftwidth() : &sw)
|
||||
else
|
||||
return -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
@ -1,16 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: SCSS
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2010 Jul 26
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! indent/css.vim
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
110
syntax/sass.vim
110
syntax/sass.vim
@ -1,110 +0,0 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: *.sass
|
||||
" Last Change: 2010 Aug 09
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/css.vim
|
||||
|
||||
syn case ignore
|
||||
|
||||
syn cluster sassCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp
|
||||
syn cluster sassCssAttributes contains=css.*Attr,sassEndOfLineComment,scssComment,cssValue.*,cssColor,cssURL,sassDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp
|
||||
|
||||
syn region sassDefinition matchgroup=cssBraces start="{" end="}" contains=TOP
|
||||
|
||||
syn match sassProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:" contains=css.*Prop skipwhite nextgroup=sassCssAttribute contained containedin=sassDefinition
|
||||
syn match sassProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
|
||||
syn match sassProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
|
||||
syn match sassCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@sassCssAttributes,sassVariable,sassFunction,sassInterpolation
|
||||
syn match sassDefault "!default\>" contained
|
||||
syn match sassVariable "!\%(important\>\|default\>\)\@![[:alnum:]_-]\+"
|
||||
syn match sassVariable "$[[:alnum:]_-]\+"
|
||||
syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=\%(||\)\==" nextgroup=sassCssAttribute skipwhite
|
||||
syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=:" nextgroup=sassCssAttribute skipwhite
|
||||
|
||||
syn match sassFunction "\<\%(rgb\|rgba\|red\|green\|blue\|mix\)\>(\@=" contained
|
||||
syn match sassFunction "\<\%(hsl\|hsla\|hue\|saturation\|lightness\|adjust-hue\|lighten\|darken\|saturate\|desaturate\|grayscale\|complement\)\>(\@=" contained
|
||||
syn match sassFunction "\<\%(alpha\|opacity\|rgba\|opacify\|fade-in\|transparentize\|fade-out\)\>(\@=" contained
|
||||
syn match sassFunction "\<\%(unquote\|quote\)\>(\@=" contained
|
||||
syn match sassFunction "\<\%(percentage\|round\|ceil\|floor\|abs\)\>(\@=" contained
|
||||
syn match sassFunction "\<\%(type-of\|unit\|unitless\|comparable\)\>(\@=" contained
|
||||
|
||||
syn region sassInterpolation matchgroup=sassInterpolationDelimiter start="#{" end="}" contains=@sassCssAttributes,sassVariable,sassFunction containedin=cssStringQ,cssStringQQ,cssPseudoClass,sassProperty
|
||||
|
||||
syn match sassMixinName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute
|
||||
syn match sassMixin "^=" nextgroup=sassMixinName skipwhite
|
||||
syn match sassMixin "\%([{};]\s*\|^\s*\)\@<=@mixin" nextgroup=sassMixinName skipwhite
|
||||
syn match sassMixing "^\s\+\zs+" nextgroup=sassMixinName
|
||||
syn match sassMixing "\%([{};]\s*\|^\s*\)\@<=@include" nextgroup=sassMixinName skipwhite
|
||||
syn match sassExtend "\%([{};]\s*\|^\s*\)\@<=@extend"
|
||||
syn match sassPlaceholder "\%([{};]\s*\|^\s*\)\@<=%" nextgroup=sassMixinName skipwhite
|
||||
|
||||
syn match sassFunctionName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute
|
||||
syn match sassFunctionDecl "\%([{};]\s*\|^\s*\)\@<=@function" nextgroup=sassFunctionName skipwhite
|
||||
syn match sassReturn "\%([{};]\s*\|^\s*\)\@<=@return"
|
||||
|
||||
syn match sassEscape "^\s*\zs\\"
|
||||
syn match sassIdChar "#[[:alnum:]_-]\@=" nextgroup=sassId
|
||||
syn match sassId "[[:alnum:]_-]\+" contained
|
||||
syn match sassClassChar "\.[[:alnum:]_-]\@=" nextgroup=sassClass
|
||||
syn match sassClass "[[:alnum:]_-]\+" contained
|
||||
syn match sassAmpersand "&"
|
||||
|
||||
" TODO: Attribute namespaces
|
||||
" TODO: Arithmetic (including strings and concatenation)
|
||||
|
||||
syn region sassMediaQuery matchgroup=sassMedia start="@media" end="[{};]\@=\|$" contains=sassMediaOperators
|
||||
syn keyword sassMediaOperators and not only contained
|
||||
syn region sassCharset start="@charset" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType
|
||||
syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType
|
||||
syn region sassDebugLine end=";\|$" matchgroup=sassDebug start="@debug\>" contains=@sassCssAttributes,sassVariable,sassFunction
|
||||
syn region sassWarnLine end=";\|$" matchgroup=sassWarn start="@warn\>" contains=@sassCssAttributes,sassVariable,sassFunction
|
||||
syn region sassControlLine matchgroup=sassControl start="@\%(if\|else\%(\s\+if\)\=\|while\|for\|each\)\>" end="[{};]\@=\|$" contains=sassFor,@sassCssAttributes,sassVariable,sassFunction
|
||||
syn keyword sassFor from to through in contained
|
||||
|
||||
syn keyword sassTodo FIXME NOTE TODO OPTIMIZE XXX contained
|
||||
syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell
|
||||
syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell
|
||||
syn match sassEndOfLineComment "//.*" contains=sassComment,sassTodo,@Spell
|
||||
|
||||
hi def link sassEndOfLineComment sassComment
|
||||
hi def link sassCssComment sassComment
|
||||
hi def link sassComment Comment
|
||||
hi def link sassDefault cssImportant
|
||||
hi def link sassVariable Identifier
|
||||
hi def link sassFunction Function
|
||||
hi def link sassMixing PreProc
|
||||
hi def link sassMixin PreProc
|
||||
hi def link sassPlaceholder PreProc
|
||||
hi def link sassExtend PreProc
|
||||
hi def link sassFunctionDecl PreProc
|
||||
hi def link sassReturn PreProc
|
||||
hi def link sassTodo Todo
|
||||
hi def link sassCharset PreProc
|
||||
hi def link sassMedia PreProc
|
||||
hi def link sassMediaOperators PreProc
|
||||
hi def link sassInclude Include
|
||||
hi def link sassDebug sassControl
|
||||
hi def link sassWarn sassControl
|
||||
hi def link sassControl PreProc
|
||||
hi def link sassFor PreProc
|
||||
hi def link sassEscape Special
|
||||
hi def link sassIdChar Special
|
||||
hi def link sassClassChar Special
|
||||
hi def link sassInterpolationDelimiter Delimiter
|
||||
hi def link sassAmpersand Character
|
||||
hi def link sassId Identifier
|
||||
hi def link sassClass Type
|
||||
|
||||
let b:current_syntax = "sass"
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
endif
|
227
syntax/scss.vim
227
syntax/scss.vim
@ -1,24 +1,225 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'haml') == -1
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'scss') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Language: SCSS
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: *.scss
|
||||
" Last Change: 2010 Jul 26
|
||||
" Language: SCSS (Sassy CSS)
|
||||
" Author: Daniel Hofstetter (daniel.hofstetter@42dh.com)
|
||||
" URL: https://github.com/cakebaker/scss-syntax.vim
|
||||
" Last Change: 2015-04-22
|
||||
" Inspired by the syntax files for sass and css. Thanks to the authors of
|
||||
" those files!
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
if !exists("main_syntax")
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
let main_syntax = 'scss'
|
||||
endif
|
||||
|
||||
runtime! syntax/sass.vim
|
||||
runtime! syntax/css.vim
|
||||
runtime! syntax/css/*.vim
|
||||
|
||||
syn match scssComment "//.*" contains=sassTodo,@Spell
|
||||
syn region scssComment start="/\*" end="\*/" contains=sassTodo,@Spell
|
||||
syn case ignore
|
||||
|
||||
hi def link scssComment sassComment
|
||||
" XXX fix for #20, can be removed once the patch is in vim's css.vim
|
||||
syn match cssSpecialCharQQ +\\\\\|\\"+ contained
|
||||
syn match cssSpecialCharQ +\\\\\|\\'+ contained
|
||||
|
||||
" XXX fix for #37
|
||||
if v:version < 704
|
||||
" replace the definition of cssBoxProp with the one from Vim 7.4 to prevent
|
||||
" highlighting issues
|
||||
syn clear cssBoxProp
|
||||
syn match cssBoxProp contained "\<padding\(-\(top\|right\|bottom\|left\)\)\=\>"
|
||||
syn match cssBoxProp contained "\<margin\(-\(top\|right\|bottom\|left\)\)\=\>"
|
||||
syn match cssBoxProp contained "\<overflow\(-\(x\|y\|style\)\)\=\>"
|
||||
syn match cssBoxProp contained "\<rotation\(-point\)\=\>"
|
||||
endif
|
||||
|
||||
" override @font-face blocks to allow scss elements inside
|
||||
syn region cssFontDescriptorBlock contained transparent matchgroup=cssBraces start="{" end="}" contains=cssError,cssUnicodeEscape,cssFontProp,cssFontAttr,cssCommonAttr,cssStringQ,cssStringQQ,cssFontDescriptorProp,cssValue.*,cssFontDescriptorFunction,cssUnicodeRange,cssFontDescriptorAttr,@comment,scssDefinition,scssFunction,scssVariable,@scssControl,scssDebug,scssError,scssWarn
|
||||
|
||||
syn region scssDefinition matchgroup=cssBraces start='{' end='}' contains=cssString.*,cssInclude,cssFontDescriptor,scssAtRootStatement,@comment,scssDefinition,scssProperty,scssSelector,scssVariable,scssImport,scssExtend,scssInclude,scssInterpolation,scssFunction,@scssControl,scssWarn,scssError,scssDebug,scssReturn containedin=cssMediaBlock fold
|
||||
|
||||
syn match scssSelector _^\zs\([^:@]\|:[^ ]\|['"].*['"]\)\+{\@=_ contained contains=@scssSelectors
|
||||
syn match scssSelector "^\s*\zs\([^:@{]\|:[^ ]\|['"].*['"]\)\+\_$" contained contains=@scssSelectors
|
||||
" fix for #54 to recognize a multiline selector containing a string interpolation
|
||||
syn match scssSelector "^\zs\([^:@]\|:[^ ]\)\+#{.*}[^;{]\+\_$" contained contains=@scssSelectors
|
||||
syn cluster scssSelectors contains=@comment,cssSelectorOp,cssTagName,cssPseudoClass,cssAttributeSelector,scssSelectorChar,scssAmpersand,scssInterpolation
|
||||
|
||||
syn match scssProperty "\([[:alnum:]-]\)\+\s*\(:\)\@=" contained contains=css.*Prop,cssVendor containedin=cssMediaBlock nextgroup=scssAttribute,scssAttributeWithNestedDefinition
|
||||
syn match scssAttribute ":[^;]*\ze\(;\|}\)" contained contains=css.*Attr,cssValue.*,cssColor,cssFunction,cssString.*,cssURL,scssFunction,scssInterpolation,scssVariable
|
||||
|
||||
syn match scssAttributeWithNestedDefinition ": [^#]*{\@=" nextgroup=scssNestedDefinition contained contains=css.*Attr,cssValue.*,scssVariable
|
||||
syn region scssNestedDefinition matchgroup=cssBraces start="{" end="}" contained contains=@comment,scssProperty,scssNestedProperty
|
||||
|
||||
" CSS properties from https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
|
||||
" align
|
||||
syn keyword scssNestedProperty contained content items self nextgroup=scssAttribute
|
||||
" animation
|
||||
syn keyword scssNestedProperty contained delay direction duration fill-mode iteration-count name play-state timing-function nextgroup=scssAttribute
|
||||
" background
|
||||
syn keyword scssNestedProperty contained attachment clip color image origin position repeat size nextgroup=scssAttribute
|
||||
" border
|
||||
syn keyword scssNestedProperty contained bottom bottom-color bottom-left-radius bottom-right-radius bottom-style bottom-width nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained collapse color nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained image image-outset image-repeat image-slice image-source image-width nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained left left-color left-style left-width nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained radius nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained right right-color right-style right-width nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained spacing style nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained top top-color top-left-radius top-right-radius top-style top-width nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained width nextgroup=scssAttribute
|
||||
" box
|
||||
syn keyword scssNestedProperty contained decoration-break shadow sizing nextgroup=scssAttribute
|
||||
" break
|
||||
syn keyword scssNestedProperty contained after before inside nextgroup=scssAttribute
|
||||
" column
|
||||
syn keyword scssNestedProperty contained count fill gap rule rule-color rule-style rule-width span width nextgroup=scssAttribute
|
||||
" counter
|
||||
syn keyword scssNestedProperty contained increment reset nextgroup=scssAttribute
|
||||
" flex
|
||||
syn keyword scssNestedProperty contained basis direction flow grow shrink wrap nextgroup=scssAttribute
|
||||
" font
|
||||
syn keyword scssNestedProperty contained family feature-settings kerning language-override size size-adjust stretch style synthesis nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained variant variant-alternates variant-caps variant-east-asian variant-ligatures variant-numeric variant-position nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained weight nextgroup=scssAttribute
|
||||
" image
|
||||
syn keyword scssNestedProperty contained rendering resolution orientation nextgroup=scssAttribute
|
||||
" list
|
||||
syn keyword scssNestedProperty contained style style-image style-position style-type nextgroup=scssAttribute
|
||||
" margin/padding
|
||||
syn keyword scssNestedProperty contained bottom left right top nextgroup=scssAttribute
|
||||
" max/min
|
||||
syn keyword scssNestedProperty contained height width nextgroup=scssAttribute
|
||||
" nav
|
||||
syn keyword scssNestedProperty contained down index left right up nextgroup=scssAttribute
|
||||
" object
|
||||
syn keyword scssNestedProperty contained fit position nextgroup=scssAttribute
|
||||
" outline
|
||||
syn keyword scssNestedProperty contained color offset style width nextgroup=scssAttribute
|
||||
" overflow
|
||||
syn keyword scssNestedProperty contained wrap x y nextgroup=scssAttribute
|
||||
" page
|
||||
syn keyword scssNestedProperty contained break-after break-before break-inside nextgroup=scssAttribute
|
||||
" text
|
||||
syn keyword scssNestedProperty contained align align-last combine-horizontal nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained decoration decoration-color decoration-line decoration-style nextgroup=scssAttribute
|
||||
syn keyword scssNestedProperty contained indent orientation overflow rendering shadow transform underline-position nextgroup=scssAttribute
|
||||
" transform
|
||||
syn keyword scssNestedProperty contained origin style nextgroup=scssAttribute
|
||||
" transition
|
||||
syn keyword scssNestedProperty contained delay duration property timing-function nextgroup=scssAttribute
|
||||
" unicode
|
||||
syn keyword scssNestedProperty contained bidi range nextgroup=scssAttribute
|
||||
" word
|
||||
syn keyword scssNestedProperty contained break spacing wrap nextgroup=scssAttribute
|
||||
|
||||
syn region scssInterpolation matchgroup=scssInterpolationDelimiter start="#{" end="}" contains=cssValue.*,cssColor,cssString.*,scssFunction,scssVariable containedin=cssComment,cssInclude,cssPseudoClassFn,cssPseudoClassLang,cssString.*,cssURL,scssFunction
|
||||
|
||||
" ignores the url() function so it can be handled by css.vim
|
||||
syn region scssFunction contained matchgroup=scssFunctionName start="\<\(url(\)\@!\([[:alnum:]-_]\)\+\s*(" skip=+([^)]*)+ end=")" keepend extend containedin=cssInclude,cssMediaType
|
||||
syn match scssParameterList ".*" contained containedin=cssFunction,scssFunction contains=css.*Attr,cssColor,cssString.*,cssValue.*,scssBoolean,scssFunction,scssInterpolation,scssMap,scssNull,scssVariable
|
||||
|
||||
syn match scssVariable "$[[:alnum:]_-]\+" containedin=cssFunction,scssFunction,cssInclude,cssMediaBlock,cssMediaType nextgroup=scssVariableAssignment skipwhite
|
||||
syn match scssVariableAssignment ":" contained nextgroup=scssVariableValue skipwhite
|
||||
syn region scssVariableValue start="" end="\ze[;)]" contained contains=css.*Attr,cssValue.*,cssColor,cssFunction,cssString.*,cssURL,scssBoolean,scssDefault,scssFunction,scssInterpolation,scssNull,scssVariable,scssMap,scssGlobal,scssAmpersand,@comment
|
||||
syn match scssGlobal "!global" contained
|
||||
|
||||
syn keyword scssNull null contained
|
||||
syn keyword scssBoolean true false contained
|
||||
syn keyword scssBooleanOp and or not contained
|
||||
|
||||
syn match scssMixin "^@mixin" nextgroup=scssMixinName skipwhite
|
||||
syn match scssMixinName "[[:alnum:]_-]\+" contained nextgroup=scssDefinition,scssMixinParams
|
||||
syn region scssMixinParams contained contains=css.*Attr,cssColor,cssValue.*,cssString.*,cssUrl,cssBoxProp,cssDimensionProp,@comment,scssBoolean,scssNull,scssVariable,scssFunction start="(" end=")" extend
|
||||
syn match scssInclude "@include" nextgroup=scssMixinName skipwhite containedin=cssMediaBlock
|
||||
syn match scssContent "@content" contained containedin=scssDefinition
|
||||
|
||||
syn match scssFunctionDefinition "^@function" nextgroup=scssFunctionNameWithWhitespace skipwhite
|
||||
syn match scssFunctionNameWithWhitespace "[[:alnum:]_-]\+\s*" contained contains=scssFunctionName nextgroup=scssFunctionParams
|
||||
syn match scssFunctionName "[[:alnum:]_-]\+" contained
|
||||
syn region scssFunctionParams contained start="(" end=")" nextgroup=scssFunctionBody contains=scssVariable skipwhite
|
||||
syn region scssFunctionBody contained matchgroup=cssBraces start="{" end="}" contains=cssString.*,cssValue.*,@scssControl,scssBooleanOp,scssComment,scssVariable,scssReturn,scssFunction,scssDebug,scssError,scssWarn,scssDefinition,scssInterpolation fold
|
||||
syn match scssReturn "@return" contained
|
||||
syn match scssExtend "@extend" nextgroup=scssExtendedSelector skipwhite containedin=cssMediaBlock
|
||||
syn match scssExtendedSelector "[^;]\+" contained contains=cssTagName,cssPseudoClass,scssOptional,scssSelectorChar skipwhite
|
||||
syn match scssOptional "!optional" contained
|
||||
syn match scssImport "@import" nextgroup=scssImportList
|
||||
syn match scssImportList "[^;]\+" contained contains=cssString.*,cssMediaType,cssURL
|
||||
|
||||
syn match scssSelectorChar "\(#\|\.\|%\)\([[:alnum:]_-]\|#{.*}\)\@=" nextgroup=scssSelectorName containedin=cssMediaBlock,cssPseudoClassFn
|
||||
syn match scssSelectorName "\([[:alnum:]_-]\|#{[^}]*}\)\+" contained contains=scssInterpolation
|
||||
|
||||
syn match scssAmpersand "&" nextgroup=cssPseudoClass,scssSelectorName containedin=cssMediaBlock
|
||||
|
||||
syn match scssDebug "@debug" nextgroup=scssOutput
|
||||
syn match scssWarn "@warn" nextgroup=scssOutput
|
||||
syn match scssError "@error" nextgroup=scssOutput
|
||||
syn match scssOutput "[^;]\+" contained contains=cssValue.*,cssString.*,scssFunction,scssVariable
|
||||
syn match scssDefault "!default" contained
|
||||
|
||||
syn match scssIf "@\=if" nextgroup=scssCondition
|
||||
syn match scssCondition "[^{]\+" contained contains=cssValue.*,cssString.*,scssBoolean,scssBooleanOp,scssFunction,scssNull,scssVariable,scssAmpersand
|
||||
syn match scssElse "@else" nextgroup=scssIf
|
||||
syn match scssElse "@else\(\s*\({\|$\)\)\@="
|
||||
syn match scssWhile "@while" nextgroup=scssCondition
|
||||
syn match scssFor "@for\s\+.*from\s\+.*\(to\|through\)\s\+[^{ ]\+" contains=cssValueNumber,scssFunction,scssVariable,scssForKeyword
|
||||
syn match scssForKeyword "@for\|from\|to\|through" contained
|
||||
syn region scssEach matchgroup=scssEachKeyword start="@each" end="in" contains=scssVariable nextgroup=scssCollection
|
||||
syn region scssCollection start=" " end="\ze{" contained contains=scssFunction,scssMap,scssVariable
|
||||
syn cluster scssControl contains=scssIf,scssElse,scssWhile,scssFor,scssEach
|
||||
|
||||
syn region scssMap matchgroup=scssMapParens start="[^:alpha:]\=\zs(\ze\(\s*\n.*:\|.\+:\)" end=")" contains=@comment,scssMapKey extend
|
||||
syn match scssMapKey "[^: ]\+\ze[:]" contained contains=css.*Attr,cssString.*,scssVariable nextgroup=scssMapValue
|
||||
syn match scssMapValue "[^,)]\+\ze[,)]" contained contains=cssColor,css.*Prop,cssString.*,cssValueLength,scssBoolean,scssFunction,scssNull,scssVariable
|
||||
|
||||
syn region scssAtRootStatement start="@at-root" end="\ze{" contains=@scssSelectors,scssAtRoot
|
||||
syn match scssAtRoot "@at-root" contained
|
||||
syn match scssAtRoot "(\zswith\(out\)\=\ze:" contained
|
||||
|
||||
syn match scssComment "//.*$" contains=@Spell containedin=cssMediaBlock
|
||||
syn cluster comment contains=cssComment,scssComment
|
||||
syn match scssStickyCommentChar "^\/\*\zs!" contained containedin=cssComment
|
||||
syn keyword scssTodo TODO FIXME NOTE OPTIMIZE XXX contained containedin=@comment
|
||||
|
||||
hi def link scssNestedProperty cssProp
|
||||
hi def link scssVariable Identifier
|
||||
hi def link scssGlobal Special
|
||||
hi def link scssNull Constant
|
||||
hi def link scssBoolean Constant
|
||||
hi def link scssBooleanOp Operator
|
||||
hi def link scssMixin PreProc
|
||||
hi def link scssMixinName Function
|
||||
hi def link scssContent PreProc
|
||||
hi def link scssFunctionDefinition PreProc
|
||||
hi def link scssFunctionName Function
|
||||
hi def link scssReturn Statement
|
||||
hi def link scssInclude PreProc
|
||||
hi def link scssExtend PreProc
|
||||
hi def link scssOptional Special
|
||||
hi def link scssComment Comment
|
||||
hi def link scssStickyCommentChar Special
|
||||
hi def link scssSelectorChar Special
|
||||
hi def link scssSelectorName Identifier
|
||||
hi def link scssAmpersand Character
|
||||
hi def link scssDebug Debug
|
||||
hi def link scssWarn Debug
|
||||
hi def link scssError Debug
|
||||
hi def link scssDefault Special
|
||||
hi def link scssIf Conditional
|
||||
hi def link scssElse Conditional
|
||||
hi def link scssWhile Repeat
|
||||
hi def link scssForKeyword Repeat
|
||||
hi def link scssEachKeyword Repeat
|
||||
hi def link scssInterpolationDelimiter Delimiter
|
||||
hi def link scssImport Include
|
||||
hi def link scssTodo Todo
|
||||
hi def link scssAtRoot Keyword
|
||||
hi def link scssMapParens Delimiter
|
||||
|
||||
let b:current_syntax = "scss"
|
||||
|
||||
" vim:set sw=2:
|
||||
if main_syntax == 'scss'
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user