Install vim74
[msysgit.git] / share / vim / vim74 / indent / treetop.vim
bloba2af78b8c27819a871e2026efc5caa50cf122781
1 " Vim indent file
2 " Language:         Treetop
3 " Maintainer:       Nikolai Weibull <now@bitwi.se>
4 " Latest Revision:  2011-03-14
6 if exists("b:did_indent")
7   finish
8 endif
9 let b:did_indent = 1
11 setlocal indentexpr=GetTreetopIndent()
12 setlocal indentkeys=0{,0},!^F,o,O,=end
13 setlocal nosmartindent
15 if exists("*GetTreetopIndent")
16   finish
17 endif
19 function GetTreetopIndent()
20   let pnum = prevnonblank(v:lnum - 1)
21   if pnum == 0
22     return 0
23   endif
25   let ind = indent(pnum)
26   let line = getline(pnum)
28   if line =~ '^\s*\%(grammar\|module\|rule\)\>'
29     let ind += &sw
30   endif
32   let line = getline(v:lnum)
33   if line =~ '^\s*end\>'
34     let ind -= &sw
35   end
37   retur ind
38 endfunction