annotate runtime/ftplugin/debchangelog.vim @ 977:316dad0565b8 v7.0.103

updated for version 7.0-103
author vimboss
date Thu, 14 Sep 2006 08:48:14 +0000
parents f4d8553715f7
children e63691e7c504
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
1 " Vim filetype plugin file (GUI menu and folding)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Debian Changelog
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Michael Piefel <piefel@informatik.hu-berlin.de>
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
4 " Stefano Zacchiroli <zack@debian.org>
848
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
5 " Last Change: $LastChangedDate: 2006-04-28 12:15:12 -0400 (ven, 28 apr 2006) $
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
6 " License: GNU GPL, version 2.0 or later
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
7 " URL: http://svn.debian.org/wsvn/pkg-vim/trunk/runtime/ftplugin/debchangelog.vim?op=file&rev=0&sc=0
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
8
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
9 if exists("b:did_ftplugin")
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
10 finish
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
11 endif
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
12 let b:did_ftplugin = 1
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
13
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
14 " {{{1 Local settings (do on every load)
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
15 setlocal foldmethod=expr
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
16 setlocal foldexpr=GetDebChangelogFold(v:lnum)
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
17 setlocal foldtext=DebChangelogFoldText()
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
18
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
19 " Debian changelogs are not supposed to have any other text width,
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
20 " so the user cannot override this setting
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
21 setlocal tw=78
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
22 setlocal comments=f:*
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
23
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
24 " Clean unloading
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
25 let b:undo_ftplugin = "setlocal tw< comments< foldmethod< foldexpr< foldtext<"
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
26 " }}}1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 if exists("g:did_changelog_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " Don't load another plugin (this is global)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 let g:did_changelog_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
35 " {{{1 GUI menu
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
36
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 " Helper functions returning various data.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " Returns full name, either from $DEBFULLNAME or debianfullname.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " TODO Is there a way to determine name from anywhere else?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 function <SID>FullName()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 if exists("$DEBFULLNAME")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 return $DEBFULLNAME
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 elseif exists("g:debianfullname")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 return g:debianfullname
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 return "Your Name"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 " Returns email address, from $DEBEMAIL, $EMAIL or debianemail.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 function <SID>Email()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 if exists("$DEBEMAIL")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 return $DEBEMAIL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 elseif exists("$EMAIL")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 return $EMAIL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 elseif exists("g:debianemail")
481
66080ac5dab7 updated for version 7.0130
vimboss
parents: 7
diff changeset
57 return g:debianemail
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 return "your@email.address"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 " Returns date in RFC822 format.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 function <SID>Date()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 let savelang = v:lc_time
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 execute "language time C"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 let dateandtime = strftime("%a, %d %b %Y %X %z")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 execute "language time " . savelang
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 return dateandtime
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 function <SID>WarnIfNotUnfinalised()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 if match(getline("."), " -- [[:alpha:]][[:alnum:].]")!=-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 echohl WarningMsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 echo "The entry has not been unfinalised before editing."
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 echohl None
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 return 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 function <SID>Finalised()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 let savelinenum = line(".")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 normal 1G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 call search("^ -- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 if match(getline("."), " -- [[:alpha:]][[:alnum:].]")!=-1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 let returnvalue = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 let returnvalue = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 execute savelinenum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 return returnvalue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 " These functions implement the menus
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 function NewVersion()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 " The new entry is unfinalised and shall be changed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 amenu disable Changelog.New\ Version
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 amenu enable Changelog.Add\ Entry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 amenu enable Changelog.Close\ Bug
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 amenu enable Changelog.Set\ Distribution
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 amenu enable Changelog.Set\ Urgency
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 amenu disable Changelog.Unfinalise
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 amenu enable Changelog.Finalise
848
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
105 call append(0, substitute(getline(1), '-\([[:digit:]]\+\))', '-$$\1)', ''))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 call append(1, "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 call append(2, "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 call append(3, " -- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 call append(4, "")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 call Distribution("unstable")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 call Urgency("low")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 normal 1G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 call search(")")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 normal h
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 normal 
848
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
116 call setline(1, substitute(getline(1), '-\$\$', '-', ''))
f4d8553715f7 updated for version 7.0f04
vimboss
parents: 845
diff changeset
117 normal zo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 call AddEntry()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 function AddEntry()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 normal 1G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 call search("^ -- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 normal kk
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 call append(".", " * ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 normal jjj
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 let warn=<SID>WarnIfNotUnfinalised()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 normal kk
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 if warn
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 echohl MoreMsg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 call input("Hit ENTER")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 echohl None
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 startinsert!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 function CloseBug()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 normal 1G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 call search("^ -- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 let warn=<SID>WarnIfNotUnfinalised()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 normal kk
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 call append(".", " * (closes: #" . input("Bug number to close: ") . ")")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 normal j^ll
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 startinsert
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 function Distribution(dist)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 call setline(1, substitute(getline(1), ") [[:lower:] ]*;", ") " . a:dist . ";", ""))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 function Urgency(urg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 call setline(1, substitute(getline(1), "urgency=.*$", "urgency=" . a:urg, ""))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 function <SID>UnfinaliseMenu()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 " This means the entry shall be changed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 amenu disable Changelog.New\ Version
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 amenu enable Changelog.Add\ Entry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 amenu enable Changelog.Close\ Bug
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 amenu enable Changelog.Set\ Distribution
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 amenu enable Changelog.Set\ Urgency
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 amenu disable Changelog.Unfinalise
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 amenu enable Changelog.Finalise
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 function Unfinalise()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 call <SID>UnfinaliseMenu()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 normal 1G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 call search("^ -- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 call setline(".", " -- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 function <SID>FinaliseMenu()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 " This means the entry should not be changed anymore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 amenu enable Changelog.New\ Version
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 amenu disable Changelog.Add\ Entry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 amenu disable Changelog.Close\ Bug
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 amenu disable Changelog.Set\ Distribution
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 amenu disable Changelog.Set\ Urgency
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 amenu enable Changelog.Unfinalise
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 amenu disable Changelog.Finalise
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 function Finalise()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 call <SID>FinaliseMenu()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 normal 1G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 call search("^ -- ")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 call setline(".", " -- " . <SID>FullName() . " <" . <SID>Email() . "> " . <SID>Date())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 function <SID>MakeMenu()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 amenu &Changelog.&New\ Version :call NewVersion()<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 amenu Changelog.&Add\ Entry :call AddEntry()<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 amenu Changelog.&Close\ Bug :call CloseBug()<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 menu Changelog.-sep- <nul>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 amenu Changelog.Set\ &Distribution.&unstable :call Distribution("unstable")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 amenu Changelog.Set\ Distribution.&frozen :call Distribution("frozen")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 amenu Changelog.Set\ Distribution.&stable :call Distribution("stable")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 menu Changelog.Set\ Distribution.-sep- <nul>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 amenu Changelog.Set\ Distribution.frozen\ unstable :call Distribution("frozen unstable")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 amenu Changelog.Set\ Distribution.stable\ unstable :call Distribution("stable unstable")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 amenu Changelog.Set\ Distribution.stable\ frozen :call Distribution("stable frozen")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 amenu Changelog.Set\ Distribution.stable\ frozen\ unstable :call Distribution("stable frozen unstable")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 amenu Changelog.Set\ &Urgency.&low :call Urgency("low")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 amenu Changelog.Set\ Urgency.&medium :call Urgency("medium")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 amenu Changelog.Set\ Urgency.&high :call Urgency("high")<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 menu Changelog.-sep- <nul>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 amenu Changelog.U&nfinalise :call Unfinalise()<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 amenu Changelog.&Finalise :call Finalise()<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 if <SID>Finalised()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 call <SID>FinaliseMenu()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 call <SID>UnfinaliseMenu()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 augroup changelogMenu
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 au BufEnter * if &filetype == "debchangelog" | call <SID>MakeMenu() | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 au BufLeave * if &filetype == "debchangelog" | aunmenu Changelog | endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 augroup END
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
227 " }}}
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
228 " {{{1 folding
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
229
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
230 " look for an author name searching backward from a given line number
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
231 function! s:getAuthor(lnum)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
232 let line = getline(a:lnum)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
233 let backsteps = 0
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
234 while line !~ '^ --'
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
235 let backsteps += 1
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
236 let line = getline(a:lnum - backsteps)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
237 endwhile
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
238 let author = substitute(line, '^ --\s*\([^<]\+\)\s*.*', '\1', '')
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
239 return author
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
240 endfunction
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
241
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
242 function! DebChangelogFoldText()
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
243 if v:folddashes == '-' " changelog entry fold
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
244 return foldtext() . ' -- ' . s:getAuthor(v:foldend) . ' '
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
245 endif
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
246 return foldtext()
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
247 endfunction
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
248
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
249 function! GetDebChangelogFold(lnum)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
250 let line = getline(a:lnum)
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
251 if line =~ '^\w\+'
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
252 return '>1' " beginning of a changelog entry
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
253 endif
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
254 if line =~ '^\s\+\[.*\]'
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
255 return '>2' " beginning of an author-specific chunk
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
256 endif
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
257 if line =~ '^ --'
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
258 return '1'
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
259 endif
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
260 return '='
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
261 endfunction
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
262
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
263 " }}}
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
264
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 481
diff changeset
265 " vim: set foldmethod=marker: