mirror of
https://github.com/tpope/vim-haml.git
synced 2025-12-06 17:24:24 +08:00
Compare commits
108 Commits
vim7.2
...
d671c5ac45
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d671c5ac45 | ||
|
|
c30ee7d885 | ||
|
|
95a095a4d2 | ||
|
|
2824214c61 | ||
|
|
3126b9a8b5 | ||
|
|
541e5ae6d5 | ||
|
|
c9b3c2f1cc | ||
|
|
f65ff3f0a2 | ||
|
|
9b9c18b78d | ||
|
|
467d0ee60a | ||
|
|
b4083d169d | ||
|
|
b8c2473a85 | ||
|
|
ca22091688 | ||
|
|
98645ebe88 | ||
|
|
cac9d806f0 | ||
|
|
ac1cb44d58 | ||
|
|
46ef33e675 | ||
|
|
8a238367f0 | ||
|
|
1457cf1f94 | ||
|
|
d580aa3a3f | ||
|
|
4e130d6c60 | ||
|
|
09eee9bb21 | ||
|
|
8f7982e06e | ||
|
|
1f2e47c78c | ||
|
|
7d86692010 | ||
|
|
5c1189022d | ||
|
|
204e327211 | ||
|
|
9b7c3341c2 | ||
|
|
18ff62828c | ||
|
|
4d0834f05e | ||
|
|
8cfc8eff59 | ||
|
|
c5b09ad120 | ||
|
|
b58f1cffa8 | ||
|
|
90c0d3a4e0 | ||
|
|
6dbd89ff4e | ||
|
|
6d664463c3 | ||
|
|
3e54f9f58a | ||
|
|
33279476a6 | ||
|
|
410a6a0517 | ||
|
|
81af73f76e | ||
|
|
ce0cfeddbd | ||
|
|
c637b6ea4c | ||
|
|
b61cfdbe0d | ||
|
|
b5736000da | ||
|
|
5a11a44b34 | ||
|
|
9a891ed78a | ||
|
|
6284c188c2 | ||
|
|
b92ad53b89 | ||
|
|
3490c63d68 | ||
|
|
d48e9f1da3 | ||
|
|
a995d4aabb | ||
|
|
de3e72a384 | ||
|
|
6e6ecb3f04 | ||
|
|
cc56253395 | ||
|
|
a0345d5c22 | ||
|
|
79041b05a7 | ||
|
|
47c4dff622 | ||
|
|
fb83d43917 | ||
|
|
55f14fd4fc | ||
|
|
9e25996111 | ||
|
|
ca196e671b | ||
|
|
627e3950f1 | ||
|
|
c8de253905 | ||
|
|
dd0a6233d5 | ||
|
|
caf7f9cf29 | ||
|
|
e448efdb86 | ||
|
|
bd43cd97f0 | ||
|
|
e87143f99e | ||
|
|
54139ceb5b | ||
|
|
8a78d1b30e | ||
|
|
358eb131ec | ||
|
|
6228a6a1ef | ||
|
|
980b746e31 | ||
|
|
38b8d33fc3 | ||
|
|
09d94a600e | ||
|
|
9c5bdb44ac | ||
|
|
a91cdb399d | ||
|
|
c583d3a236 | ||
|
|
30405bd751 | ||
|
|
d8fd096eca | ||
|
|
e36189b912 | ||
|
|
b8414bd238 | ||
|
|
8196ec61cf | ||
|
|
a9c093463f | ||
|
|
dfb1f770d5 | ||
|
|
349f235950 | ||
|
|
567c6d8f47 | ||
|
|
d29da9581f | ||
|
|
db4d42dcde | ||
|
|
b80f2c5359 | ||
|
|
8f9e77eb23 | ||
|
|
f790601bac | ||
|
|
db054e782e | ||
|
|
bd62a5eda0 | ||
|
|
5ffacbf2f9 | ||
|
|
cabed106e2 | ||
|
|
d8d48f24b9 | ||
|
|
4b23eccc45 | ||
|
|
2a8ce3b36e | ||
|
|
c745f722af | ||
|
|
ea667efff7 | ||
|
|
9dba20dc31 | ||
|
|
3636c3c7ed | ||
|
|
9f2c7ed4af | ||
|
|
d547b07025 | ||
|
|
6f3dc2e792 | ||
|
|
52758326d3 | ||
|
|
dd7157447b |
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
github: tpope
|
||||
custom: ["https://www.paypal.me/vimpope"]
|
||||
9
README.markdown
Normal file
9
README.markdown
Normal 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
28
compiler/haml.vim
Normal 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
30
compiler/sass.vim
Normal 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:
|
||||
@@ -1,2 +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
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Haml
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Language: Haml
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2019 Dec 05
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
@@ -17,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")
|
||||
@@ -35,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
|
||||
@@ -56,11 +60,12 @@ if exists("loaded_matchit")
|
||||
let b:match_words = s:match_words
|
||||
endif
|
||||
|
||||
setlocal commentstring=-#\ %s
|
||||
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:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2019 Dec 05
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
@@ -8,11 +9,34 @@ if exists("b:did_ftplugin")
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let b:undo_ftplugin = "setl cms< inc< ofu<"
|
||||
let b:undo_ftplugin = "setl com< cms< def< inc< inex< ofu< sua<"
|
||||
|
||||
setlocal comments=://
|
||||
setlocal commentstring=//\ %s
|
||||
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
|
||||
|
||||
let &l:include = '^\s*@import\s\+\%(url(\)\='
|
||||
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:
|
||||
|
||||
13
ftplugin/scss.vim
Normal file
13
ftplugin/scss.vim
Normal file
@@ -0,0 +1,13 @@
|
||||
" Vim filetype plugin
|
||||
" Language: SCSS
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" 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:
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim indent file
|
||||
" Language: HAML
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2007 Dec 16
|
||||
" Language: Haml
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" 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,15 +39,14 @@ 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
|
||||
"let indent = indent == indent(lnum) ? -1 : indent
|
||||
"let indent = indent > indent(lnum) + &sw ? indent(lnum) + &sw : indent
|
||||
|
||||
let group = synIDattr(synID(lnum,lastcol,1),'name')
|
||||
|
||||
@@ -53,9 +54,11 @@ function! GetHamlIndent()
|
||||
return indent
|
||||
elseif line =~ '^/\%(\[[^]]*\]\)\=$'
|
||||
return increase
|
||||
elseif line =~ '^:'
|
||||
elseif group == 'hamlFilter'
|
||||
return increase
|
||||
elseif line =~ '^'.s:tag.'[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do |[^|]*|\s*$\)'
|
||||
elseif line =~ '^'.s:tag.'[&!]\=[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)'
|
||||
return increase
|
||||
elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$'
|
||||
return increase
|
||||
elseif line == '-#'
|
||||
return increase
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
" Vim indent file
|
||||
" Language: SASS
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Last Change: 2007 Dec 16
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" 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:]-]\+:'
|
||||
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
|
||||
|
||||
12
indent/scss.vim
Normal file
12
indent/scss.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
" 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:
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim syntax file
|
||||
" Language: Haml
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Filenames: *.haml
|
||||
" Language: Haml
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: *.haml
|
||||
" Last Change: 2019 Dec 05
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@@ -20,46 +21,58 @@ syn include @hamlRubyTop syntax/ruby.vim
|
||||
|
||||
syn case match
|
||||
|
||||
syn cluster hamlComponent contains=hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
|
||||
syn cluster hamlEmbeddedRuby contains=hamlAttributes,hamlObject,hamlRuby,hamlRubyFilter
|
||||
syn region rubyCurlyBlock start="{" end="}" contains=@hamlRubyTop contained
|
||||
syn cluster hamlRubyTop add=rubyCurlyBlock
|
||||
|
||||
syn cluster hamlComponent contains=hamlAttributes,hamlAttributesHash,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
|
||||
syn cluster hamlEmbeddedRuby contains=hamlAttributesHash,hamlObject,hamlRuby,hamlRubyFilter
|
||||
syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment
|
||||
|
||||
syn match hamlBegin "^\s*[<>&]\@!" nextgroup=hamlTag,hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlRuby,hamlPlainChar,hamlInterpolatable
|
||||
syn match hamlBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=hamlTag,hamlClassChar,hamlIdChar,hamlRuby,hamlPlainChar,hamlInterpolatable
|
||||
|
||||
syn match hamlTag "%\w\+" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent
|
||||
syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent
|
||||
syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent
|
||||
syn match hamlTag "%\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent
|
||||
syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="(" end=")" contained contains=htmlArg,hamlAttributeString,hamlAttributeVariable,htmlEvent,htmlCssDefinition nextgroup=@hamlComponent
|
||||
syn region hamlAttributesHash matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent
|
||||
syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent
|
||||
syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
|
||||
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 hamlIdChar "#{\@!" contained nextgroup=hamlId
|
||||
syn match hamlClass "\%(\w\|-\|\:\)\+" contained nextgroup=@hamlComponent
|
||||
syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
|
||||
syn region hamlDocType start="^\s*!!!" end="$"
|
||||
|
||||
syn region hamlRuby matchgroup=hamlRubyOutputChar start="[=~]" end="$" contained contains=@hamlRubyTop keepend
|
||||
syn region hamlRuby matchgroup=hamlRubyChar start="-" end="$" contained contains=@hamlRubyTop keepend
|
||||
syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend
|
||||
syn region hamlRuby matchgroup=hamlRubyChar start="-" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend
|
||||
syn match hamlPlainChar "\\" contained
|
||||
syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="==" end="$" keepend contained contains=hamlInterpolation
|
||||
syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contained contains=@hamlRubyTop
|
||||
syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="!\===\|!=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape,@hamlHtmlTop
|
||||
syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape
|
||||
syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD
|
||||
syn match hamlInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
|
||||
syn region hamlErbInterpolation matchgroup=hamlInterpolationDelimiter start="<%[=-]\=" end="-\=%>" contained contains=@hamlRubyTop
|
||||
|
||||
syn match hamlHelper "\<action_view?\|\.\@<!\<\%(flatten\|open\|puts\)" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
|
||||
syn keyword hamlHelper capture_haml find_and_preserve html_attrs init_haml_helpers list_of preced preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
|
||||
syn region hamlAttributeString start=+\%(=\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=hamlInterpolation,hamlInterpolationEscape
|
||||
syn region hamlAttributeString start=+\%(=\s*\)\@<="+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=hamlInterpolation,hamlInterpolationEscape
|
||||
syn match hamlAttributeVariable "\%(=\s*\)\@<=\%(@@\=\|\$\)\=\w\+" contained
|
||||
|
||||
syn match hamlHelper "\<action_view?\|\<block_is_haml?\|\<is_haml?\|\.\@<!\<flatten" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop
|
||||
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\|erb\|redcloth\|textile\|markdown\)\s*$" end="^\%(\z1 \)\@!" contains=@hamlHtmlTop,rubyInterpolation
|
||||
syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\)\s*$" end="^\%(\z1 \)\@!" contains=rubyInterpolation
|
||||
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 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 hamlJavascriptBlock start="^\z(\s*\)%script" 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 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
|
||||
|
||||
syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \)\@!" contains=rubyTodo
|
||||
syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \)\@!" contains=@hamlTop,rubyTodo
|
||||
syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \| *$\)\@!" contains=rubyTodo
|
||||
syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,rubyTodo
|
||||
syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment
|
||||
|
||||
hi def link hamlSelfCloser Special
|
||||
@@ -74,6 +87,9 @@ hi def link hamlInterpolatableChar hamlRubyChar
|
||||
hi def link hamlRubyOutputChar hamlRubyChar
|
||||
hi def link hamlRubyChar Special
|
||||
hi def link hamlInterpolationDelimiter Delimiter
|
||||
hi def link hamlInterpolationEscape Special
|
||||
hi def link hamlAttributeString String
|
||||
hi def link hamlAttributeVariable Identifier
|
||||
hi def link hamlDocType PreProc
|
||||
hi def link hamlFilter PreProc
|
||||
hi def link hamlAttributesDelimiter Delimiter
|
||||
@@ -86,4 +102,8 @@ hi def link hamlError Error
|
||||
|
||||
let b:current_syntax = "haml"
|
||||
|
||||
if main_syntax == "haml"
|
||||
unlet main_syntax
|
||||
endif
|
||||
|
||||
" vim:set sw=2:
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim syntax file
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
|
||||
" Filenames: *.sass
|
||||
" Language: Sass
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: *.sass
|
||||
" Last Change: 2022 Mar 15
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@@ -12,41 +13,90 @@ 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,cssComment,cssValue.*,cssColor,cssURL,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 match sassProperty "^\s*\zs\s\%([[:alnum:]-]\+:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute
|
||||
syn match sassCssAttribute ".*$" contained contains=@sassCssAttributes,sassConstant
|
||||
syn match sassConstant "![[:alnum:]_-]\+"
|
||||
syn match sassConstantAssignment "\%(![[:alnum:]_]\+\s*\)\@<==" nextgroup=sassCssAttribute skipwhite
|
||||
syn match sassMixin "^=.*"
|
||||
syn match sassMixing "^\s\+\zs+.*"
|
||||
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 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
|
||||
|
||||
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 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=cssComment,cssURL,cssUnicodeEscape,cssMediaType
|
||||
syn region sassMediaQuery matchgroup=sassMedia start="@media" end="[{};]\@=\|$" contains=sassMediaOperators,sassVariable,sassInterpolation,cssMediaProp,cssValueLength,cssAtRuleLogical,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssComment,cssCustomProp,cssFunctionName
|
||||
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\|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
|
||||
syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo
|
||||
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 sassConstant Identifier
|
||||
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
|
||||
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
|
||||
|
||||
25
syntax/scss.vim
Normal file
25
syntax/scss.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" Vim syntax file
|
||||
" Language: SCSS
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: *.scss
|
||||
" Last Change: 2010 Jul 26
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! syntax/sass.vim
|
||||
|
||||
syn clear sassComment
|
||||
syn clear sassCssComment
|
||||
syn clear sassEndOfLineComment
|
||||
|
||||
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"
|
||||
|
||||
" vim:set sw=2:
|
||||
Reference in New Issue
Block a user