blob: ee4288cf7cb40b8dfaf78913df0b4ba3f312c27f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
" Vim indent file
" Language: CSS
" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se>
" Latest Revision: 2005-06-29
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetCSSIndent()
setlocal indentkeys=0{,0},!^F,o,O
if exists("*GetCSSIndent")
finish
endif
function s:LookupLine(lnum)
let lnum = prevnonblank(a:lnum - 1)
while lnum > 0
let line = getline(lnum)
if line =~ '\*/'
while lnum > 0 && line !~ '/\*'
let lnum -= 1
let line = getline(lnum)
endwhile
endif
if line !~ '^\s*/\*'
return lnum
end
endwhile
return lnum
endfunction
function GetCSSIndent()
let lnum = prevnonblank(v:lnum - 1)
if lnum == 0
return 0
endif
let ind = indent(lnum)
if substitute(getline(lnum), '/\*.*', '', 'e') =~ '{\(.*}\)\@!'
let ind = ind + &sw
endif
if getline(v:lnum) =~ '^\s*}'
let ind = ind - &sw
endif
return ind
endfunction
|