From 35e742b90aef9958db000cd12f2efad741658b0a Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 7 Apr 2017 22:33:23 +0800 Subject: [PATCH 1/3] Add msg on install status --- autoload/SpaceVim/plugins/manager.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index aa7efad94..161d47ae3 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -291,6 +291,11 @@ 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.') 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) +endfunction + " - foo.vim: Updating done. function! s:msg_on_install_done(name) abort call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '- ' . a:name . ': Installing done.') From 76513fcebee1199ccf9334690c9446312af6a367 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 7 Apr 2017 23:53:15 +0800 Subject: [PATCH 2/3] Add install status --- autoload/SpaceVim/plugins/manager.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index 161d47ae3..fa7fe39a2 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -212,6 +212,14 @@ function! s:on_pull_exit(id, data, event) abort endif endfunction +function! s:on_install_stdout(id, data, event) abort + for str in a:data + let status = matchstr(str,'\d\+%\s(\d\+/\d\+)') + if !empty(status) + call s:msg_on_install_process(s:pulling_repos[a:id].name, status) + endif + endfor +endfunction " here if a:data == 0, git pull succeed function! s:on_install_exit(id, data, event) abort @@ -254,8 +262,9 @@ function! s:install(repo) abort let s:pct += 1 let s:ui_buf[a:repo.name] = s:pct let url = 'https://github.com/' . a:repo.repo - let argv = ['git', 'clone', url, a:repo.path] + let argv = ['git', 'clone', '--progress', url, a:repo.path] let jobid = s:JOB.start(argv,{ + \ 'on_stderr' : function('s:on_install_stdout'), \ 'on_exit' : function('s:on_install_exit') \ }) if jobid != 0 From 3af97e6319451ad22ef5cd0061e7684f8f26cf2a Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 8 Apr 2017 00:18:49 +0800 Subject: [PATCH 3/3] Fix lint --- autoload/SpaceVim/plugins/manager.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index fa7fe39a2..69e37044e 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -22,7 +22,7 @@ let s:pulling_repos = {} let s:ui_buf = {} let s:plugin_manager_buffer = 0 -" install plugin manager +" install plugin manager function! s:install_manager() abort " Fsep && Psep if has('win16') || has('win32') || has('win64') @@ -212,6 +212,8 @@ function! s:on_pull_exit(id, data, event) abort endif endfunction + +" @vimlint(EVL103, 1, a:event) function! s:on_install_stdout(id, data, event) abort for str in a:data let status = matchstr(str,'\d\+%\s(\d\+/\d\+)') @@ -220,6 +222,7 @@ function! s:on_install_stdout(id, data, event) abort endif endfor endfunction +" @vimlint(EVL103, 0, a:event) " here if a:data == 0, git pull succeed function! s:on_install_exit(id, data, event) abort @@ -326,7 +329,7 @@ function! s:new_window() abort endfunction " change modifiable before setline -if has('nvim') && exists('*nvim_buf_set_lines') +if has('nvim') && exists('*nvim_buf_set_lines') function! s:set_buf_line(bufnr, nr, line) abort call setbufvar(s:plugin_manager_buffer,'&ma', 1) call nvim_buf_set_lines(a:bufnr, a:nr - 1, a:nr, 0, [a:line])