mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 17:40:40 +08:00
commit
bf9be875f7
@ -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)
|
||||
@ -131,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, '')
|
||||
@ -157,21 +159,23 @@ 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
|
||||
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, '')
|
||||
@ -218,8 +222,13 @@ function! s:on_pull_exit(id, data, event) abort
|
||||
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, 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)
|
||||
@ -233,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.')
|
||||
@ -258,7 +267,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
|
||||
|
||||
@ -268,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: '
|
||||
@ -286,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)
|
||||
@ -351,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
|
||||
@ -389,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.
|
||||
@ -404,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.
|
||||
@ -414,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user