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.
This commit is contained in:
parent
c4d68bcf7c
commit
7d9b10874e
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user