Mercurial > vim
annotate runtime/indent/sass.vim @ 35042:efef66876fb4
Added tag v9.1.0370 for changeset e671080ef0e2e8d92a05044905761b1414755cf5
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 25 Apr 2024 21:30:12 +0200 |
parents | 92fd65eac53a |
children |
rev | line source |
---|---|
1668 | 1 " Vim indent file |
2202 | 2 " Language: Sass |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | |
34040
92fd65eac53a
runtime(sass): Provide sass_recommended_style option
Christian Brabandt <cb@256bit.org>
parents:
28141
diff
changeset
|
4 " Last Change: 2023 Dec 28 |
1668 | 5 |
6 if exists("b:did_indent") | |
7 finish | |
8 endif | |
9 let b:did_indent = 1 | |
10 | |
34040
92fd65eac53a
runtime(sass): Provide sass_recommended_style option
Christian Brabandt <cb@256bit.org>
parents:
28141
diff
changeset
|
11 setlocal autoindent |
1668 | 12 setlocal indentexpr=GetSassIndent() |
13 setlocal indentkeys=o,O,*<Return>,<:>,!^F | |
14 | |
28141 | 15 let b:undo_indent = "setl ai< inde< indk<" |
16 | |
1668 | 17 " Only define the function once. |
18 if exists("*GetSassIndent") | |
19 finish | |
20 endif | |
21 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
22 let s:property = '^\s*:\|^\s*[[:alnum:]#{}-]\+\%(:\|\s*=\)' |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
23 let s:extend = '^\s*\%(@extend\|@include\|+\)' |
1668 | 24 |
25 function! 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) | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2202
diff
changeset
|
31 if line !~ s:property && line !~ s:extend && cline =~ s:property |
11518 | 32 return indent + shiftwidth() |
1668 | 33 else |
34 return -1 | |
35 endif | |
36 endfunction | |
37 | |
38 " vim:set sw=2: |