"Fossies" - the Fresh Open Source Software Archive

Member "vim-8.2.1354/runtime/indent/sass.vim" (2 Aug 2020, 950 Bytes) of package /linux/misc/vim-8.2.1354.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) vimscript source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 " Vim indent file
    2 " Language: Sass
    3 " Maintainer:   Tim Pope <vimNOSPAM@tpope.org>
    4 " Last Change:  2017 Jun 13
    5 
    6 if exists("b:did_indent")
    7   finish
    8 endif
    9 let b:did_indent = 1
   10 
   11 setlocal autoindent sw=2 et
   12 setlocal indentexpr=GetSassIndent()
   13 setlocal indentkeys=o,O,*<Return>,<:>,!^F
   14 
   15 " Only define the function once.
   16 if exists("*GetSassIndent")
   17   finish
   18 endif
   19 
   20 let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)'
   21 let s:extend = '^\s*\%(@extend\|@include\|+\)'
   22 
   23 function! GetSassIndent()
   24   let lnum = prevnonblank(v:lnum-1)
   25   let line = substitute(getline(lnum),'\s\+$','','')
   26   let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
   27   let lastcol = strlen(line)
   28   let line = substitute(line,'^\s\+','','')
   29   let indent = indent(lnum)
   30   let cindent = indent(v:lnum)
   31   if line !~ s:property && line !~ s:extend && cline =~ s:property
   32     return indent + shiftwidth()
   33   else
   34     return -1
   35   endif
   36 endfunction
   37 
   38 " vim:set sw=2: