Mercurial > vim
comparison runtime/indent/gitconfig.vim @ 1620:73fe8baea242
updated for version 7.2a
author | vimboss |
---|---|
date | Tue, 24 Jun 2008 21:16:56 +0000 |
parents | |
children | 7bc41231fbc7 |
comparison
equal
deleted
inserted
replaced
1619:b9740fb41986 | 1620:73fe8baea242 |
---|---|
1 " Vim indent file | |
2 " Language: git config file | |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.info> | |
4 " Last Change: 2008 Jun 04 | |
5 | |
6 if exists("b:did_indent") | |
7 finish | |
8 endif | |
9 let b:did_indent = 1 | |
10 | |
11 setlocal autoindent | |
12 setlocal indentexpr=GetGitconfigIndent() | |
13 setlocal indentkeys=o,O,*<Return>,0[,],0;,0#,=,!^F | |
14 | |
15 " Only define the function once. | |
16 if exists("*GetGitconfigIndent") | |
17 finish | |
18 endif | |
19 | |
20 function! GetGitconfigIndent() | |
21 let line = getline(prevnonblank(v:lnum-1)) | |
22 let cline = getline(v:lnum) | |
23 if line =~ '\\\@<!\%(\\\\\)*\\$' | |
24 " odd number of slashes, in a line continuation | |
25 return 2 * &sw | |
26 elseif cline =~ '^\s*\[' | |
27 return 0 | |
28 elseif cline =~ '^\s*\a' | |
29 return &sw | |
30 elseif cline == '' && line =~ '^\[' | |
31 return &sw | |
32 else | |
33 return -1 | |
34 endif | |
35 endfunction |