robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Christian Clasonvim-patch:a907c91992167709597a1d

master
926 B38 linesraw
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")
7  finish
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")
19  finish
20endif
21
22let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)'
23let s:extend = '^\s*\%(@extend\|@include\|+\)'
24
25function! GetSassIndent()
26  let lnum = prevnonblank(v:lnum-1)
27  let line = substitute(getline(lnum),'\s\+$','','')
28  let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
29  let line = substitute(line,'^\s\+','','')
30  let indent = indent(lnum)
31  if line !~ s:property && line !~ s:extend && cline =~ s:property
32    return indent + shiftwidth()
33  else
34    return -1
35  endif
36endfunction
37
38" vim:set sw=2: