sass.vim 977 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. " Vim filetype plugin
  2. " Language: Sass
  3. " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
  4. " Last Change: 2019 Dec 05
  5. " Only do this when not done yet for this buffer
  6. if exists("b:did_ftplugin")
  7. finish
  8. endif
  9. let b:did_ftplugin = 1
  10. let b:undo_ftplugin = "setl com< cms< def< inc< inex< ofu< sua<"
  11. setlocal comments=://
  12. setlocal commentstring=//\ %s
  13. setlocal includeexpr=SassIncludeExpr(v:fname)
  14. setlocal omnifunc=csscomplete#CompleteCSS
  15. setlocal suffixesadd=.sass,.scss,.css
  16. if &filetype =~# '\<s[ac]ss]\>'
  17. setlocal iskeyword+=-
  18. setlocal iskeyword+=$
  19. setlocal iskeyword+=%
  20. let b:undo_ftplugin .= ' isk<'
  21. endif
  22. let &l:define = '^\C\v\s*%(\@function|\@mixin|\=)|^\s*%(\$[[:alnum:]-]+:|[%.][:alnum:]-]+\s*%(\{|$))@='
  23. let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
  24. function! SassIncludeExpr(file) abort
  25. let partial = substitute(a:file, '\%(.*/\|^\)\zs', '_', '')
  26. if !empty(findfile(partial))
  27. return partial
  28. endif
  29. return a:file
  30. endfunction
  31. " vim:set sw=2: