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