Mercurial > vim
annotate runtime/indent/gitconfig.vim @ 22994:1d635e77266d
Added tag v8.2.2043 for changeset 3922abbc46a2706c691e22b3985d96a6e5dacdc4
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 25 Nov 2020 12:30:04 +0100 |
parents | 63b0b7b79b25 |
children |
rev | line source |
---|---|
1620 | 1 " Vim indent file |
2 " Language: git config file | |
2034 | 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> |
11518 | 4 " Last Change: 2017 Jun 13 |
1620 | 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 | |
3465 | 15 let b:undo_indent = 'setl ai< inde< indk<' |
16 | |
1620 | 17 " Only define the function once. |
18 if exists("*GetGitconfigIndent") | |
19 finish | |
20 endif | |
21 | |
22 function! GetGitconfigIndent() | |
11518 | 23 let sw = shiftwidth() |
2202 | 24 let line = getline(prevnonblank(v:lnum-1)) |
25 let cline = getline(v:lnum) | |
26 if line =~ '\\\@<!\%(\\\\\)*\\$' | |
27 " odd number of slashes, in a line continuation | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
28 return 2 * sw |
2202 | 29 elseif cline =~ '^\s*\[' |
30 return 0 | |
31 elseif cline =~ '^\s*\a' | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
32 return sw |
2202 | 33 elseif cline == '' && line =~ '^\[' |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
34 return sw |
2202 | 35 else |
36 return -1 | |
37 endif | |
1620 | 38 endfunction |