1698
|
1 " Vim indent file
|
|
2 " Language: FrameScript
|
|
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
|
|
4 " Latest Revision: 2008-07-19
|
|
5
|
|
6 if exists("b:did_indent")
|
|
7 finish
|
|
8 endif
|
|
9 let b:did_indent = 1
|
|
10
|
|
11 setlocal indentexpr=GetFrameScriptIndent()
|
|
12 setlocal indentkeys=!^F,o,O,0=~Else,0=~EndIf,0=~EndLoop,0=~EndSub
|
|
13 setlocal nosmartindent
|
|
14
|
|
15 if exists("*GetFrameScriptIndent")
|
|
16 finish
|
|
17 endif
|
|
18
|
|
19 function GetFrameScriptIndent()
|
|
20 let lnum = prevnonblank(v:lnum - 1)
|
|
21
|
|
22 if lnum == 0
|
|
23 return 0
|
|
24 endif
|
|
25
|
|
26 if getline(v:lnum) =~ '^\s*\*'
|
|
27 return cindent(v:lnum)
|
|
28 endif
|
|
29
|
|
30 let ind = indent(lnum)
|
|
31
|
|
32 if getline(lnum) =~? '^\s*\%(If\|Loop\|Sub\)'
|
|
33 let ind = ind + &sw
|
|
34 endif
|
|
35
|
|
36 if getline(v:lnum) =~? '^\s*\%(Else\|End\%(If\|Loop\|Sub\)\)'
|
|
37 let ind = ind - &sw
|
|
38 endif
|
|
39
|
|
40 return ind
|
|
41 endfunction
|