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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim indent file
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2 " Language: R Documentation (Help), *.Rd
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
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
b2e8663e6dcc Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 32061
diff changeset
5 " Last Change: Mon Feb 27, 2023 07:01PM
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 " Only load this indent file when no other was loaded.
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 if exists("b:did_indent")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10 finish
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 runtime indent/r.vim
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 let s:RIndent = function(substitute(&indentexpr, "()", "", ""))
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 let b:did_indent = 1
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 setlocal noautoindent
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 setlocal nocindent
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18 setlocal nosmartindent
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 setlocal nolisp
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 setlocal indentkeys=0{,0},:,!^F,o,O,e
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 setlocal indentexpr=GetCorrectRHelpIndent()
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22
32294
b2e8663e6dcc Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 32061
diff changeset
23 let b:undo_indent = "setl ai< cin< inde< indk< lisp< si<"
32061
b2412874362f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11347
diff changeset
24
6840
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6051
diff changeset
25 " Only define the functions once.
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6051
diff changeset
26 if exists("*GetRHelpIndent")
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6051
diff changeset
27 finish
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6051
diff changeset
28 endif
37828f7503c7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6051
diff changeset
29
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 function s:SanitizeRHelpLine(line)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31 let newline = substitute(a:line, '\\\\', "x", "g")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 let newline = substitute(newline, '\\{', "x", "g")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 let newline = substitute(newline, '\\}', "x", "g")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 let newline = substitute(newline, '\\%', "x", "g")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 let newline = substitute(newline, '%.*', "", "")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 let newline = substitute(newline, '\s*$', "", "")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 return newline
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 endfunction
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 function GetRHelpIndent()
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 let clnum = line(".") " current line
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
43 if clnum == 1
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
44 return 0
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
45 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
46 let cline = getline(clnum)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 if cline =~ '^\s*}\s*$'
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 let i = clnum
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50 let bb = -1
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 while bb != 0 && i > 1
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 let i -= 1
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 let line = s:SanitizeRHelpLine(getline(i))
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54 let line2 = substitute(line, "{", "", "g")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 let openb = strlen(line) - strlen(line2)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56 let line3 = substitute(line2, "}", "", "g")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 let closeb = strlen(line2) - strlen(line3)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58 let bb += openb - closeb
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 endwhile
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 return indent(i)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
62
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 if cline =~ '^\s*#ifdef\>' || cline =~ '^\s*#endif\>'
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
64 return 0
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67 let lnum = clnum - 1
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
68 let line = getline(lnum)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 if line =~ '^\s*#ifdef\>' || line =~ '^\s*#endif\>'
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
70 let lnum -= 1
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 let line = getline(lnum)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73 while lnum > 1 && (line =~ '^\s*$' || line =~ '^#ifdef' || line =~ '^#endif')
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
74 let lnum -= 1
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 let line = getline(lnum)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 endwhile
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 if lnum == 1
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78 return 0
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 let line = s:SanitizeRHelpLine(line)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 let line2 = substitute(line, "{", "", "g")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 let openb = strlen(line) - strlen(line2)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83 let line3 = substitute(line2, "}", "", "g")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 let closeb = strlen(line2) - strlen(line3)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
85 let bb = openb - closeb
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
86
11347
4aae8146c21f Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 8497
diff changeset
87 let ind = indent(lnum) + (bb * shiftwidth())
6051
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
88
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
89 if line =~ '^\s*}\s*$'
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
90 let ind = indent(lnum)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
91 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
92
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93 if ind < 0
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
94 return 0
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
95 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
96
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
97 return ind
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
98 endfunction
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
99
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
100 function GetCorrectRHelpIndent()
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
101 let lastsection = search('^\\[a-z]*{', "bncW")
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
102 let secname = getline(lastsection)
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
103 if secname =~ '^\\usage{' || secname =~ '^\\examples{' || secname =~ '^\\dontshow{' || secname =~ '^\\dontrun{' || secname =~ '^\\donttest{' || secname =~ '^\\testonly{' || secname =~ '^\\method{.*}{.*}('
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
104 return s:RIndent()
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
105 else
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
106 return GetRHelpIndent()
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
107 endif
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
108 endfunction
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
109
0efec12f52ac Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
110 " vim: sw=2