annotate runtime/indent/gitolite.vim @ 28459:52ef65c0637f v8.2.4754

patch 8.2.4754: using cached values after unsetting some environment variables Commit: https://github.com/vim/vim/commit/7714231bb5b15f7c85453f3945c108478de1d08a Author: LemonBoy <thatlemon@gmail.com> Date: Fri Apr 15 20:50:46 2022 +0100 patch 8.2.4754: using cached values after unsetting some environment variables Problem: Still using cached values after unsetting some known environment variables. Solution: Take care of the side effects. (closes #10194)
author Bram Moolenaar <Bram@vim.org>
date Fri, 15 Apr 2022 22:00:03 +0200
parents 6dd88e45d47d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim indent file
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2 " Language: gitolite configuration
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11518
diff changeset
3 " URL: https://github.com/sitaramc/gitolite/blob/master/contrib/vim/indent/gitolite.vim
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11518
diff changeset
4 " (https://raw.githubusercontent.com/sitaramc/gitolite/master/contrib/vim/indent/gitolite.vim)
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11518
diff changeset
5 " Maintainer: Sitaram Chamarty <sitaramc@gmail.com>
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11518
diff changeset
6 " (former Maintainer: Teemu Matilainen <teemu.matilainen@iki.fi>)
28379
6dd88e45d47d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 12756
diff changeset
7 " Last Change: 2022 Apr 06
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 if exists("b:did_indent")
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 finish
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 let b:did_indent = 1
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 setlocal autoindent
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 setlocal indentexpr=GetGitoliteIndent()
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 setlocal indentkeys=o,O,*<Return>,!^F,=repo,\",=
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17
28379
6dd88e45d47d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 12756
diff changeset
18 let b:undo_indent = "setl ai< inde< indk<"
6dd88e45d47d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 12756
diff changeset
19
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 " Only define the function once.
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 if exists("*GetGitoliteIndent")
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 finish
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3224
diff changeset
25 let s:cpo_save = &cpo
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3224
diff changeset
26 set cpo&vim
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3224
diff changeset
27
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 function! GetGitoliteIndent()
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 let prevln = prevnonblank(v:lnum-1)
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 let pline = getline(prevln)
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 let cline = getline(v:lnum)
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3237
diff changeset
34 return shiftwidth()
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 elseif cline =~ '^\s*config\s'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3237
diff changeset
36 return shiftwidth()
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11518
diff changeset
37 elseif cline =~ '^\s*option\s'
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 11518
diff changeset
38 return shiftwidth()
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 3237
diff changeset
40 return shiftwidth()
3224
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 elseif cline =~ '^\s*#'
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 return indent(prevln)
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 elseif cline =~ '^\s*$'
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44 return -1
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 else
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46 return 0
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47 endif
8b8ef1fed009 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 endfunction
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3224
diff changeset
49
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3224
diff changeset
50 let &cpo = s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3224
diff changeset
51 unlet s:cpo_save