]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/indent/gitconfig.vim
Use super and b
[rbdr/dotfiles] / vim / indent / gitconfig.vim
1 " Vim indent file
2 " Language: git config file
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4
5 if exists("b:did_indent")
6 finish
7 endif
8 let b:did_indent = 1
9
10 setlocal autoindent
11 setlocal indentexpr=GetGitconfigIndent()
12 setlocal indentkeys=o,O,*<Return>,0[,],0;,0#,=,!^F
13
14 let b:undo_indent = 'setl ai< inde< indk<'
15
16 " Only define the function once.
17 if exists("*GetGitconfigIndent")
18 finish
19 endif
20
21 function! GetGitconfigIndent()
22 let line = getline(prevnonblank(v:lnum-1))
23 let cline = getline(v:lnum)
24 if line =~ '\\\@<!\%(\\\\\)*\\$'
25 " odd number of slashes, in a line continuation
26 return 2 * &sw
27 elseif cline =~ '^\s*\['
28 return 0
29 elseif cline =~ '^\s*\a'
30 return &sw
31 elseif cline == '' && line =~ '^\['
32 return &sw
33 else
34 return -1
35 endif
36 endfunction