Mercurial > vim
annotate runtime/indent/rhelp.vim @ 33072:6028d7f701ce v9.0.1823
patch 9.0.1823: Autoconf 2.69 too old
Commit: https://github.com/vim/vim/commit/a96d544bc355b1a6021feccf5fa2bd5659bc5269
Author: Illia Bobyr <illia.bobyr@gmail.com>
Date: Wed Aug 30 16:30:15 2023 +0200
patch 9.0.1823: Autoconf 2.69 too old
Problem: Autoconf 2.69 too old
Solution: Migrate to Autoconf 2.71
Autoconf 2.69 is almost 10 years old. And 2.71 is also a few years old
as well. Should be pretty well tested by now. It brings a lot of
improvements and there seems to be an ongoing work on autoconf 2.72
already.
This change just addresses two minor changes `autoupdate` suggested, and
then `src/auto/configure` is regenerated by running
cd src
make AUTOCONF=autoconf2.71 autoconf
closes: #12958
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Illia Bobyr <illia.bobyr@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 30 Aug 2023 16:45:05 +0200 |
parents | b2e8663e6dcc |
children | 02bd0fe77c68 |
rev | line source |
---|---|
6051 | 1 " Vim indent file |
2 " Language: R Documentation (Help), *.Rd | |
3 " Author: Jakson Alves de Aquino <jalvesaq@gmail.com> | |
8497
da01d5da2cfa
commit https://github.com/vim/vim/commit/77cdfd10382e01cc51f4ba1a9177032351843151
Christian Brabandt <cb@256bit.org>
parents:
6840
diff
changeset
|
4 " Homepage: https://github.com/jalvesaq/R-Vim-runtime |
32294 | 5 " Last Change: Mon Feb 27, 2023 07:01PM |
6051 | 6 |
7 | |
8 " Only load this indent file when no other was loaded. | |
9 if exists("b:did_indent") | |
10 finish | |
11 endif | |
12 runtime indent/r.vim | |
13 let s:RIndent = function(substitute(&indentexpr, "()", "", "")) | |
14 let b:did_indent = 1 | |
15 | |
16 setlocal noautoindent | |
17 setlocal nocindent | |
18 setlocal nosmartindent | |
19 setlocal nolisp | |
20 setlocal indentkeys=0{,0},:,!^F,o,O,e | |
21 setlocal indentexpr=GetCorrectRHelpIndent() | |
22 | |
32294 | 23 let b:undo_indent = "setl ai< cin< inde< indk< lisp< si<" |
32061 | 24 |
6840 | 25 " Only define the functions once. |
26 if exists("*GetRHelpIndent") | |
27 finish | |
28 endif | |
29 | |
6051 | 30 function s:SanitizeRHelpLine(line) |
31 let newline = substitute(a:line, '\\\\', "x", "g") | |
32 let newline = substitute(newline, '\\{', "x", "g") | |
33 let newline = substitute(newline, '\\}', "x", "g") | |
34 let newline = substitute(newline, '\\%', "x", "g") | |
35 let newline = substitute(newline, '%.*', "", "") | |
36 let newline = substitute(newline, '\s*$', "", "") | |
37 return newline | |
38 endfunction | |
39 | |
40 function GetRHelpIndent() | |
41 | |
42 let clnum = line(".") " current line | |
43 if clnum == 1 | |
44 return 0 | |
45 endif | |
46 let cline = getline(clnum) | |
47 | |
48 if cline =~ '^\s*}\s*$' | |
49 let i = clnum | |
50 let bb = -1 | |
51 while bb != 0 && i > 1 | |
52 let i -= 1 | |
53 let line = s:SanitizeRHelpLine(getline(i)) | |
54 let line2 = substitute(line, "{", "", "g") | |
55 let openb = strlen(line) - strlen(line2) | |
56 let line3 = substitute(line2, "}", "", "g") | |
57 let closeb = strlen(line2) - strlen(line3) | |
58 let bb += openb - closeb | |
59 endwhile | |
60 return indent(i) | |
61 endif | |
62 | |
63 if cline =~ '^\s*#ifdef\>' || cline =~ '^\s*#endif\>' | |
64 return 0 | |
65 endif | |
66 | |
67 let lnum = clnum - 1 | |
68 let line = getline(lnum) | |
69 if line =~ '^\s*#ifdef\>' || line =~ '^\s*#endif\>' | |
70 let lnum -= 1 | |
71 let line = getline(lnum) | |
72 endif | |
73 while lnum > 1 && (line =~ '^\s*$' || line =~ '^#ifdef' || line =~ '^#endif') | |
74 let lnum -= 1 | |
75 let line = getline(lnum) | |
76 endwhile | |
77 if lnum == 1 | |
78 return 0 | |
79 endif | |
80 let line = s:SanitizeRHelpLine(line) | |
81 let line2 = substitute(line, "{", "", "g") | |
82 let openb = strlen(line) - strlen(line2) | |
83 let line3 = substitute(line2, "}", "", "g") | |
84 let closeb = strlen(line2) - strlen(line3) | |
85 let bb = openb - closeb | |
86 | |
11347 | 87 let ind = indent(lnum) + (bb * shiftwidth()) |
6051 | 88 |
89 if line =~ '^\s*}\s*$' | |
90 let ind = indent(lnum) | |
91 endif | |
92 | |
93 if ind < 0 | |
94 return 0 | |
95 endif | |
96 | |
97 return ind | |
98 endfunction | |
99 | |
100 function GetCorrectRHelpIndent() | |
101 let lastsection = search('^\\[a-z]*{', "bncW") | |
102 let secname = getline(lastsection) | |
103 if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' || secname =~ '^\\method{.*}{.*}(' | |
104 return s:RIndent() | |
105 else | |
106 return GetRHelpIndent() | |
107 endif | |
108 endfunction | |
109 | |
110 " vim: sw=2 |