mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 02:50:03 +08:00
Merge branch 'install_status' into dev
This commit is contained in:
commit
f26af7a6a7
@ -22,7 +22,7 @@ let s:pulling_repos = {}
|
|||||||
let s:ui_buf = {}
|
let s:ui_buf = {}
|
||||||
let s:plugin_manager_buffer = 0
|
let s:plugin_manager_buffer = 0
|
||||||
|
|
||||||
" install plugin manager
|
" install plugin manager
|
||||||
function! s:install_manager() abort
|
function! s:install_manager() abort
|
||||||
" Fsep && Psep
|
" Fsep && Psep
|
||||||
if has('win16') || has('win32') || has('win64')
|
if has('win16') || has('win32') || has('win64')
|
||||||
@ -213,6 +213,17 @@ function! s:on_pull_exit(id, data, event) abort
|
|||||||
|
|
||||||
endfunction
|
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\+)')
|
||||||
|
if !empty(status)
|
||||||
|
call s:msg_on_install_process(s:pulling_repos[a:id].name, status)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
" @vimlint(EVL103, 0, a:event)
|
||||||
|
|
||||||
" here if a:data == 0, git pull succeed
|
" here if a:data == 0, git pull succeed
|
||||||
function! s:on_install_exit(id, data, event) abort
|
function! s:on_install_exit(id, data, event) abort
|
||||||
if a:data == 0 && a:event ==# 'exit'
|
if a:data == 0 && a:event ==# 'exit'
|
||||||
@ -254,8 +265,9 @@ function! s:install(repo) abort
|
|||||||
let s:pct += 1
|
let s:pct += 1
|
||||||
let s:ui_buf[a:repo.name] = s:pct
|
let s:ui_buf[a:repo.name] = s:pct
|
||||||
let url = 'https://github.com/' . a:repo.repo
|
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,{
|
let jobid = s:JOB.start(argv,{
|
||||||
|
\ 'on_stderr' : function('s:on_install_stdout'),
|
||||||
\ 'on_exit' : function('s:on_install_exit')
|
\ 'on_exit' : function('s:on_install_exit')
|
||||||
\ })
|
\ })
|
||||||
if jobid != 0
|
if jobid != 0
|
||||||
@ -291,6 +303,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.')
|
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '- ' . a:name . ': Updating failed.')
|
||||||
endfunction
|
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.
|
" - foo.vim: Updating done.
|
||||||
function! s:msg_on_install_done(name) abort
|
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.')
|
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '- ' . a:name . ': Installing done.')
|
||||||
@ -312,7 +329,7 @@ function! s:new_window() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" change modifiable before setline
|
" 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
|
function! s:set_buf_line(bufnr, nr, line) abort
|
||||||
call setbufvar(s:plugin_manager_buffer,'&ma', 1)
|
call setbufvar(s:plugin_manager_buffer,'&ma', 1)
|
||||||
call nvim_buf_set_lines(a:bufnr, a:nr - 1, a:nr, 0, [a:line])
|
call nvim_buf_set_lines(a:bufnr, a:nr - 1, a:nr, 0, [a:line])
|
||||||
|
Loading…
Reference in New Issue
Block a user