]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - vim/indent/sass.vim
Remove powerline config
[rbdr/dotfiles] / vim / indent / sass.vim
... / ...
CommitLineData
1" Vim indent file
2" Language: Sass
3" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4" Last Change: 2010 May 21
5
6if exists("b:did_indent")
7 finish
8endif
9let b:did_indent = 1
10
11setlocal autoindent sw=2 et
12setlocal indentexpr=GetSassIndent()
13setlocal indentkeys=o,O,*<Return>,<:>,!^F
14
15" Only define the function once.
16if exists("*GetSassIndent")
17 finish
18endif
19
20let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)'
21let s:extend = '^\s*\%(@extend\|@include\|+\)'
22
23function! 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 + &sw
33 "elseif line =~ s:property && cline !~ s:property
34 "return indent - &sw
35 else
36 return -1
37 endif
38endfunction
39
40" vim:set sw=2: