annotate runtime/indent/gitconfig.vim @ 26404:1bbb884c8561 v8.2.3733

patch 8.2.3733: Vim9: using "legacy" before range does not work Commit: https://github.com/vim/vim/commit/b579f6ebbfa826d228abec1e1b24c05894517c27 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 4 11:57:00 2021 +0000 patch 8.2.3733: Vim9: using "legacy" before range does not work Problem: Vim9: using "legacy" before range does not work. Solution: Skip over range before parsing command. (closes https://github.com/vim/vim/issues/9270)
author Bram Moolenaar <Bram@vim.org>
date Sat, 04 Dec 2021 13:00:05 +0100
parents 63b0b7b79b25
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1620
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
1 " Vim indent file
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
2 " Language: git config file
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1620
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
4 " Last Change: 2017 Jun 13
1620
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
5
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
6 if exists("b:did_indent")
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
7 finish
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
8 endif
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
9 let b:did_indent = 1
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
10
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
11 setlocal autoindent
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
12 setlocal indentexpr=GetGitconfigIndent()
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
13 setlocal indentkeys=o,O,*<Return>,0[,],0;,0#,=,!^F
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
14
3465
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
15 let b:undo_indent = 'setl ai< inde< indk<'
161d01cbb165 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
16
1620
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
17 " Only define the function once.
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
18 if exists("*GetGitconfigIndent")
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
19 finish
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
20 endif
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
21
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
22 function! GetGitconfigIndent()
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
23 let sw = shiftwidth()
2202
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
24 let line = getline(prevnonblank(v:lnum-1))
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
25 let cline = getline(v:lnum)
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
26 if line =~ '\\\@<!\%(\\\\\)*\\$'
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
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
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
29 elseif cline =~ '^\s*\['
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
30 return 0
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
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
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
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
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
35 else
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
36 return -1
f7579a31705c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
37 endif
1620
73fe8baea242 updated for version 7.2a
vimboss
parents:
diff changeset
38 endfunction