annotate runtime/ftplugin/spec.vim @ 32881:ec310fcd2d12 v9.0.1749

patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB Commit: https://github.com/vim/vim/commit/dbeadf05b6a152e7d9c5cc23d9202057f8e99884 Author: Christian Brabandt <cb@256bit.org> Date: Sat Aug 19 15:35:04 2023 +0200 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB Problem: Text property highlight doesn't override a sign highlight over a tab character Solution: Let text_property override tab highlighting This fixes a few problems of text properties: - text property highlighting when override=true does not overwrite TAB highlighting - text property highlighting when override=true does not overwrite TAB highlighting with :set list - text property highlighting is used instead of sign highlight after the actual text ends when signs are present with linehl is set closes: #21584 closes: #21592 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 19 Aug 2023 15:45:03 +0200
parents 57c9377b9c62
children 590ab2c926e6
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
28933
57c9377b9c62 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26100
diff changeset
6 " Update by Zdenek Dohnal, 2022 May 17
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 if exists("b:did_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
13 let s:cpo_save = &cpo
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
14 set cpo&vim
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
15
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 if !exists("no_plugin_maps") && !exists("no_spec_maps")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 if !hasmapto("<Plug>SpecChangelog")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 map <buffer> <LocalLeader>c <Plug>SpecChangelog
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
22 if !hasmapto("call <SID>SpecChangelog(\"\")<CR>")
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25880
diff changeset
23 noremap <buffer> <unique> <script> <Plug>SpecChangelog :call <SID>SpecChangelog("")<CR>
6647
3af822eb4da5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5697
diff changeset
24 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
26 if !exists("*s:GetRelVer")
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
27 function! s:GetRelVer()
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
28 if has('python')
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
29 python << PYEND
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
30 import sys, datetime, shutil, tempfile
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
31 import vim
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
32
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
33 try:
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
34 import rpm
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
35 except ImportError:
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
36 pass
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
37 else:
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
38 specfile = vim.current.buffer.name
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
39 if specfile:
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
40 rpm.delMacro("dist")
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
41 spec = rpm.spec(specfile)
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
42 headers = spec.sourceHeader
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
43 version = headers["Version"]
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
44 release = headers["Release"]
28933
57c9377b9c62 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26100
diff changeset
45 vim.command("let ver = '" + version + "'")
57c9377b9c62 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 26100
diff changeset
46 vim.command("let rel = '" + release + "'")
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
47 PYEND
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
48 endif
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
49 endfunction
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
50 endif
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
51
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 if !exists("*s:SpecChangelog")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 function s:SpecChangelog(format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 if strlen(a:format) == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 if !exists("g:spec_chglog_format")
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
56 let email = input("Name <email address>: ")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 let g:spec_chglog_format = "%a %b %d %Y " . l:email
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 echo "\r"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 let format = g:spec_chglog_format
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 if !exists("g:spec_chglog_format")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 let g:spec_chglog_format = a:format
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 let format = a:format
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 let line = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 let name = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 let ver = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 let rel = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 let nameline = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 let verline = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 let relline = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 let chgline = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 while (line <= line("$"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 let linestr = getline(line)
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
77 if name == "" && linestr =~? '^Name:'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 let nameline = line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 let name = substitute(strpart(linestr,5), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
80 elseif ver == "" && linestr =~? '^Version:'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 let verline = line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 let ver = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
83 elseif rel == "" && linestr =~? '^Release:'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 let relline = line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 let rel = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
86 elseif linestr =~? '^%changelog'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 let chgline = line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 execute line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 let line = line+1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 endwhile
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
93 if nameline != -1 && verline != -1 && relline != -1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 let include_release_info = exists("g:spec_chglog_release_info")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 let name = s:ParseRpmVars(name, nameline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 let ver = s:ParseRpmVars(ver, verline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 let rel = s:ParseRpmVars(rel, relline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 let include_release_info = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 endif
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
101
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
102 call s:GetRelVer()
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
103
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
104 if chgline == -1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 let option = confirm("Can't find %changelog. Create one? ","&End of file\n&Here\n&Cancel",3)
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
106 if option == 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 call append(line("$"),"")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 call append(line("$"),"%changelog")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 execute line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 let chgline = line(".")
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
111 elseif option == 2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 call append(line("."),"%changelog")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 normal j
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
114 let chgline = line(".")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 endif
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
117 if chgline != -1
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
118 let tmptime = v:lc_time
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
119 language time C
6823
0303182665d5 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6647
diff changeset
120 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
121 execute "language time" tmptime
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 let release_info = "+ ".name."-".ver."-".rel
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 let wrong_format = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 let wrong_release = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 let insert_line = 0
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
126 if getline(chgline+1) != parsed_format
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 let wrong_format = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 endif
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
129 if include_release_info && getline(chgline+2) != release_info
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 let wrong_release = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 endif
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
132 if wrong_format || wrong_release
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
133 if include_release_info && !wrong_release && !exists("g:spec_chglog_never_increase_release")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 let option = confirm("Increase release? ","&Yes\n&No",1)
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
135 if option == 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 execute relline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 normal 
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 let rel = substitute(strpart(getline(relline),8), '^[ ]*\([^ ]\+\)[ ]*$','\1','')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 let release_info = "+ ".name."-".ver."-".rel
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 let n = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 call append(chgline+n, parsed_format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 if include_release_info
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 let n = n + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 call append(chgline+n, release_info)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 let n = n + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 call append(chgline+n,"- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 let n = n + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 call append(chgline+n,"")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 let insert_line = chgline+n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 let line = chgline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 if !exists("g:spec_chglog_prepend")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 while !(getline(line+2) =~ '^\( *\|\*.*\)$')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 let line = line+1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 call append(line+1,"- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 let insert_line = line+2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 execute insert_line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 startinsert!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 if !exists("*s:ParseRpmVars")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 function s:ParseRpmVars(str, strline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 let end = -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 let ret = ""
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 while (1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 let start = match(a:str, "\%{", end+1)
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
175 if start == -1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 let ret = ret . strpart(a:str, end+1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 let ret = ret . strpart(a:str, end+1, start-(end+1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 let end = match(a:str, "}", start)
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
181 if end == -1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 let ret = ret . strpart(a:str, start)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 let varname = strpart(a:str, start+2, end-(start+2))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 execute a:strline
22171
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 9227
diff changeset
187 let definestr = "^[ \t]*%\\(define\\|global\\)[ \t]\\+".varname."[ \t]\\+\\(.*\\)$"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 let linenum = search(definestr, "bW")
23305
fab58304f77d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
189 if linenum != 0
22171
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 9227
diff changeset
190 let ret = ret . substitute(getline(linenum), definestr, "\\2", "")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 return ret
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 " The following lines, along with the macros/matchit.vim plugin,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 " make it easy to navigate the different sections of a spec file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 " with the % key (thanks to Max Ischenko).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 let b:match_ignorecase = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 let b:match_words =
9227
ecb621205ed1 commit https://github.com/vim/vim/commit/82af8710bf8d1caeeceafb1370a052cb7d92f076
Christian Brabandt <cb@256bit.org>
parents: 6823
diff changeset
203 \ '^Name:^%description:^%clean:^%(?:auto)?setup:^%build:^%install:^%files:' .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 \ '^%package:^%preun:^%postun:^%changelog'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
206 let &cpo = s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
207 unlet s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
208
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
209 let b:undo_ftplugin = "unlet! b:match_ignorecase b:match_words"