From 7d9b10874e374f0db4ae47aa55e49033174bbf50 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Mon, 28 Apr 2014 12:14:18 +0200 Subject: [PATCH] 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. --- autoload/vundle/scripts.vim | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 4a066fb..f9f2355 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -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] @@ -83,18 +84,19 @@ 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 @@ -102,14 +104,15 @@ 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