neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

sass.vim (1113B)


      1 " Vim filetype plugin
      2 " Language:	Sass
      3 " Maintainer:	Tim Pope <vimNOSPAM@tpope.org>
      4 " Last Change:	2023 Dec 28
      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 =~# '\<s[ac]ss]\>'
     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: