From b756d065211c9ebd345ef2e9b9406caecc16e4a2 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 15 Apr 2017 21:20:53 +0800 Subject: [PATCH 1/5] Fix resume windows --- autoload/SpaceVim/plugins/manager.vim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index ed1b6fe6e..d817eae3f 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -116,12 +116,13 @@ endfunction " @vimlint(EVL102, 1, l:i) function! SpaceVim#plugins#manager#install(...) abort let s:plugins = a:0 == 0 ? sort(map(s:get_uninstalled_plugins(), 'v:val.name')) : sort(copy(a:1)) - if s:new_window() == 0 + let status = s:new_window() + if status == 0 echohl WarningMsg echom '[SpaceVim] [plugin manager] plugin manager process is not finished.' echohl None return - elseif s:new_window() == 1 + elseif status == 1 " resume window return elseif empty(s:plugins) @@ -157,12 +158,13 @@ endfunction " @vimlint(EVL102, 1, l:i) function! SpaceVim#plugins#manager#update(...) abort - if s:new_window() == 0 + let status = s:new_window() + if status == 0 echohl WarningMsg echom '[SpaceVim] [plugin manager] plugin updating is not finished.' echohl None return - elseif s:new_window() == 1 + elseif status == 1 return endif let s:pct = 0 From 1191ebf1024207f428a7cc6187e61bb6bba9d81c Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 15 Apr 2017 22:15:13 +0800 Subject: [PATCH 2/5] Fix updated count --- autoload/SpaceVim/plugins/manager.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index d817eae3f..6674cebcb 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -168,12 +168,13 @@ function! SpaceVim#plugins#manager#update(...) abort return endif let s:pct = 0 + let s:pct_done = 0 let s:plugins = a:0 == 0 ? sort(keys(dein#get())) : sort(copy(a:1)) if a:0 == 0 call add(s:plugins, 'SpaceVim') endif let s:total = len(s:plugins) - call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct . '/' . s:total . ')') + call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')') if has('nvim') call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar()) call s:set_buf_line(s:plugin_manager_buffer, 3, '') @@ -215,12 +216,13 @@ endfunction " here if a:data == 0, git pull succeed function! s:on_pull_exit(id, data, event) abort + let s:pct_done += 1 if a:data == 0 && a:event ==# 'exit' call s:msg_on_updated_done(s:pulling_repos[a:id].name) else call s:msg_on_updated_failed(s:pulling_repos[a:id].name) endif - call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct . '/' . s:total . ')') + call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')') call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar()) call remove(s:pulling_repos, string(a:id)) if !empty(s:plugins) @@ -260,7 +262,6 @@ endfunction function! s:lock_revision(repo) abort let cmd = ['git', '-C', a:repo.path, 'checkout', a:repo.rev] - let g:wsd = cmd call s:VIM_CO.system(cmd) endfunction From ee8c3a4c5547775c5bf4f3e7f41ca16935ce49bc Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 15 Apr 2017 22:36:58 +0800 Subject: [PATCH 3/5] Fix building progress --- autoload/SpaceVim/plugins/manager.vim | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index 6674cebcb..a1a140407 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -132,8 +132,9 @@ function! SpaceVim#plugins#manager#install(...) abort return endif let s:pct = 0 + let s:pct_done = 0 let s:total = len(s:plugins) - call s:set_buf_line(s:plugin_manager_buffer, 1, 'Installing plugins (' . s:pct . '/' . s:total . ')') + call s:set_buf_line(s:plugin_manager_buffer, 1, 'Installing plugins (' . s:pct_done . '/' . s:total . ')') if has('nvim') call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar()) call s:set_buf_line(s:plugin_manager_buffer, 3, '') @@ -216,14 +217,18 @@ endfunction " here if a:data == 0, git pull succeed function! s:on_pull_exit(id, data, event) abort - let s:pct_done += 1 if a:data == 0 && a:event ==# 'exit' call s:msg_on_updated_done(s:pulling_repos[a:id].name) else call s:msg_on_updated_failed(s:pulling_repos[a:id].name) endif - call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')') - call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar()) + if get(s:pulling_repos[a:id], 'build', '') !=# '' + call s:build(s:pulling_repos[a:id]) + else + let s:pct_done += 1 + call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')') + call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar()) + endif call remove(s:pulling_repos, string(a:id)) if !empty(s:plugins) let name = s:LIST.shift(s:plugins) @@ -237,7 +242,7 @@ function! s:on_pull_exit(id, data, event) abort endif call s:pull(repo) endif - if empty(s:pulling_repos) + if empty(s:pulling_repos) && empty(s:building_repos) " TODO add elapsed time info. call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updated. Elapsed time: ' \ . split(reltimestr(reltime(s:start_time)))[0] . ' sec.') @@ -271,6 +276,10 @@ function! s:on_build_exit(id, data, event) abort else call s:msg_on_build_failed(s:building_repos[a:id].name) endif + let s:pct_done += 1 + call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')') + call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar()) + call remove(s:building_repos, string(a:id)) if empty(s:pulling_repos) && empty(s:building_repos) " TODO add elapsed time info. call s:set_buf_line(s:plugin_manager_buffer, 1, 'Installed. Elapsed time: ' @@ -289,13 +298,15 @@ function! s:on_install_exit(id, data, event) abort else call s:msg_on_install_failed(s:pulling_repos[a:id].name) endif - call s:set_buf_line(s:plugin_manager_buffer, 1, 'Installing plugins (' . s:pct . '/' . s:total . ')') - call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar()) if get(s:pulling_repos[a:id], 'rev', '') !=# '' call s:lock_revision(s:pulling_repos[a:id]) endif if get(s:pulling_repos[a:id], 'build', '') !=# '' call s:build(s:pulling_repos[a:id]) + else + let s:pct_done += 1 + call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')') + call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar()) endif call remove(s:pulling_repos, string(a:id)) if !empty(s:plugins) From d4b8131be0d2bd6b6ca111497ad60c6de9694ca4 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 15 Apr 2017 22:39:53 +0800 Subject: [PATCH 4/5] Mark failed plugins --- autoload/SpaceVim/plugins/manager.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index a1a140407..6291cbb55 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -403,7 +403,7 @@ endfunction " - foo.vim: Updating failed. function! s:msg_on_updated_failed(name) abort - call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '- ' . a:name . ': Updating failed.') + call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '* ' . a:name . ': Updating failed.') endfunction function! s:msg_on_install_process(name, status) abort @@ -418,7 +418,7 @@ endfunction " - foo.vim: Updating failed. function! s:msg_on_install_failed(name) abort - call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '- ' . a:name . ': Installing failed.') + call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '* ' . a:name . ': Installing failed.') endfunction " - foo.vim: Updating done. @@ -428,7 +428,7 @@ endfunction " - foo.vim: Updating failed. function! s:msg_on_build_failed(name) abort - call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '- ' . a:name . ': Building failed.') + call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '* ' . a:name . ': Building failed.') endfunction function! s:new_window() abort From ac25743682619b5cd7ccf44bdf20831f1209ca45 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 15 Apr 2017 22:47:23 +0800 Subject: [PATCH 5/5] Mark in progress plugins --- autoload/SpaceVim/plugins/manager.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index 6291cbb55..14ca2ff6c 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -365,7 +365,7 @@ endfunction function! s:msg_on_build_start(name) abort call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, - \ '- ' . a:name . ': Building ') + \ '* ' . a:name . ': Building ') endfunction function! s:get_build_argv(build) abort @@ -403,12 +403,12 @@ endfunction " - foo.vim: Updating failed. function! s:msg_on_updated_failed(name) abort - call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '* ' . a:name . ': Updating failed.') + call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Updating failed.') endfunction function! s:msg_on_install_process(name, status) abort call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, - \ '- ' . a:name . ': Installing ' . a:status) + \ '* ' . a:name . ': Installing ' . a:status) endfunction " - foo.vim: Updating done. @@ -418,7 +418,7 @@ endfunction " - foo.vim: Updating failed. function! s:msg_on_install_failed(name) abort - call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '* ' . a:name . ': Installing failed.') + call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Installing failed.') endfunction " - foo.vim: Updating done. @@ -428,7 +428,7 @@ endfunction " - foo.vim: Updating failed. function! s:msg_on_build_failed(name) abort - call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '* ' . a:name . ': Building failed.') + call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Building failed.') endfunction function! s:new_window() abort