3224
|
1 " Vim indent file
|
|
2 " Language: gitolite configuration
|
|
3 " URL: https://github.com/tmatilai/gitolite.vim
|
|
4 " Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>
|
3237
|
5 " Last Change: 2011-12-24
|
3224
|
6
|
|
7 if exists("b:did_indent")
|
|
8 finish
|
|
9 endif
|
|
10 let b:did_indent = 1
|
|
11
|
|
12 setlocal autoindent
|
|
13 setlocal indentexpr=GetGitoliteIndent()
|
|
14 setlocal indentkeys=o,O,*<Return>,!^F,=repo,\",=
|
|
15
|
|
16 " Only define the function once.
|
|
17 if exists("*GetGitoliteIndent")
|
|
18 finish
|
|
19 endif
|
|
20
|
3237
|
21 let s:cpo_save = &cpo
|
|
22 set cpo&vim
|
|
23
|
3224
|
24 function! GetGitoliteIndent()
|
|
25 let prevln = prevnonblank(v:lnum-1)
|
|
26 let pline = getline(prevln)
|
|
27 let cline = getline(v:lnum)
|
|
28
|
|
29 if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]'
|
|
30 return &sw
|
|
31 elseif cline =~ '^\s*config\s'
|
|
32 return &sw
|
|
33 elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$'
|
|
34 return &sw
|
|
35 elseif cline =~ '^\s*#'
|
|
36 return indent(prevln)
|
|
37 elseif cline =~ '^\s*$'
|
|
38 return -1
|
|
39 else
|
|
40 return 0
|
|
41 endif
|
|
42 endfunction
|
3237
|
43
|
|
44 let &cpo = s:cpo_save
|
|
45 unlet s:cpo_save
|