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