blob: 9ce446137ae731824f3d8c18fec29bc6dd40eebf [file] [log] [blame]
Bram Moolenaarc236c162008-07-13 17:41:49 +00001" Vim filetype plugin
Bram Moolenaar0ed0eea2010-07-26 22:21:27 +02002" Language: Sass
3" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
Bram Moolenaarc08ee742019-12-05 22:47:25 +01004" Last Change: 2019 Dec 05
Bram Moolenaarc236c162008-07-13 17:41:49 +00005
6" Only do this when not done yet for this buffer
7if exists("b:did_ftplugin")
8 finish
9endif
10let b:did_ftplugin = 1
11
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020012let b:undo_ftplugin = "setl com< cms< def< inc< inex< ofu< sua<"
Bram Moolenaarc236c162008-07-13 17:41:49 +000013
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020014setlocal comments=://
Bram Moolenaarc236c162008-07-13 17:41:49 +000015setlocal commentstring=//\ %s
Bram Moolenaarc08ee742019-12-05 22:47:25 +010016setlocal includeexpr=SassIncludeExpr(v:fname)
Bram Moolenaarc236c162008-07-13 17:41:49 +000017setlocal omnifunc=csscomplete#CompleteCSS
Bram Moolenaar0ed0eea2010-07-26 22:21:27 +020018setlocal suffixesadd=.sass,.scss,.css
Bram Moolenaarc08ee742019-12-05 22:47:25 +010019if &filetype =~# '\<s[ac]ss]\>'
20 setlocal iskeyword+=-
21 setlocal iskeyword+=$
22 setlocal iskeyword+=%
23 let b:undo_ftplugin .= ' isk<'
24endif
Bram Moolenaarc236c162008-07-13 17:41:49 +000025
Bram Moolenaarc08ee742019-12-05 22:47:25 +010026let &l:define = '^\C\v\s*%(\@function|\@mixin|\=)|^\s*%(\$[[:alnum:]-]+:|[%.][:alnum:]-]+\s*%(\{|$))@='
Bram Moolenaar0ed0eea2010-07-26 22:21:27 +020027let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
Bram Moolenaarc236c162008-07-13 17:41:49 +000028
Bram Moolenaarc08ee742019-12-05 22:47:25 +010029function! SassIncludeExpr(file) abort
30 let partial = substitute(a:file, '\%(.*/\|^\)\zs', '_', '')
31 if !empty(findfile(partial))
32 return partial
33 endif
34 return a:file
35endfunction
36
Bram Moolenaarc236c162008-07-13 17:41:49 +000037" vim:set sw=2: