robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
ad527392ab
master
1" Vim indent file 2" Language: git config file 3" Maintainer: Tim Pope <vimNOSPAM@tpope.org> 4" Last Change: 2017 Jun 13 5 6if exists ( "b:did_indent" ) 7finish 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" ) 19finish 20endif 21 22function ! GetGitconfigIndent () 23let sw = shiftwidth () 24let line = getline ( prevnonblank ( v: lnum - 1 )) 25let cline = getline ( v: lnum ) 26if line =~ '\\\@<!\%(\\\\\)*\\$' 27" odd number of slashes, in a line continuation 28return 2 * sw 29elseif cline =~ '^\s*\[' 30return 0 31elseif cline =~ '^\s*\a' 32return sw 33elseif cline == '' && line =~ '^\[' 34return sw 35else 36return -1 37endif 38endfunction