annotate runtime/ftplugin/spec.vim @ 19969:b07672d13ff9 v8.2.0540

patch 8.2.0540: regexp and other code not tested Commit: https://github.com/vim/vim/commit/004a6781b3cf15ca5dd632c38cc09bb3b253d1f8 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 11 17:09:31 2020 +0200 patch 8.2.0540: regexp and other code not tested Problem: Regexp and other code not tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5904)
author Bram Moolenaar <Bram@vim.org>
date Sat, 11 Apr 2020 17:15:06 +0200
parents ecb621205ed1
children d4c7b3e9cd17
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Plugin to update the %changelog section of RPM spec files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Filename: spec.vim
5697
c2098c3095e7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3410
diff changeset
3 " Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com
c2098c3095e7 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3410
diff changeset
4 " Former Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com> (until March 2014)
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
5 " Last Change: Mon Jun 01 21:15 MSK 2015 Igor Gnatenko
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 if exists("b:did_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
12 let s:cpo_save = &cpo
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
13 set cpo&vim
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
14
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 if !exists("no_plugin_maps") && !exists("no_spec_maps")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 if !hasmapto("<Plug>SpecChangelog")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 map <buffer> <LocalLeader>c <Plug>SpecChangelog
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
6647
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5697
diff changeset
21 if !hasmapto("call <SID>SpecChangelog(\"\")<CR>")
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5697
diff changeset
22 noremap <buffer> <unique> <script> <Plug>SpecChangelog :call <SID>SpecChangelog("")<CR>
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5697
diff changeset
23 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
25 if !exists("*s:GetRelVer")
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
26 function! s:GetRelVer()
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
27 if has('python')
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
28 python << PYEND
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
29 import sys, datetime, shutil, tempfile
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
30 import vim
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
31
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
32 try:
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
33 import rpm
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
34 except ImportError:
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
35 pass
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
36 else:
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
37 specfile = vim.current.buffer.name
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
38 if specfile:
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
39 rpm.delMacro("dist")
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
40 spec = rpm.spec(specfile)
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
41 headers = spec.sourceHeader
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
42 version = headers["Version"]
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
43 release = headers["Release"]
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
44 vim.command("let ver = " + version)
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
45 vim.command("let rel = " + release)
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
46 PYEND
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
47 endif
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
48 endfunction
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
49 endif
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
50
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 if !exists("*s:SpecChangelog")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 function s:SpecChangelog(format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 if strlen(a:format) == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 if !exists("g:spec_chglog_format")
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
55 let email = input("Name <email address>: ")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 let g:spec_chglog_format = "%a %b %d %Y " . l:email
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 echo "\r"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 let format = g:spec_chglog_format
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 if !exists("g:spec_chglog_format")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 let g:spec_chglog_format = a:format
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 let format = a:format
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 let line = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 let name = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 let ver = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 let rel = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 let nameline = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 let verline = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 let relline = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 let chgline = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 while (line <= line("$"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 let linestr = getline(line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 if (name == "" && linestr =~? '^Name:')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 let nameline = line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 let name = substitute(strpart(linestr,5), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 elseif (ver == "" && linestr =~? '^Version:')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 let verline = line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 let ver = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 elseif (rel == "" && linestr =~? '^Release:')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 let relline = line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 let rel = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 elseif (linestr =~? '^%changelog')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 let chgline = line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 execute line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 let line = line+1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 if (nameline != -1 && verline != -1 && relline != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 let include_release_info = exists("g:spec_chglog_release_info")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 let name = s:ParseRpmVars(name, nameline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 let ver = s:ParseRpmVars(ver, verline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 let rel = s:ParseRpmVars(rel, relline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 let include_release_info = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 endif
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
100
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
101 call s:GetRelVer()
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
102
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 if (chgline == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 let option = confirm("Can't find %changelog. Create one? ","&End of file\n&Here\n&Cancel",3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 if (option == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 call append(line("$"),"")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 call append(line("$"),"%changelog")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 execute line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 let chgline = line(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 elseif (option == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 call append(line("."),"%changelog")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 normal j
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 chgline = line(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 if (chgline != -1)
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
117 let tmptime = v:lc_time
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
118 language time C
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
119 let parsed_format = "* ".strftime(format)." - ".ver."-".rel
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
120 execute "language time" tmptime
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 let release_info = "+ ".name."-".ver."-".rel
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 let wrong_format = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 let wrong_release = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 let insert_line = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 if (getline(chgline+1) != parsed_format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 let wrong_format = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 if (include_release_info && getline(chgline+2) != release_info)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 let wrong_release = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 if (wrong_format || wrong_release)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 if (include_release_info && !wrong_release && !exists("g:spec_chglog_never_increase_release"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 let option = confirm("Increase release? ","&Yes\n&No",1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 if (option == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 execute relline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 normal 
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 let rel = substitute(strpart(getline(relline),8), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 let release_info = "+ ".name."-".ver."-".rel
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 let n = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 call append(chgline+n, parsed_format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 if include_release_info
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 let n = n + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 call append(chgline+n, release_info)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 let n = n + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 call append(chgline+n,"- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 let n = n + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 call append(chgline+n,"")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 let insert_line = chgline+n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 let line = chgline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 if !exists("g:spec_chglog_prepend")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 while !(getline(line+2) =~ '^\( *\|\*.*\)$')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 let line = line+1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 call append(line+1,"- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 let insert_line = line+2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 execute insert_line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 startinsert!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 if !exists("*s:ParseRpmVars")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 function s:ParseRpmVars(str, strline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 let end = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 let ret = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 while (1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 let start = match(a:str, "\%{", end+1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 if (start == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 let ret = ret . strpart(a:str, end+1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 let ret = ret . strpart(a:str, end+1, start-(end+1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 let end = match(a:str, "}", start)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 if (end == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 let ret = ret . strpart(a:str, start)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 let varname = strpart(a:str, start+2, end-(start+2))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 execute a:strline
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
186 let definestr = "^[ \t]*%(?:global|define)[ \t]\\+" . varname . "[ \t]\\+\\(.*\\)$"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 let linenum = search(definestr, "bW")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 if (linenum != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 let ret = ret . substitute(getline(linenum), definestr, "\\1", "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 let ret = ret . strpart(str, start, end+1-start)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 return ret
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 " The following lines, along with the macros/matchit.vim plugin,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 " make it easy to navigate the different sections of a spec file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 " with the % key (thanks to Max Ischenko).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 let b:match_ignorecase = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 let b:match_words =
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
204 \ '^Name:^%description:^%clean:^%(?:auto)?setup:^%build:^%install:^%files:' .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 \ '^%package:^%preun:^%postun:^%changelog'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
207 let &cpo = s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
208 unlet s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
209
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
210 let b:undo_ftplugin = "unlet! b:match_ignorecase b:match_words"