3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4 " Last Change: 2010 May 21
6 if exists("b:did_indent")
11 setlocal autoindent sw=2 et
12 setlocal indentexpr=GetSassIndent()
13 setlocal indentkeys=o,O,*<Return>,<:>,!^F
15 " Only define the function once.
16 if exists("*GetSassIndent")
20 let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)'
21 let s:extend = '^\s*\%(@extend\|@include\|+\)'
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
33 "elseif line =~ s:property && cline !~ s:property