1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-13 13:39:09 +08:00

Improve SPUpdate

This commit is contained in:
wsdjeg 2017-04-05 23:15:12 +08:00
parent 4695d33262
commit 9b5d535fa4
7 changed files with 31 additions and 11 deletions

View File

@ -153,7 +153,7 @@ Try these Neovim hangouts for any questions, problems or comments.
curl -sLf https://spacevim.org/install.sh | bash
```
**After SpaceVim is installed, launch `vim` and SpaceVim will automatically install plugins**
**After SpaceVim is installed, launch `vim` and SpaceVim will automatically install plugins**
Once plugins start installing, at the bottom of the vim window, you will see
`[dein] Install started: (YYYY/MM/DD HH:MM:SS)`

View File

@ -35,13 +35,16 @@ function! SpaceVim#commands#load() abort
command! -nargs=*
\ -complete=custom,SpaceVim#commands#complete_plugin
\ SPUpdate call SpaceVim#commands#update_plugin(<f-args>)
""
" Command for install plugins.
command! -nargs=* SPInstall call SpaceVim#commands#install_plugin(<f-args>)
endfunction
" @vimlint(EVL103, 1, a:ArgLead)
" @vimlint(EVL103, 1, a:CmdLine)
" @vimlint(EVL103, 1, a:CursorPos)
function! SpaceVim#commands#complete_plugin(ArgLead, CmdLine, CursorPos) abort
return join(g:_spacevim_plugins, "\n")
return join(keys(dein#get()), "\n")
endfunction
" @vimlint(EVL103, 0, a:ArgLead)
" @vimlint(EVL103, 0, a:CmdLine)
@ -71,12 +74,23 @@ function! SpaceVim#commands#update_plugin(...) abort
if a:0 == 0
call SpaceVim#plugins#manager#update()
else
call dein#update(a:000)
call SpaceVim#plugins#manager#update(a:000)
endif
elseif g:spacevim_plugin_manager ==# 'vim-plug'
endif
endfunction
function! SpaceVim#commands#install_plugin(...) abort
if g:spacevim_plugin_manager ==# 'neobundle'
elseif g:spacevim_plugin_manager ==# 'dein'
if a:0 == 0
call SpaceVim#plugins#manager#install()
else
call dein#install(a:000)
endif
elseif g:spacevim_plugin_manager ==# 'vim-plug'
endif
endfunction
function! SpaceVim#commands#version() abort
echo 'SpaceVim ' . g:spacevim_version . '-' . s:SHA() . "\n" .

View File

@ -189,7 +189,6 @@ function! SpaceVim#mapping#close_term_buffer(...) abort
let buffers = g:_spacevim_list_buffers
let abuf = str2nr(g:_spacevim_termclose_abuf)
let index = index(buffers, abuf)
let g:wsd = [index, abuf, buffers]
if index != -1
if index == 0
if len(buffers) > 1

View File

@ -11,7 +11,6 @@ if g:spacevim_snippet_engine ==# 'neosnippet'
\ && !neosnippet#expandable()
return "\<plug>(neosnippet_jump)"
elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'('
let g:wsd = 1
return "\<plug>(neosnippet_expand_or_jump)"
elseif pumvisible()
return "\<C-n>"

View File

@ -103,8 +103,11 @@ function! s:need_cmd(cmd) abort
endif
endfunction
function! SpaceVim#plugins#manager#install(...) abort
endfunction
" @vimlint(EVL102, 1, l:i)
function! SpaceVim#plugins#manager#update() abort
function! SpaceVim#plugins#manager#update(...) abort
call s:new_window()
let s:plugin_manager_buffer = bufnr('%')
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nomodifiable nospell
@ -114,7 +117,7 @@ function! SpaceVim#plugins#manager#update() abort
endif
nnoremap <silent> <buffer> q :bd<CR>
let s:pct = 0
let s:plugins = keys(dein#get())
let s:plugins = a:0 == 0 ? keys(dein#get()) : copy(a:1)
let s:total = len(s:plugins)
call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct . '/' . s:total . ')')
if has('nvim')
@ -125,7 +128,12 @@ function! SpaceVim#plugins#manager#update() abort
call s:append_buf_line(s:plugin_manager_buffer, 3, '')
endif
for i in range(g:spacevim_plugin_manager_max_processes)
call s:pull(dein#get(s:LIST.shift(s:plugins)))
if !empty(s:plugins)
let repo = dein#get(s:LIST.shift(s:plugins))
if !empty(repo)
call s:pull(repo)
endif
endif
endfor
endfunction
" @vimlint(EVL102, 0, l:i)
@ -141,7 +149,6 @@ endfunction
" here if a:data == 0, git pull succeed
function! s:on_pull_exit(id, data, event) abort
let g:wsd = a:data
if a:data == 0 && a:event ==# 'exit'
call s:msg_on_updated_done(s:pulling_repos[a:id].name)
else

View File

@ -106,8 +106,6 @@ function! s:git_state_to_symbol(s) abort
return g:VimFilerGitIndicatorMap[name]
endfunction
let g:wsd = []
" @vimlint(EVL103, 1, a:context)
function! s:column.get(file, context) abort
let cmd = 'git -c color.status=false status -s ' . fnamemodify(a:file.action__path, ':.')

View File

@ -344,6 +344,9 @@ COMMANDS *SpaceVim-commands*
:SPUpdate vim-airline
<
:SPInstall *:SPInstall*
Command for install plugins.
==============================================================================
FUNCTIONS *SpaceVim-functions*