1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-03-23 18:25:13 +01:00
vim/runtime/indent/gitconfig.vim

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
841 B
VimL
Raw Permalink Normal View History

2008-06-24 21:16:56 +00:00
" Vim indent file
" Language: git config file
2010-01-06 20:54:52 +01:00
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2017 Jun 13
2008-06-24 21:16:56 +00:00
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent
setlocal indentexpr=GetGitconfigIndent()
setlocal indentkeys=o,O,*<Return>,0[,],0;,0#,=,!^F
2012-04-13 23:04:47 +02:00
let b:undo_indent = 'setl ai< inde< indk<'
2008-06-24 21:16:56 +00:00
" Only define the function once.
if exists("*GetGitconfigIndent")
finish
endif
function! GetGitconfigIndent()
let sw = shiftwidth()
2010-05-21 12:05:36 +02:00
let line = getline(prevnonblank(v:lnum-1))
let cline = getline(v:lnum)
if line =~ '\\\@<!\%(\\\\\)*\\$'
" odd number of slashes, in a line continuation
return 2 * sw
2010-05-21 12:05:36 +02:00
elseif cline =~ '^\s*\['
return 0
elseif cline =~ '^\s*\a'
return sw
2010-05-21 12:05:36 +02:00
elseif cline == '' && line =~ '^\['
return sw
2010-05-21 12:05:36 +02:00
else
return -1
endif
2008-06-24 21:16:56 +00:00
endfunction