Compare commits

56 Commits

Author SHA1 Message Date
Phil Oye
8b526e7e1b Merge 98d9d7d170 into c30ee7d885 2024-11-30 16:26:27 +00:00
Dan Church
c30ee7d885 Fix &isk not applying when editing SASS/SCSS 2024-09-08 18:35:07 -04:00
Tim Pope
95a095a4d2 Use recommended_style pattern for indenting defaults 2022-08-22 15:15:04 -04:00
Tim Pope
2824214c61 Remove unused variables 2022-08-22 15:11:53 -04:00
Tim Pope
3126b9a8b5 Sync with official runtime files 2022-08-22 15:07:28 -04:00
Tim Pope
9b9c18b78d Add missing b:undo_indent 2021-09-24 09:01:09 -04:00
Yang XinYu
467d0ee60a Add sassKeyframe (#93) 2020-08-26 17:38:20 -04:00
Tim Pope
b4083d169d Sync with official runtime files 2019-11-30 19:44:44 -05:00
Tim Pope
b8c2473a85 Add sponsor button 2019-11-12 19:36:13 -05:00
Tim Pope
ca22091688 Stop setting shiftwidth and expandtab 2018-08-29 20:09:11 -04:00
Nathaniel Watts
98645ebe88 Add colon classes to HAML syntax
This adds syntax detection for HAML files.

An example would be if using classes provided by [Tailwind CSS][1]

IE:

```html
<div class="flex sm:inline-flex md:block lg:hidden xl:flex ...">
  <!-- ... -->
</div>
```

```haml
.flex.sm:inline-flex.md:block.lg:hidden.xl:flex
  # ...
```

[1]: https://tailwindcss.com/docs/flexbox-display#responsive
2018-08-21 17:26:03 -04:00
Tim Pope
cac9d806f0 Limit Sass 'iskeyword' override to pure Sass files 2018-08-10 03:59:36 -04:00
Tim Pope
ac1cb44d58 Set 'define' to match HTML ids in Haml files 2018-07-08 17:08:50 -04:00
Tim Pope
46ef33e675 Proper 'define' support
Guessing I'm going to get some push back on the iskeyword tweak, but man
is this useful.  Press [d on a variable to see its value.  Press [<C-D>
on a mixin to jump to its definition.  Placeholder classes and functions
work too.
2018-05-26 19:15:27 -04:00
Tim Pope
8a238367f0 Highlight Sass placeholder class like actual class 2018-05-26 19:15:27 -04:00
Tim Pope
1457cf1f94 Smarter Sass 'includeexpr' 2018-05-26 19:15:27 -04:00
Antonio Ospite
d580aa3a3f Fix highlighting comments in scss files
The sccs syntax file imports the definitions of the sass indented syntax
where comments follow some indentation rules[1].

These indentation rules are not valid in the scss syntax[2], and their
visual rendering is confusing.

So delete the syntax items referring to sass comments files before using
the newly defined ones.

Also derive the visual style directly from Comment instead of
sassComment, just to stress that the comment definitions are distinct
from the sass ones.

[1] http://sass-lang.com/documentation/file.INDENTED_SYNTAX.html#comments
[2] http://sass-lang.com/documentation/file.SASS_REFERENCE.html#comments

Closes #78.
2017-07-19 14:23:01 -04:00
Tim Pope
4e130d6c60 Drop support for old style bang variables 2017-05-08 16:45:26 -04:00
Tim Pope
09eee9bb21 Highlight !global and !optional 2017-05-08 16:45:03 -04:00
Tim Pope
8f7982e06e Sync with upstream 2017-05-08 16:34:21 -04:00
Tim Pope
1f2e47c78c Use shiftwidth() when available
Closes https://github.com/tpope/vim-haml/issues/76
2016-02-11 12:47:57 -05:00
Tim Pope
7d86692010 Remove commented code 2016-02-11 12:43:03 -05:00
Tim Pope
5c1189022d Minimal README 2015-10-05 15:41:52 -04:00
Tim Pope
204e327211 Fix comments option
Closes #68.
2014-08-08 12:24:30 -04:00
Tim Pope
9b7c3341c2 Set comments option 2014-08-07 19:55:50 -04:00
Tim Pope
18ff62828c Fix @media 2014-06-10 19:03:07 -04:00
Tim Pope
4d0834f05e Merge pull request #62 from mil/sass-mediaquery-fix
add syntax highlighting for mediaqueries in sass
2014-05-12 22:17:27 -04:00
mil
8cfc8eff59 add syntax highlighting for mediaqueries in sass 2014-05-12 17:24:04 -04:00
Tim Pope
c5b09ad120 Tighten check for inline JavaScript
Closes #60.
2014-04-04 17:36:37 -04:00
Tim Pope
b58f1cffa8 Treat hamlc as haml
Closes #57.
2014-04-03 18:09:48 -04:00
Tim Pope
90c0d3a4e0 Drop -c from compilers
Closes #52.
2014-04-03 08:45:48 -04:00
Tim Pope
6dbd89ff4e Merge pull request #55 from jigfox/add_charset_highlighting
add charset highlighting
2014-03-22 16:08:57 -04:00
Jens Fahnenbruck
6d664463c3 use PreProc as advised by @tpope 2014-03-22 19:53:03 +01:00
Jens Fahnenbruck
3e54f9f58a add charset highlighting
it uses the same highighting as @import
2014-03-22 17:38:01 +01:00
Tim Pope
33279476a6 Add headers to compilers 2013-06-02 13:34:22 -04:00
Gregory McIntyre
410a6a0517 Highlight comments on the end of lines in SASS 2013-05-27 21:49:45 -04:00
Tim Pope
81af73f76e Remove <:> from 'matchpairs'
Closes #46.
2013-05-27 21:25:18 -04:00
Tim Pope
ce0cfeddbd Merge pull request #44 from jacknagel/compiler
Compiler plugins for sass and haml
2012-12-04 18:23:25 -08:00
Jack Nagel
c637b6ea4c Add compiler plugin for haml 2012-12-04 15:54:23 -06:00
Jack Nagel
b61cfdbe0d Add a compiler plugin for sass 2012-12-04 15:54:20 -06:00
Tim Pope
b5736000da Merge pull request #43 from mattsacks/add-placeholders
Add SASS 3.2 placeholders
2012-11-23 21:24:36 -08:00
Matt Sacks
5a11a44b34 Add SASS 3.2 placeholders
Example: %placeholder { color: blue; }
Will match "%placeholder" as a PreProc
2012-11-20 11:09:32 -08:00
Phil Oye
98d9d7d170 whitespace 2012-11-07 12:18:47 +11:00
Phil Oye
5b68e31c8b Add syntax highlighting for inline coffeescript in haml 2012-11-07 12:11:28 +11:00
Tim Pope
9a891ed78a Fix highlight of @import "foo/*.png"
Closes #27.
2012-07-12 08:45:20 -04:00
Aaron Jensen
6284c188c2 Highlighting for @function and @return 2012-05-15 22:09:44 -04:00
Jo Liss
b92ad53b89 Support *.hamlbars
Hamlbars is plain Haml with an "hb" helper Ruby function.

https://github.com/jamesotron/hamlbars
2012-05-01 22:03:41 -04:00
Hugues Lismonde
3490c63d68 Allow whitespace between property name and colon 2012-03-15 11:28:14 -04:00
Matt Sacks
d48e9f1da3 Add interpolation in pseudo elements 2012-03-08 12:52:25 -05:00
Tim Pope
a995d4aabb Fix indent after base and input tags
Closes #25.
2011-10-16 16:23:35 -04:00
Tim Pope
de3e72a384 Merge pull request #16 from graywh/patch-1
Add SASS "@each ... in" syntax
2011-05-11 20:49:46 -07:00
Will Gray
6e6ecb3f04 Add SASS "@each ... in" syntax. 2011-04-29 07:59:04 -07:00
Tim Pope
cc56253395 Allow whitespace before mixin name 2011-04-28 17:45:04 -04:00
Tim Pope
a0345d5c22 Account for @include before properties 2010-11-08 23:28:36 -05:00
Austin Taylor
79041b05a7 Don't try to indent properties that follow mixins 2010-11-08 22:21:03 -05:00
Tim Pope
47c4dff622 Bump timestamps as submitted upstream 2010-08-09 16:23:28 -04:00
13 changed files with 165 additions and 47 deletions

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
github: tpope
custom: ["https://www.paypal.me/vimpope"]

9
README.markdown Normal file
View File

@@ -0,0 +1,9 @@
# vim-haml
This project contains the runtime files for Haml, Sass, and SCSS that ship
with Vim. You only need it if you want the very latest updates.
## License
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
See `:help license`.

28
compiler/haml.vim Normal file
View File

@@ -0,0 +1,28 @@
" Vim compiler file
" Compiler: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2016 Aug 29
if exists("current_compiler")
finish
endif
let current_compiler = "haml"
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=haml
CompilerSet errorformat=
\Haml\ %trror\ on\ line\ %l:\ %m,
\Syntax\ %trror\ on\ line\ %l:\ %m,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set sw=2 sts=2:

30
compiler/sass.vim Normal file
View File

@@ -0,0 +1,30 @@
" Vim compiler file
" Compiler: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2016 Aug 29
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:

View File

@@ -1,3 +1,3 @@
autocmd BufNewFile,BufRead *.haml setf haml
autocmd BufNewFile,BufRead *.haml,*.hamlbars,*.hamlc setf haml
autocmd BufNewFile,BufRead *.sass setf sass
autocmd BufNewFile,BufRead *.scss setf scss

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 May 21
" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -18,6 +18,7 @@ let s:match_words = ""
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
unlet! b:did_ftplugin
set matchpairs-=<:>
" Override our defaults if these were set by an included ftplugin.
if exists("b:undo_ftplugin")
@@ -36,6 +37,8 @@ endif
runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim
let b:did_ftplugin = 1
let &l:define .= empty(&l:define ? '' : '\|') . '^\s*\%(%\w*\)\=\%(\.[[:alnum:]_-]\+\)*#'
" Combine the new set of values with those previously included.
if exists("b:undo_ftplugin")
let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin
@@ -59,9 +62,10 @@ endif
setlocal comments= commentstring=-#\ %s
let b:undo_ftplugin = "setl cms< com< "
let b:undo_ftplugin = "setl def< cms< com< "
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
let &cpo = s:save_cpo
unlet s:save_cpo
" vim:set sw=2:

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 Jul 26
" Last Change: 2019 Dec 05
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -9,14 +9,34 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
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 includeexpr=SassIncludeExpr(v:fname)
setlocal omnifunc=csscomplete#CompleteCSS
setlocal suffixesadd=.sass,.scss,.css
if &filetype =~# '\<s[ac]ss\>'
setlocal iskeyword+=-
setlocal iskeyword+=$
setlocal iskeyword+=%
let b:undo_ftplugin .= ' isk<'
endif
if get(g:, 'sass_recommended_style', 1)
setlocal shiftwidth=2 softtabstop=2 expandtab
let b:undo_ftplugin .= ' sw< sts< et<'
endif
let &l:define = '^\C\v\s*%(\@function|\@mixin|\=)|^\s*%(\$[[:alnum:]-]+:|[%.][:alnum:]-]+\s*%(\{|$))@='
let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
function! SassIncludeExpr(file) abort
let partial = substitute(a:file, '\%(.*/\|^\)\zs', '_', '')
if !empty(findfile(partial))
return partial
endif
return a:file
endfunction
" vim:set sw=2:

View File

@@ -1,12 +1,13 @@
" Vim filetype plugin
" Language: SCSS
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 Jul 26
" Last Change: 2016 Aug 29
if exists("b:did_ftplugin")
finish
endif
runtime! ftplugin/sass.vim
setlocal comments=s1:/*,mb:*,ex:*/,://
" vim:set sw=2:

View File

@@ -1,7 +1,7 @@
" Vim indent file
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 May 21
" Last Change: 2022 Mar 15
if exists("b:did_indent")
finish
@@ -10,10 +10,12 @@ runtime! indent/ruby.vim
unlet! b:did_indent
let b:did_indent = 1
setlocal autoindent sw=2 et
setlocal autoindent
setlocal indentexpr=GetHamlIndent()
setlocal indentkeys=o,O,*<Return>,},],0),!^F,=end,=else,=elsif,=rescue,=ensure,=when
let b:undo_indent = "setl ai< inde< indk<"
" Only define the function once.
if exists("*GetHamlIndent")
finish
@@ -23,7 +25,7 @@ let s:attributes = '\%({.\{-\}}\|\[.\{-\}\]\)'
let s:tag = '\%([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
if !exists('g:haml_self_closing_tags')
let g:haml_self_closing_tags = 'meta|link|img|hr|br'
let g:haml_self_closing_tags = 'base|link|meta|br|hr|img|input'
endif
function! GetHamlIndent()
@@ -37,10 +39,11 @@ function! GetHamlIndent()
let line = substitute(line,'^\s\+','','')
let indent = indent(lnum)
let cindent = indent(v:lnum)
let sw = shiftwidth()
if cline =~# '\v^-\s*%(elsif|else|when)>'
let indent = cindent < indent ? cindent : indent - &sw
let indent = cindent < indent ? cindent : indent - sw
endif
let increase = indent + &sw
let increase = indent + sw
if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif

View File

@@ -1,36 +1,35 @@
" Vim indent file
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 May 21
" Last Change: 2022 Mar 15
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent sw=2 et
setlocal autoindent
setlocal indentexpr=GetSassIndent()
setlocal indentkeys=o,O,*<Return>,<:>,!^F
let b:undo_indent = "setl ai< inde< indk<"
" Only define the function once.
if exists("*GetSassIndent")
finish
endif
let s:property = '^\s*:\|^\s*[[:alnum:]-]\+\%(:\|\s*=\)'
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 && cline =~ s:property
return indent + &sw
"elseif line =~ s:property && cline !~ s:property
"return indent - &sw
if line !~ s:property && line !~ s:extend && cline =~ s:property
return indent + shiftwidth()
else
return -1
endif

View File

@@ -2,7 +2,7 @@
" Language: Haml
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.haml
" Last Change: 2010 Jul 26
" Last Change: 2019 Dec 05
if exists("b:current_syntax")
finish
@@ -38,7 +38,7 @@ syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,
syn match hamlSelfCloser "/" contained
syn match hamlClassChar "\." contained nextgroup=hamlClass
syn match hamlIdChar "#{\@!" contained nextgroup=hamlId
syn match hamlClass "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
syn match hamlClass "\%(\w\|-\|\:\)\+" contained nextgroup=@hamlComponent
syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
syn region hamlDocType start="^\s*!!!" end="$"
@@ -59,15 +59,16 @@ syn match hamlHelper "\<action_view?\|\<block_is_haml?\|\<is_haml?\|\.\@<!\<f
syn keyword hamlHelper capture_haml escape_once find_and_preserve haml_concat haml_indent haml_tag html_attrs html_esape init_haml_helpers list_of non_haml precede preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop
syn cluster hamlHtmlTop contains=@htmlTop,htmlBold,htmlItalic,htmlUnderline
syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|redcloth\|textile\|markdown\|maruku\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlInterpolation
syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\|cdata\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=hamlInterpolation
syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlErbInterpolation
syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlRubyTop
syn region hamlJavascriptFilter matchgroup=hamlFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript,hamlInterpolation keepend
syn region hamlCSSFilter matchgroup=hamlFilter start="^\z(\s*\):css\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,hamlInterpolation keepend
syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop
syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|redcloth\|textile\|markdown\|maruku\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlInterpolation
syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\|cdata\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=hamlInterpolation
syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlErbInterpolation
syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlRubyTop
syn region hamlJavascriptFilter matchgroup=hamlFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript,hamlInterpolation keepend
syn region hamlCSSFilter matchgroup=hamlFilter start="^\z(\s*\):css\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,hamlInterpolation keepend
syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop
syn region hamlCoffeescriptFilter matchgroup=hamlFilter start="^\z(\s*\):coffeescript\s*$" end="^\%(\z1 \| *$\)\@!" contains=@coffee
syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlJavaScript keepend
syn region hamlJavascriptBlock start="^\z(\s*\)%script\%((type=[\"']text/javascript[\"'])\)\=\s*$" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlJavaScript keepend
syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlCss keepend
syn match hamlError "\$" contained

View File

@@ -2,7 +2,7 @@
" Language: Sass
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.sass
" Last Change: 2010 Jul 28
" Last Change: 2022 Mar 15
if exists("b:current_syntax")
finish
@@ -13,16 +13,15 @@ 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,scssComment,cssValue.*,cssColor,cssURL,sassDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp
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:]-]\|#{[^{}]*}\)\+:" contains=css.*Prop skipwhite nextgroup=sassCssAttribute contained containedin=sassDefinition
syn match sassProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
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 sassFlag "!\%(default\|global\|optional\)\>" contained
syn match sassVariable "$[[:alnum:]_-]\+"
syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=\%(||\)\==" nextgroup=sassCssAttribute skipwhite
syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=:" nextgroup=sassCssAttribute skipwhite
@@ -34,44 +33,61 @@ 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,sassProperty
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
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 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 sassPlaceholder "\%([{};]\s*\|^\s*\)\@<=%" nextgroup=sassClass
syn match sassClass "[[:alnum:]_-]\+" contained
syn match sassAmpersand "&"
" TODO: Attribute namespaces
" TODO: Arithmetic (including strings and concatenation)
syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssURL,cssUnicodeEscape,cssMediaType
syn region sassMediaQuery matchgroup=sassMedia start="@media" end="[{};]\@=\|$" contains=sassMediaOperators
syn region sassKeyframe matchgroup=cssAtKeyword start=/@\(-[a-z]\+-\)\=keyframes\>/ end=";\|$" contains=cssVendor,cssComment nextgroup=cssDefinition
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\)\>" end="[{};]\@=\|$" contains=sassFor,@sassCssAttributes,sassVariable,sassFunction
syn keyword sassFor from to through contained
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 sassFlag 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 sassClassChar
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

View File

@@ -10,10 +10,15 @@ endif
runtime! syntax/sass.vim
syn match scssComment "//.*" contains=sassTodo,@Spell
syn region scssComment start="/\*" end="\*/" contains=sassTodo,@Spell
syn clear sassComment
syn clear sassCssComment
syn clear sassEndOfLineComment
hi def link scssComment sassComment
syn match scssComment "//.*" contains=sassTodo,@Spell
syn region scssCssComment start="/\*" end="\*/" contains=sassTodo,@Spell
hi def link scssCssComment scssComment
hi def link scssComment Comment
let b:current_syntax = "scss"