Mercurial > vim
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 |
rev | line source |
---|---|
1620 | 1 " Vim indent file |
2 " Language: git config file | |
2034 | 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> |
11518 | 4 " Last Change: 2017 Jun 13 |
1620 | 5 |
6 if exists("b:did_indent") | |
7 finish | |
8 endif | |
9 let b:did_indent = 1 | |
10 | |
11 setlocal autoindent | |
12 setlocal indentexpr=GetGitconfigIndent() | |
13 setlocal indentkeys=o,O,*<Return>,0[,],0;,0#,=,!^F | |
14 | |
3465 | 15 let b:undo_indent = 'setl ai< inde< indk<' |
16 | |
1620 | 17 " Only define the function once. |
18 if exists("*GetGitconfigIndent") | |
19 finish | |
20 endif | |
21 | |
22 function! GetGitconfigIndent() | |
11518 | 23 let sw = shiftwidth() |
2202 | 24 let line = getline(prevnonblank(v:lnum-1)) |
25 let cline = getline(v:lnum) | |
26 if line =~ '\\\@<!\%(\\\\\)*\\$' | |
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 | 29 elseif cline =~ '^\s*\[' |
30 return 0 | |
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 | 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 | 35 else |
36 return -1 | |
37 endif | |
1620 | 38 endfunction |