Skip to content

Commit

Permalink
Allow multiple calls to VundleChangelog.
Browse files Browse the repository at this point in the history
The command `silent pedit ...` was causing trouble if the user had `set
hidden`.  Now we `bdelete` the changelog buffer before editing it anew.
  • Loading branch information
lucc committed Mar 3, 2015
1 parent c4d68bc commit 7d9b108
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions autoload/vundle/scripts.vim
Expand Up @@ -70,6 +70,7 @@ endf
" user.
" ---------------------------------------------------------------------------
func! s:create_changelog() abort
let changelog = ['Updated Plugins:']
for bundle_data in g:updated_bundles
let initial_sha = bundle_data[0]
let updated_sha = bundle_data[1]
Expand All @@ -83,33 +84,35 @@ func! s:create_changelog() abort

let updates = system(cmd)

call add(g:vundle_changelog, '')
call add(g:vundle_changelog, 'Updated Plugin: '.bundle.name)
call add(changelog, '')
call add(changelog, 'Updated Plugin: '.bundle.name)

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

for update in split(updates, '\n')
let update = substitute(update, '\s\+$', '', '')
call add(g:vundle_changelog, ' '.update)
call add(changelog, ' '.update)
endfor
endfor
return changelog
endf


" ---------------------------------------------------------------------------
" View the change log after an update or installation.
" ---------------------------------------------------------------------------
func! s:view_changelog()
call s:create_changelog()

if !exists('g:vundle_changelog_file')
let g:vundle_changelog_file = tempname()
if !exists('s:changelog_file')
let s:changelog_file = tempname()
endif

call writefile(g:vundle_changelog, g:vundle_changelog_file)
execute 'silent pedit ' . g:vundle_changelog_file
if bufloaded(s:changelog_file)
execute 'silent bdelete' s:changelog_file
endif
call writefile(s:create_changelog(), s:changelog_file)
execute 'silent pedit' s:changelog_file

wincmd P | wincmd H
endf
Expand Down

0 comments on commit 7d9b108

Please sign in to comment.