Skip to content

Commit 7d9b108

Browse files
committed
Allow multiple calls to VundleChangelog.
The command `silent pedit ...` was causing trouble if the user had `set hidden`. Now we `bdelete` the changelog buffer before editing it anew.
1 parent c4d68bc commit 7d9b108

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

autoload/vundle/scripts.vim

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ endf
7070
" user.
7171
" ---------------------------------------------------------------------------
7272
func! s:create_changelog() abort
73+
let changelog = ['Updated Plugins:']
7374
for bundle_data in g:updated_bundles
7475
let initial_sha = bundle_data[0]
7576
let updated_sha = bundle_data[1]
@@ -83,33 +84,35 @@ func! s:create_changelog() abort
8384

8485
let updates = system(cmd)
8586

86-
call add(g:vundle_changelog, '')
87-
call add(g:vundle_changelog, 'Updated Plugin: '.bundle.name)
87+
call add(changelog, '')
88+
call add(changelog, 'Updated Plugin: '.bundle.name)
8889

8990
if bundle.uri =~ "https://github.com"
90-
call add(g:vundle_changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.initial_sha.'...'.updated_sha)
91+
call add(changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.initial_sha.'...'.updated_sha)
9192
endif
9293

9394
for update in split(updates, '\n')
9495
let update = substitute(update, '\s\+$', '', '')
95-
call add(g:vundle_changelog, ' '.update)
96+
call add(changelog, ' '.update)
9697
endfor
9798
endfor
99+
return changelog
98100
endf
99101

100102

101103
" ---------------------------------------------------------------------------
102104
" View the change log after an update or installation.
103105
" ---------------------------------------------------------------------------
104106
func! s:view_changelog()
105-
call s:create_changelog()
106-
107-
if !exists('g:vundle_changelog_file')
108-
let g:vundle_changelog_file = tempname()
107+
if !exists('s:changelog_file')
108+
let s:changelog_file = tempname()
109109
endif
110110

111-
call writefile(g:vundle_changelog, g:vundle_changelog_file)
112-
execute 'silent pedit ' . g:vundle_changelog_file
111+
if bufloaded(s:changelog_file)
112+
execute 'silent bdelete' s:changelog_file
113+
endif
114+
call writefile(s:create_changelog(), s:changelog_file)
115+
execute 'silent pedit' s:changelog_file
113116

114117
wincmd P | wincmd H
115118
endf

0 commit comments

Comments
 (0)