├── .github └── FUNDING.yml ├── README.markdown ├── compiler ├── haml.vim └── sass.vim ├── ftdetect └── haml.vim ├── ftplugin ├── haml.vim ├── sass.vim └── scss.vim ├── indent ├── haml.vim ├── sass.vim └── scss.vim └── syntax ├── haml.vim ├── sass.vim └── scss.vim /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: tpope 2 | custom: ["https://www.paypal.me/vimpope"] 3 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # vim-haml 2 | 3 | This project contains the runtime files for Haml, Sass, and SCSS that ship 4 | with Vim. You only need it if you want the very latest updates. 5 | 6 | ## License 7 | 8 | Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. 9 | See `:help license`. 10 | -------------------------------------------------------------------------------- /compiler/haml.vim: -------------------------------------------------------------------------------- 1 | " Vim compiler file 2 | " Compiler: Haml 3 | " Maintainer: Tim Pope 4 | " Last Change: 2016 Aug 29 5 | 6 | if exists("current_compiler") 7 | finish 8 | endif 9 | let current_compiler = "haml" 10 | 11 | if exists(":CompilerSet") != 2 " older Vim always used :setlocal 12 | command -nargs=* CompilerSet setlocal 13 | endif 14 | 15 | let s:cpo_save = &cpo 16 | set cpo-=C 17 | 18 | CompilerSet makeprg=haml 19 | 20 | CompilerSet errorformat= 21 | \Haml\ %trror\ on\ line\ %l:\ %m, 22 | \Syntax\ %trror\ on\ line\ %l:\ %m, 23 | \%-G%.%# 24 | 25 | let &cpo = s:cpo_save 26 | unlet s:cpo_save 27 | 28 | " vim:set sw=2 sts=2: 29 | -------------------------------------------------------------------------------- /compiler/sass.vim: -------------------------------------------------------------------------------- 1 | " Vim compiler file 2 | " Compiler: Sass 3 | " Maintainer: Tim Pope 4 | " Last Change: 2016 Aug 29 5 | 6 | if exists("current_compiler") 7 | finish 8 | endif 9 | let current_compiler = "sass" 10 | 11 | if exists(":CompilerSet") != 2 " older Vim always used :setlocal 12 | command -nargs=* CompilerSet setlocal 13 | endif 14 | 15 | let s:cpo_save = &cpo 16 | set cpo-=C 17 | 18 | CompilerSet makeprg=sass 19 | 20 | CompilerSet errorformat= 21 | \%f:%l:%m\ (Sass::Syntax%trror), 22 | \%ESyntax\ %trror:%m, 23 | \%C%\\s%\\+on\ line\ %l\ of\ %f, 24 | \%Z%.%#, 25 | \%-G%.%# 26 | 27 | let &cpo = s:cpo_save 28 | unlet s:cpo_save 29 | 30 | " vim:set sw=2 sts=2: 31 | -------------------------------------------------------------------------------- /ftdetect/haml.vim: -------------------------------------------------------------------------------- 1 | autocmd BufNewFile,BufRead *.haml,*.hamlbars,*.hamlc setf haml 2 | autocmd BufNewFile,BufRead *.sass setf sass 3 | autocmd BufNewFile,BufRead *.scss setf scss 4 | -------------------------------------------------------------------------------- /ftplugin/haml.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype plugin 2 | " Language: Haml 3 | " Maintainer: Tim Pope 4 | " Last Change: 2019 Dec 05 5 | 6 | " Only do this when not done yet for this buffer 7 | if exists("b:did_ftplugin") 8 | finish 9 | endif 10 | 11 | let s:save_cpo = &cpo 12 | set cpo-=C 13 | 14 | " Define some defaults in case the included ftplugins don't set them. 15 | let s:undo_ftplugin = "" 16 | let s:browsefilter = "All Files (*.*)\t*.*\n" 17 | let s:match_words = "" 18 | 19 | runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim 20 | unlet! b:did_ftplugin 21 | set matchpairs-=<:> 22 | 23 | " Override our defaults if these were set by an included ftplugin. 24 | if exists("b:undo_ftplugin") 25 | let s:undo_ftplugin = b:undo_ftplugin 26 | unlet b:undo_ftplugin 27 | endif 28 | if exists("b:browsefilter") 29 | let s:browsefilter = b:browsefilter 30 | unlet b:browsefilter 31 | endif 32 | if exists("b:match_words") 33 | let s:match_words = b:match_words 34 | unlet b:match_words 35 | endif 36 | 37 | runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim 38 | let b:did_ftplugin = 1 39 | 40 | let &l:define .= empty(&l:define ? '' : '\|') . '^\s*\%(%\w*\)\=\%(\.[[:alnum:]_-]\+\)*#' 41 | 42 | " Combine the new set of values with those previously included. 43 | if exists("b:undo_ftplugin") 44 | let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin 45 | endif 46 | if exists ("b:browsefilter") 47 | let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter 48 | endif 49 | if exists("b:match_words") 50 | let s:match_words = b:match_words . ',' . s:match_words 51 | endif 52 | 53 | " Change the browse dialog on Win32 to show mainly Haml-related files 54 | if has("gui_win32") 55 | let b:browsefilter="Haml Files (*.haml)\t*.haml\nSass Files (*.sass)\t*.sass\n" . s:browsefilter 56 | endif 57 | 58 | " Load the combined list of match_words for matchit.vim 59 | if exists("loaded_matchit") 60 | let b:match_words = s:match_words 61 | endif 62 | 63 | setlocal comments= commentstring=-#\ %s 64 | 65 | let b:undo_ftplugin = "setl def< cms< com< " 66 | \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin 67 | 68 | let &cpo = s:save_cpo 69 | unlet s:save_cpo 70 | 71 | " vim:set sw=2: 72 | -------------------------------------------------------------------------------- /ftplugin/sass.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype plugin 2 | " Language: Sass 3 | " Maintainer: Tim Pope 4 | " Last Change: 2019 Dec 05 5 | 6 | " Only do this when not done yet for this buffer 7 | if exists("b:did_ftplugin") 8 | finish 9 | endif 10 | let b:did_ftplugin = 1 11 | 12 | let b:undo_ftplugin = "setl com< cms< def< inc< inex< ofu< sua<" 13 | 14 | setlocal comments=:// 15 | setlocal commentstring=//\ %s 16 | setlocal includeexpr=SassIncludeExpr(v:fname) 17 | setlocal omnifunc=csscomplete#CompleteCSS 18 | setlocal suffixesadd=.sass,.scss,.css 19 | if &filetype =~# '\' 20 | setlocal iskeyword+=- 21 | setlocal iskeyword+=$ 22 | setlocal iskeyword+=% 23 | let b:undo_ftplugin .= ' isk<' 24 | endif 25 | 26 | if get(g:, 'sass_recommended_style', 1) 27 | setlocal shiftwidth=2 softtabstop=2 expandtab 28 | let b:undo_ftplugin .= ' sw< sts< et<' 29 | endif 30 | 31 | let &l:define = '^\C\v\s*%(\@function|\@mixin|\=)|^\s*%(\$[[:alnum:]-]+:|[%.][:alnum:]-]+\s*%(\{|$))@=' 32 | let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\=' 33 | 34 | function! SassIncludeExpr(file) abort 35 | let partial = substitute(a:file, '\%(.*/\|^\)\zs', '_', '') 36 | if !empty(findfile(partial)) 37 | return partial 38 | endif 39 | return a:file 40 | endfunction 41 | 42 | " vim:set sw=2: 43 | -------------------------------------------------------------------------------- /ftplugin/scss.vim: -------------------------------------------------------------------------------- 1 | " Vim filetype plugin 2 | " Language: SCSS 3 | " Maintainer: Tim Pope 4 | " Last Change: 2016 Aug 29 5 | 6 | if exists("b:did_ftplugin") 7 | finish 8 | endif 9 | 10 | runtime! ftplugin/sass.vim 11 | setlocal comments=s1:/*,mb:*,ex:*/,:// 12 | 13 | " vim:set sw=2: 14 | -------------------------------------------------------------------------------- /indent/haml.vim: -------------------------------------------------------------------------------- 1 | " Vim indent file 2 | " Language: Haml 3 | " Maintainer: Tim Pope 4 | " Last Change: 2022 Mar 15 5 | 6 | if exists("b:did_indent") 7 | finish 8 | endif 9 | runtime! indent/ruby.vim 10 | unlet! b:did_indent 11 | let b:did_indent = 1 12 | 13 | setlocal autoindent 14 | setlocal indentexpr=GetHamlIndent() 15 | setlocal indentkeys=o,O,*,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when 16 | 17 | let b:undo_indent = "setl ai< inde< indk<" 18 | 19 | " Only define the function once. 20 | if exists("*GetHamlIndent") 21 | finish 22 | endif 23 | 24 | let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)' 25 | let s:tag = '\%([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*' 26 | 27 | if !exists('g:haml_self_closing_tags') 28 | let g:haml_self_closing_tags = 'base|link|meta|br|hr|img|input' 29 | endif 30 | 31 | function! GetHamlIndent() 32 | let lnum = prevnonblank(v:lnum-1) 33 | if lnum == 0 34 | return 0 35 | endif 36 | let line = substitute(getline(lnum),'\s\+$','','') 37 | let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') 38 | let lastcol = strlen(line) 39 | let line = substitute(line,'^\s\+','','') 40 | let indent = indent(lnum) 41 | let cindent = indent(v:lnum) 42 | let sw = shiftwidth() 43 | if cline =~# '\v^-\s*%(elsif|else|when)>' 44 | let indent = cindent < indent ? cindent : indent - sw 45 | endif 46 | let increase = indent + sw 47 | if indent == indent(lnum) 48 | let indent = cindent <= indent ? -1 : increase 49 | endif 50 | 51 | let group = synIDattr(synID(lnum,lastcol,1),'name') 52 | 53 | if line =~ '^!!!' 54 | return indent 55 | elseif line =~ '^/\%(\[[^]]*\]\)\=$' 56 | return increase 57 | elseif group == 'hamlFilter' 58 | return increase 59 | elseif line =~ '^'.s:tag.'[&!]\=[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)' 60 | return increase 61 | elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$' 62 | return increase 63 | elseif line == '-#' 64 | return increase 65 | elseif group =~? '\v^(hamlSelfCloser)$' || line =~? '^%\v%('.g:haml_self_closing_tags.')>' 66 | return indent 67 | elseif group =~? '\v^%(hamlTag|hamlAttributesDelimiter|hamlObjectDelimiter|hamlClass|hamlId|htmlTagName|htmlSpecialTagName)$' 68 | return increase 69 | elseif synIDattr(synID(v:lnum,1,1),'name') ==? 'hamlRubyFilter' 70 | return GetRubyIndent() 71 | else 72 | return indent 73 | endif 74 | endfunction 75 | 76 | " vim:set sw=2: 77 | -------------------------------------------------------------------------------- /indent/sass.vim: -------------------------------------------------------------------------------- 1 | " Vim indent file 2 | " Language: Sass 3 | " Maintainer: Tim Pope 4 | " Last Change: 2022 Mar 15 5 | 6 | if exists("b:did_indent") 7 | finish 8 | endif 9 | let b:did_indent = 1 10 | 11 | setlocal autoindent 12 | setlocal indentexpr=GetSassIndent() 13 | setlocal indentkeys=o,O,*,<:>,!^F 14 | 15 | let b:undo_indent = "setl ai< inde< indk<" 16 | 17 | " Only define the function once. 18 | if exists("*GetSassIndent") 19 | finish 20 | endif 21 | 22 | let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)' 23 | let s:extend = '^\s*\%(@extend\|@include\|+\)' 24 | 25 | function! GetSassIndent() 26 | let lnum = prevnonblank(v:lnum-1) 27 | let line = substitute(getline(lnum),'\s\+$','','') 28 | let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','') 29 | let line = substitute(line,'^\s\+','','') 30 | let indent = indent(lnum) 31 | if line !~ s:property && line !~ s:extend && cline =~ s:property 32 | return indent + shiftwidth() 33 | else 34 | return -1 35 | endif 36 | endfunction 37 | 38 | " vim:set sw=2: 39 | -------------------------------------------------------------------------------- /indent/scss.vim: -------------------------------------------------------------------------------- 1 | " Vim indent file 2 | " Language: SCSS 3 | " Maintainer: Tim Pope 4 | " Last Change: 2010 Jul 26 5 | 6 | if exists("b:did_indent") 7 | finish 8 | endif 9 | 10 | runtime! indent/css.vim 11 | 12 | " vim:set sw=2: 13 | -------------------------------------------------------------------------------- /syntax/haml.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Haml 3 | " Maintainer: Tim Pope 4 | " Filenames: *.haml 5 | " Last Change: 2019 Dec 05 6 | 7 | if exists("b:current_syntax") 8 | finish 9 | endif 10 | 11 | if !exists("main_syntax") 12 | let main_syntax = 'haml' 13 | endif 14 | let b:ruby_no_expensive = 1 15 | 16 | runtime! syntax/html.vim 17 | unlet! b:current_syntax 18 | silent! syn include @hamlSassTop syntax/sass.vim 19 | unlet! b:current_syntax 20 | syn include @hamlRubyTop syntax/ruby.vim 21 | 22 | syn case match 23 | 24 | syn region rubyCurlyBlock start="{" end="}" contains=@hamlRubyTop contained 25 | syn cluster hamlRubyTop add=rubyCurlyBlock 26 | 27 | syn cluster hamlComponent contains=hamlAttributes,hamlAttributesHash,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable 28 | syn cluster hamlEmbeddedRuby contains=hamlAttributesHash,hamlObject,hamlRuby,hamlRubyFilter 29 | syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment 30 | 31 | syn match hamlBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=hamlTag,hamlClassChar,hamlIdChar,hamlRuby,hamlPlainChar,hamlInterpolatable 32 | 33 | syn match hamlTag "%\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent 34 | syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="(" end=")" contained contains=htmlArg,hamlAttributeString,hamlAttributeVariable,htmlEvent,htmlCssDefinition nextgroup=@hamlComponent 35 | syn region hamlAttributesHash matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent 36 | syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent 37 | syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable 38 | syn match hamlSelfCloser "/" contained 39 | syn match hamlClassChar "\." contained nextgroup=hamlClass 40 | syn match hamlIdChar "#{\@!" contained nextgroup=hamlId 41 | syn match hamlClass "\%(\w\|-\|\:\)\+" contained nextgroup=@hamlComponent 42 | syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent 43 | syn region hamlDocType start="^\s*!!!" end="$" 44 | 45 | syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend 46 | syn region hamlRuby matchgroup=hamlRubyChar start="-" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend 47 | syn match hamlPlainChar "\\" contained 48 | syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="!\===\|!=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape,@hamlHtmlTop 49 | syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape 50 | syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD 51 | syn match hamlInterpolationEscape "\\\@" contained contains=@hamlRubyTop 53 | 54 | syn region hamlAttributeString start=+\%(=\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=hamlInterpolation,hamlInterpolationEscape 55 | syn region hamlAttributeString start=+\%(=\s*\)\@<="+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=hamlInterpolation,hamlInterpolationEscape 56 | syn match hamlAttributeVariable "\%(=\s*\)\@<=\%(@@\=\|\$\)\=\w\+" contained 57 | 58 | syn match hamlHelper "\[^]]*]" contained containedin=hamlHtmlComment 77 | 78 | hi def link hamlSelfCloser Special 79 | hi def link hamlDespacer Special 80 | hi def link hamlClassChar Special 81 | hi def link hamlIdChar Special 82 | hi def link hamlTag Special 83 | hi def link hamlClass Type 84 | hi def link hamlId Identifier 85 | hi def link hamlPlainChar Special 86 | hi def link hamlInterpolatableChar hamlRubyChar 87 | hi def link hamlRubyOutputChar hamlRubyChar 88 | hi def link hamlRubyChar Special 89 | hi def link hamlInterpolationDelimiter Delimiter 90 | hi def link hamlInterpolationEscape Special 91 | hi def link hamlAttributeString String 92 | hi def link hamlAttributeVariable Identifier 93 | hi def link hamlDocType PreProc 94 | hi def link hamlFilter PreProc 95 | hi def link hamlAttributesDelimiter Delimiter 96 | hi def link hamlObjectDelimiter Delimiter 97 | hi def link hamlHelper Function 98 | hi def link hamlHtmlComment hamlComment 99 | hi def link hamlComment Comment 100 | hi def link hamlIEConditional SpecialComment 101 | hi def link hamlError Error 102 | 103 | let b:current_syntax = "haml" 104 | 105 | if main_syntax == "haml" 106 | unlet main_syntax 107 | endif 108 | 109 | " vim:set sw=2: 110 | -------------------------------------------------------------------------------- /syntax/sass.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Sass 3 | " Maintainer: Tim Pope 4 | " Filenames: *.sass 5 | " Last Change: 2022 Mar 15 6 | 7 | if exists("b:current_syntax") 8 | finish 9 | endif 10 | 11 | runtime! syntax/css.vim 12 | 13 | syn case ignore 14 | 15 | syn cluster sassCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp 16 | syn cluster sassCssAttributes contains=css.*Attr,sassEndOfLineComment,scssComment,cssValue.*,cssColor,cssURL,sassDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp 17 | 18 | syn region sassDefinition matchgroup=cssBraces start="{" end="}" contains=TOP 19 | 20 | syn match sassProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:" contains=css.*Prop skipwhite nextgroup=sassCssAttribute contained containedin=sassDefinition 21 | syn match sassProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute 22 | syn match sassProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute 23 | syn match sassCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@sassCssAttributes,sassVariable,sassFunction,sassInterpolation 24 | syn match sassFlag "!\%(default\|global\|optional\)\>" contained 25 | syn match sassVariable "$[[:alnum:]_-]\+" 26 | syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=\%(||\)\==" nextgroup=sassCssAttribute skipwhite 27 | syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=:" nextgroup=sassCssAttribute skipwhite 28 | 29 | syn match sassFunction "\<\%(rgb\|rgba\|red\|green\|blue\|mix\)\>(\@=" contained 30 | syn match sassFunction "\<\%(hsl\|hsla\|hue\|saturation\|lightness\|adjust-hue\|lighten\|darken\|saturate\|desaturate\|grayscale\|complement\)\>(\@=" contained 31 | syn match sassFunction "\<\%(alpha\|opacity\|rgba\|opacify\|fade-in\|transparentize\|fade-out\)\>(\@=" contained 32 | syn match sassFunction "\<\%(unquote\|quote\)\>(\@=" contained 33 | syn match sassFunction "\<\%(percentage\|round\|ceil\|floor\|abs\)\>(\@=" contained 34 | syn match sassFunction "\<\%(type-of\|unit\|unitless\|comparable\)\>(\@=" contained 35 | 36 | syn region sassInterpolation matchgroup=sassInterpolationDelimiter start="#{" end="}" contains=@sassCssAttributes,sassVariable,sassFunction containedin=cssStringQ,cssStringQQ,cssPseudoClass,sassProperty 37 | 38 | syn match sassMixinName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute 39 | syn match sassMixin "^=" nextgroup=sassMixinName skipwhite 40 | syn match sassMixin "\%([{};]\s*\|^\s*\)\@<=@mixin" nextgroup=sassMixinName skipwhite 41 | syn match sassMixing "^\s\+\zs+" nextgroup=sassMixinName 42 | syn match sassMixing "\%([{};]\s*\|^\s*\)\@<=@include" nextgroup=sassMixinName skipwhite 43 | syn match sassExtend "\%([{};]\s*\|^\s*\)\@<=@extend" 44 | 45 | syn match sassFunctionName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute 46 | syn match sassFunctionDecl "\%([{};]\s*\|^\s*\)\@<=@function" nextgroup=sassFunctionName skipwhite 47 | syn match sassReturn "\%([{};]\s*\|^\s*\)\@<=@return" 48 | 49 | syn match sassEscape "^\s*\zs\\" 50 | syn match sassIdChar "#[[:alnum:]_-]\@=" nextgroup=sassId 51 | syn match sassId "[[:alnum:]_-]\+" contained 52 | syn match sassClassChar "\.[[:alnum:]_-]\@=" nextgroup=sassClass 53 | syn match sassPlaceholder "\%([{};]\s*\|^\s*\)\@<=%" nextgroup=sassClass 54 | syn match sassClass "[[:alnum:]_-]\+" contained 55 | syn match sassAmpersand "&" 56 | 57 | " TODO: Attribute namespaces 58 | " TODO: Arithmetic (including strings and concatenation) 59 | 60 | syn region sassMediaQuery matchgroup=sassMedia start="@media" end="[{};]\@=\|$" contains=sassMediaOperators 61 | syn region sassKeyframe matchgroup=cssAtKeyword start=/@\(-[a-z]\+-\)\=keyframes\>/ end=";\|$" contains=cssVendor,cssComment nextgroup=cssDefinition 62 | syn keyword sassMediaOperators and not only contained 63 | syn region sassCharset start="@charset" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType 64 | syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType 65 | syn region sassDebugLine end=";\|$" matchgroup=sassDebug start="@debug\>" contains=@sassCssAttributes,sassVariable,sassFunction 66 | syn region sassWarnLine end=";\|$" matchgroup=sassWarn start="@warn\>" contains=@sassCssAttributes,sassVariable,sassFunction 67 | syn region sassControlLine matchgroup=sassControl start="@\%(if\|else\%(\s\+if\)\=\|while\|for\|each\)\>" end="[{};]\@=\|$" contains=sassFor,@sassCssAttributes,sassVariable,sassFunction 68 | syn keyword sassFor from to through in contained 69 | 70 | syn keyword sassTodo FIXME NOTE TODO OPTIMIZE XXX contained 71 | syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell 72 | syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell 73 | syn match sassEndOfLineComment "//.*" contains=sassComment,sassTodo,@Spell 74 | 75 | hi def link sassEndOfLineComment sassComment 76 | hi def link sassCssComment sassComment 77 | hi def link sassComment Comment 78 | hi def link sassFlag cssImportant 79 | hi def link sassVariable Identifier 80 | hi def link sassFunction Function 81 | hi def link sassMixing PreProc 82 | hi def link sassMixin PreProc 83 | hi def link sassPlaceholder sassClassChar 84 | hi def link sassExtend PreProc 85 | hi def link sassFunctionDecl PreProc 86 | hi def link sassReturn PreProc 87 | hi def link sassTodo Todo 88 | hi def link sassCharset PreProc 89 | hi def link sassMedia PreProc 90 | hi def link sassMediaOperators PreProc 91 | hi def link sassInclude Include 92 | hi def link sassDebug sassControl 93 | hi def link sassWarn sassControl 94 | hi def link sassControl PreProc 95 | hi def link sassFor PreProc 96 | hi def link sassEscape Special 97 | hi def link sassIdChar Special 98 | hi def link sassClassChar Special 99 | hi def link sassInterpolationDelimiter Delimiter 100 | hi def link sassAmpersand Character 101 | hi def link sassId Identifier 102 | hi def link sassClass Type 103 | 104 | let b:current_syntax = "sass" 105 | 106 | " vim:set sw=2: 107 | -------------------------------------------------------------------------------- /syntax/scss.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: SCSS 3 | " Maintainer: Tim Pope 4 | " Filenames: *.scss 5 | " Last Change: 2010 Jul 26 6 | 7 | if exists("b:current_syntax") 8 | finish 9 | endif 10 | 11 | runtime! syntax/sass.vim 12 | 13 | syn clear sassComment 14 | syn clear sassCssComment 15 | syn clear sassEndOfLineComment 16 | 17 | syn match scssComment "//.*" contains=sassTodo,@Spell 18 | syn region scssCssComment start="/\*" end="\*/" contains=sassTodo,@Spell 19 | 20 | hi def link scssCssComment scssComment 21 | hi def link scssComment Comment 22 | 23 | let b:current_syntax = "scss" 24 | 25 | " vim:set sw=2: 26 | --------------------------------------------------------------------------------