2014-07-10 21:05:51 -07:00
|
|
|
" Vim indent file
|
|
|
|
" Language: gitolite configuration
|
2017-11-07 12:43:11 -07:00
|
|
|
" URL: https://github.com/sitaramc/gitolite/blob/master/contrib/vim/indent/gitolite.vim
|
|
|
|
" (https://raw.githubusercontent.com/sitaramc/gitolite/master/contrib/vim/indent/gitolite.vim)
|
|
|
|
" Maintainer: Sitaram Chamarty <sitaramc@gmail.com>
|
|
|
|
" (former Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>)
|
2022-04-08 10:53:41 -07:00
|
|
|
" Last Change: 2022 Apr 06
|
2014-07-10 21:05:51 -07:00
|
|
|
|
|
|
|
if exists("b:did_indent")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let b:did_indent = 1
|
|
|
|
|
|
|
|
setlocal autoindent
|
|
|
|
setlocal indentexpr=GetGitoliteIndent()
|
|
|
|
setlocal indentkeys=o,O,*<Return>,!^F,=repo,\",=
|
|
|
|
|
2022-04-08 10:53:41 -07:00
|
|
|
let b:undo_indent = "setl ai< inde< indk<"
|
|
|
|
|
2014-07-10 21:05:51 -07:00
|
|
|
" Only define the function once.
|
|
|
|
if exists("*GetGitoliteIndent")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
|
|
|
let s:cpo_save = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
|
|
|
function! GetGitoliteIndent()
|
|
|
|
let prevln = prevnonblank(v:lnum-1)
|
|
|
|
let pline = getline(prevln)
|
|
|
|
let cline = getline(v:lnum)
|
|
|
|
|
|
|
|
if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]'
|
2017-11-06 17:34:28 -07:00
|
|
|
return shiftwidth()
|
2014-07-10 21:05:51 -07:00
|
|
|
elseif cline =~ '^\s*config\s'
|
2017-11-06 17:34:28 -07:00
|
|
|
return shiftwidth()
|
2017-11-07 12:43:11 -07:00
|
|
|
elseif cline =~ '^\s*option\s'
|
|
|
|
return shiftwidth()
|
2014-07-10 21:05:51 -07:00
|
|
|
elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$'
|
2017-11-06 17:34:28 -07:00
|
|
|
return shiftwidth()
|
2014-07-10 21:05:51 -07:00
|
|
|
elseif cline =~ '^\s*#'
|
|
|
|
return indent(prevln)
|
|
|
|
elseif cline =~ '^\s*$'
|
|
|
|
return -1
|
|
|
|
else
|
|
|
|
return 0
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
let &cpo = s:cpo_save
|
|
|
|
unlet s:cpo_save
|