mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-22 08:45:42 +08:00
Rewrite plugin manager (#1446)
* Rewrite plugin manager * Rewrite plugin manager * Improve max processes * Fix * Fixup * Fixup * Fixup * Fixup * Fixup * Add func for terminal plugin manager * Fix plugin manager * Add key binding for view plugin status
This commit is contained in:
parent
43f7914364
commit
c580ac62ee
@ -328,7 +328,7 @@ let g:spacevim_filemanager = 'vimfiler'
|
|||||||
let g:spacevim_plugin_manager = 'dein'
|
let g:spacevim_plugin_manager = 'dein'
|
||||||
""
|
""
|
||||||
" Set the max process of SpaceVim plugin manager
|
" Set the max process of SpaceVim plugin manager
|
||||||
let g:spacevim_plugin_manager_max_processes = 8
|
let g:spacevim_plugin_manager_max_processes = 16
|
||||||
""
|
""
|
||||||
" Enable/Disable checkinstall on SpaceVim startup. Default is 1.
|
" Enable/Disable checkinstall on SpaceVim startup. Default is 1.
|
||||||
" >
|
" >
|
||||||
|
@ -62,6 +62,8 @@ endfunction
|
|||||||
|
|
||||||
" just same as nvim_buf_set_lines
|
" just same as nvim_buf_set_lines
|
||||||
function! s:self.buf_set_lines(buffer, start, end, strict_indexing, replacement) abort
|
function! s:self.buf_set_lines(buffer, start, end, strict_indexing, replacement) abort
|
||||||
|
let ma = getbufvar(a:buffer, '&ma')
|
||||||
|
call setbufvar(a:buffer,'&ma', 1)
|
||||||
if exists('*nvim_buf_set_lines')
|
if exists('*nvim_buf_set_lines')
|
||||||
call nvim_buf_set_lines(a:buffer, a:start, a:end, a:strict_indexing, a:replacement)
|
call nvim_buf_set_lines(a:buffer, a:start, a:end, a:strict_indexing, a:replacement)
|
||||||
elseif has('python')
|
elseif has('python')
|
||||||
@ -93,6 +95,7 @@ function! s:self.buf_set_lines(buffer, start, end, strict_indexing, replacement)
|
|||||||
exe 'b' . a:buffer
|
exe 'b' . a:buffer
|
||||||
call setline(a:start - 1, a:replacement)
|
call setline(a:start - 1, a:replacement)
|
||||||
endif
|
endif
|
||||||
|
call setbufvar(a:buffer,'&ma', ma)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ function! SpaceVim#autocmds#init() abort
|
|||||||
autocmd VimEnter * call SpaceVim#autocmds#VimEnter()
|
autocmd VimEnter * call SpaceVim#autocmds#VimEnter()
|
||||||
autocmd BufEnter * let b:_spacevim_project_name = get(g:, '_spacevim_project_name', '')
|
autocmd BufEnter * let b:_spacevim_project_name = get(g:, '_spacevim_project_name', '')
|
||||||
autocmd SessionLoadPost * let g:_spacevim_session_loaded = 1
|
autocmd SessionLoadPost * let g:_spacevim_session_loaded = 1
|
||||||
|
autocmd VimLeavePre * call SpaceVim#plugins#manager#terminal()
|
||||||
augroup END
|
augroup END
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -1,28 +1,33 @@
|
|||||||
"=============================================================================
|
"=============================================================================
|
||||||
" manager.vim --- plugin manager for SpaceVim
|
" manager.vim --- UI for dein in SpaceVim
|
||||||
" Copyright (c) 2016-2017 Shidong Wang & Contributors
|
" Copyright (c) 2016-2017 Shidong Wang & Contributors
|
||||||
" Author: Shidong Wang < wsdjeg at 163.com >
|
" Author: Shidong Wang < wsdjeg at 163.com >
|
||||||
" URL: https://spacevim.org
|
" URL: https://spacevim.org
|
||||||
" License: GPLv3
|
" License: GPLv3
|
||||||
"=============================================================================
|
"=============================================================================
|
||||||
|
|
||||||
" Load SpaceVim api
|
" Load SpaceVim APIs {{{
|
||||||
let s:VIM_CO = SpaceVim#api#import('vim#compatible')
|
let s:VIM_CO = SpaceVim#api#import('vim#compatible')
|
||||||
let s:JOB = SpaceVim#api#import('job')
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
let s:LIST = SpaceVim#api#import('data#list')
|
let s:LIST = SpaceVim#api#import('data#list')
|
||||||
|
let s:BUFFER = SpaceVim#api#import('vim#buffer')
|
||||||
|
let s:TERM = SpaceVim#api#import('term')
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" init values {{{
|
||||||
" init values
|
|
||||||
let s:plugins = []
|
let s:plugins = []
|
||||||
let s:pulling_repos = {}
|
let s:pulling_repos = {}
|
||||||
let s:building_repos = {}
|
let s:building_repos = {}
|
||||||
|
let s:plugin_status = {}
|
||||||
" key : plugin name, value : buf line number in manager buffer.
|
" key : plugin name, value : buf line number in manager buffer.
|
||||||
let s:ui_buf = {}
|
let s:plugin_nrs = {}
|
||||||
let s:plugin_manager_buffer = 0
|
|
||||||
let s:plugin_manager_buffer_lines = []
|
|
||||||
let s:jobpid = 0
|
|
||||||
|
|
||||||
" install plugin manager
|
" plugin manager buffer
|
||||||
|
let s:buffer_id = 0
|
||||||
|
let s:buffer_lines = []
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" func: 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')
|
||||||
@ -95,7 +100,9 @@ function! s:install_manager() abort
|
|||||||
exec 'set runtimepath+=~/.cache/vim-plug/'
|
exec 'set runtimepath+=~/.cache/vim-plug/'
|
||||||
endif
|
endif
|
||||||
endf
|
endf
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" func: need_cmd {{{
|
||||||
function! s:need_cmd(cmd) abort
|
function! s:need_cmd(cmd) abort
|
||||||
if executable(a:cmd)
|
if executable(a:cmd)
|
||||||
return 1
|
return 1
|
||||||
@ -104,22 +111,35 @@ function! s:need_cmd(cmd) abort
|
|||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" func: get_uninstalled_plugins {{{
|
||||||
function! s:get_uninstalled_plugins() abort
|
function! s:get_uninstalled_plugins() abort
|
||||||
return filter(values(dein#get()), '!isdirectory(v:val.path)')
|
return filter(values(dein#get()), '!isdirectory(v:val.path)')
|
||||||
endfunction
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Public API: SpaceVim#plugins#manager#reinstall {{{
|
||||||
function! SpaceVim#plugins#manager#reinstall(...)
|
function! SpaceVim#plugins#manager#reinstall(...) abort
|
||||||
call dein#reinstall(a:1)
|
call dein#reinstall(a:1)
|
||||||
endfunction
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" Public API: SpaceVim#plugins#manager#terminal {{{
|
||||||
|
function! SpaceVim#plugins#manager#terminal()
|
||||||
|
for id in keys(s:pulling_repos)
|
||||||
|
call s:JOB.stop(str2nr(id))
|
||||||
|
endfor
|
||||||
|
for id in keys(s:building_repos)
|
||||||
|
call s:JOB.stop(str2nr(id))
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
|
" Public API: SpaceVim#plugins#manager#install {{{
|
||||||
" @vimlint(EVL102, 1, l:i)
|
" @vimlint(EVL102, 1, l:i)
|
||||||
function! SpaceVim#plugins#manager#install(...) abort
|
function! SpaceVim#plugins#manager#install(...) abort
|
||||||
if !s:JOB.vim_job && !s:JOB.nvim_job
|
|
||||||
let &maxfuncdepth = 2000
|
|
||||||
endif
|
|
||||||
let plugins = a:0 == 0 ? sort(map(s:get_uninstalled_plugins(), 'v:val.name')) : sort(copy(a:1))
|
let plugins = a:0 == 0 ? sort(map(s:get_uninstalled_plugins(), 'v:val.name')) : sort(copy(a:1))
|
||||||
if empty(plugins)
|
if empty(plugins)
|
||||||
call SpaceVim#logger#warn(' [ plug manager ] All of the plugins are already installed.', 1)
|
call SpaceVim#logger#warn(' [ plug manager ] All of the plugins are already installed.', 1)
|
||||||
@ -137,17 +157,9 @@ function! SpaceVim#plugins#manager#install(...) abort
|
|||||||
let s:pct = 0
|
let s:pct = 0
|
||||||
let s:pct_done = 0
|
let s:pct_done = 0
|
||||||
let s:total = len(s:plugins)
|
let s:total = len(s:plugins)
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 1, 'Installing plugins (' . s:pct_done . '/' . s:total . ')')
|
call s:setline(1, 'Installing plugins (' . s:pct_done . '/' . s:total . ')')
|
||||||
if has('nvim')
|
call s:setline(2, s:status_bar())
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
call s:setline(3, '')
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 3, '')
|
|
||||||
elseif has('python')
|
|
||||||
call s:append_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
|
||||||
call s:append_buf_line(s:plugin_manager_buffer, 3, '')
|
|
||||||
else
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 3, '')
|
|
||||||
endif
|
|
||||||
let s:start_time = reltime()
|
let s:start_time = reltime()
|
||||||
for i in range(g:spacevim_plugin_manager_max_processes)
|
for i in range(g:spacevim_plugin_manager_max_processes)
|
||||||
if !empty(s:plugins)
|
if !empty(s:plugins)
|
||||||
@ -157,17 +169,11 @@ function! SpaceVim#plugins#manager#install(...) abort
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if !s:JOB.vim_job && !s:JOB.nvim_job
|
|
||||||
let &maxfuncdepth = 100
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
" @vimlint(EVL102, 0, l:i)
|
" }}}
|
||||||
|
|
||||||
" @vimlint(EVL102, 1, l:i)
|
" Public API: SpaceVim#plugins#manager#update {{{
|
||||||
function! SpaceVim#plugins#manager#update(...) abort
|
function! SpaceVim#plugins#manager#update(...) abort
|
||||||
if !s:JOB.vim_job && !s:JOB.nvim_job
|
|
||||||
let &maxfuncdepth = 2000
|
|
||||||
endif
|
|
||||||
let status = s:new_window()
|
let status = s:new_window()
|
||||||
if status == 0
|
if status == 0
|
||||||
echohl WarningMsg
|
echohl WarningMsg
|
||||||
@ -188,17 +194,9 @@ function! SpaceVim#plugins#manager#update(...) abort
|
|||||||
call add(s:plugins, 'SpaceVim')
|
call add(s:plugins, 'SpaceVim')
|
||||||
endif
|
endif
|
||||||
let s:total = len(s:plugins)
|
let s:total = len(s:plugins)
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')')
|
call s:setline(1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')')
|
||||||
if has('nvim')
|
call s:setline(2, s:status_bar())
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
call s:setline(3, '')
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 3, '')
|
|
||||||
elseif has('python')
|
|
||||||
call s:append_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
|
||||||
call s:append_buf_line(s:plugin_manager_buffer, 3, '')
|
|
||||||
else
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 3, '')
|
|
||||||
endif
|
|
||||||
let s:start_time = reltime()
|
let s:start_time = reltime()
|
||||||
for i in range(g:spacevim_plugin_manager_max_processes)
|
for i in range(g:spacevim_plugin_manager_max_processes)
|
||||||
if !empty(s:plugins)
|
if !empty(s:plugins)
|
||||||
@ -209,10 +207,9 @@ function! SpaceVim#plugins#manager#update(...) abort
|
|||||||
elseif reponame ==# 'SpaceVim'
|
elseif reponame ==# 'SpaceVim'
|
||||||
let repo = {
|
let repo = {
|
||||||
\ 'name' : 'SpaceVim',
|
\ 'name' : 'SpaceVim',
|
||||||
\ 'path' : fnamemodify(g:Config_Main_Home, ':h')
|
\ 'path' : fnamemodify(g:_spacevim_root_dir, ':h')
|
||||||
\ }
|
\ }
|
||||||
call s:pull(repo)
|
call s:pull(repo)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -221,25 +218,74 @@ function! SpaceVim#plugins#manager#update(...) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
" @vimlint(EVL102, 0, l:i)
|
" @vimlint(EVL102, 0, l:i)
|
||||||
|
" }}}
|
||||||
|
|
||||||
function! s:status_bar() abort
|
" Actions:
|
||||||
let bar = '['
|
|
||||||
let ct = 50 * s:pct / s:total
|
" pull {{{
|
||||||
let bar .= repeat('=', ct)
|
function! s:pull(repo) abort
|
||||||
let bar .= repeat(' ', 50 - ct)
|
let s:pct += 1
|
||||||
let bar .= ']'
|
let s:plugin_nrs[a:repo.name] = s:pct
|
||||||
return bar
|
let argv = ['git', 'pull', '--progress']
|
||||||
|
let jobid = s:JOB.start(argv,{
|
||||||
|
\ 'on_stderr' : function('s:on_git_stdout'),
|
||||||
|
\ 'cwd' : a:repo.path,
|
||||||
|
\ 'on_exit' : function('s:on_pull_exit')
|
||||||
|
\ })
|
||||||
|
if jobid != 0
|
||||||
|
let s:pulling_repos[jobid] = a:repo
|
||||||
|
call s:msg_on_update_start(a:repo.name)
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" install {{{
|
||||||
|
function! s:install(repo) abort
|
||||||
|
let s:pct += 1
|
||||||
|
let s:plugin_nrs[a:repo.name] = s:pct
|
||||||
|
let url = 'https://github.com/' . a:repo.repo
|
||||||
|
let argv = ['git', 'clone', '--recursive', '--progress', url, a:repo.path]
|
||||||
|
let jobid = s:JOB.start(argv,{
|
||||||
|
\ 'on_stderr' : function('s:on_git_stdout'),
|
||||||
|
\ 'on_exit' : function('s:on_install_exit')
|
||||||
|
\ })
|
||||||
|
if jobid != 0
|
||||||
|
let s:pulling_repos[jobid] = a:repo
|
||||||
|
call s:msg_on_install_start(a:repo.name)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" build {{{
|
||||||
|
function! s:build(repo) abort
|
||||||
|
let argv = type(a:repo.build) != 4 ? a:repo.build : s:get_build_argv(a:repo.build)
|
||||||
|
let jobid = s:JOB.start(argv,{
|
||||||
|
\ 'on_exit' : function('s:on_build_exit'),
|
||||||
|
\ 'cwd' : a:repo.path,
|
||||||
|
\ })
|
||||||
|
if jobid > 0
|
||||||
|
let s:building_repos[jobid . ''] = a:repo
|
||||||
|
call s:msg_on_build_start(a:repo.name)
|
||||||
|
elseif jobid == 0
|
||||||
|
call s:msg_on_build_failed(a:repo.name)
|
||||||
|
elseif jobid == -1
|
||||||
|
if type(argv) == type([])
|
||||||
|
call s:msg_on_build_failed(a:repo.name, argv[0] . ' is not executable')
|
||||||
|
else
|
||||||
|
call s:msg_on_build_failed(a:repo.name)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" call back functions
|
||||||
|
|
||||||
|
" on_pull_exit {{{
|
||||||
" here if a:data == 0, git pull succeed
|
" here if a:data == 0, git pull succeed
|
||||||
function! s:on_pull_exit(id, data, event) abort
|
function! s:on_pull_exit(id, data, event) abort
|
||||||
if a:id == -1
|
let id = a:id
|
||||||
let id = s:jobpid
|
|
||||||
else
|
|
||||||
let id = a:id
|
|
||||||
endif
|
|
||||||
if a:data == 0 && a:event ==# 'exit'
|
if a:data == 0 && a:event ==# 'exit'
|
||||||
call s:msg_on_updated_done(s:pulling_repos[id].name)
|
call s:msg_on_update_done(s:pulling_repos[id].name)
|
||||||
else
|
else
|
||||||
if a:data == 1
|
if a:data == 1
|
||||||
call s:msg_on_updated_failed(s:pulling_repos[id].name, ' The plugin dir is dirty')
|
call s:msg_on_updated_failed(s:pulling_repos[id].name, ' The plugin dir is dirty')
|
||||||
@ -247,15 +293,12 @@ function! s:on_pull_exit(id, data, event) abort
|
|||||||
call s:msg_on_updated_failed(s:pulling_repos[id].name)
|
call s:msg_on_updated_failed(s:pulling_repos[id].name)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if a:id == -1
|
|
||||||
redraw!
|
|
||||||
endif
|
|
||||||
if !empty(get(s:pulling_repos[id], 'build', '')) && a:data == 0
|
if !empty(get(s:pulling_repos[id], 'build', '')) && a:data == 0
|
||||||
call s:build(s:pulling_repos[id])
|
call s:build(s:pulling_repos[id])
|
||||||
else
|
else
|
||||||
let s:pct_done += 1
|
let s:pct_done += 1
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')')
|
call s:setline(1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')')
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
call s:setline(2, s:status_bar())
|
||||||
endif
|
endif
|
||||||
call remove(s:pulling_repos, string(id))
|
call remove(s:pulling_repos, string(id))
|
||||||
if !empty(s:plugins)
|
if !empty(s:plugins)
|
||||||
@ -270,72 +313,38 @@ function! s:on_pull_exit(id, data, event) abort
|
|||||||
endif
|
endif
|
||||||
call s:pull(repo)
|
call s:pull(repo)
|
||||||
endif
|
endif
|
||||||
call s:recache_rtp(a:id)
|
call s:recache_rtp()
|
||||||
endfunction
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" on_git_stdout : {{{
|
||||||
function! s:recache_rtp(id) abort
|
|
||||||
if empty(s:pulling_repos) && empty(s:building_repos) && !exists('s:recache_done')
|
|
||||||
" 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.')
|
|
||||||
let s:plugin_manager_buffer = 0
|
|
||||||
if g:spacevim_plugin_manager ==# 'dein'
|
|
||||||
call dein#recache_runtimepath()
|
|
||||||
endif
|
|
||||||
if a:id == -1
|
|
||||||
let s:recache_done = 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" @vimlint(EVL103, 1, a:event)
|
" @vimlint(EVL103, 1, a:event)
|
||||||
function! s:on_install_stdout(id, data, event) abort
|
function! s:on_git_stdout(id, data, event) abort
|
||||||
if a:id == -1
|
let id = a:id
|
||||||
let id = s:jobpid
|
let name = s:pulling_repos[id].name
|
||||||
else
|
|
||||||
let id = a:id
|
|
||||||
endif
|
|
||||||
for str in a:data
|
for str in a:data
|
||||||
let status = matchstr(str,'\d\+%\s(\d\+/\d\+)')
|
let status = matchstr(str,'\d\+%\s(\d\+/\d\+)')
|
||||||
if !empty(status)
|
if !empty(status)
|
||||||
call s:msg_on_install_process(s:pulling_repos[id].name, status)
|
call s:msg_on_install_process(name, status)
|
||||||
|
elseif !empty(str)
|
||||||
|
call s:setline(s:plugin_nrs[name] + 3,
|
||||||
|
\ '* ' . name . ': ' . str)
|
||||||
|
if has_key(s:plugin_status, name)
|
||||||
|
let s:plugin_status[name] += [str]
|
||||||
|
else
|
||||||
|
call extend(s:plugin_status, {name : [str]})
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
" @vimlint(EVL103, 0, a:event)
|
" @vimlint(EVL103, 0, a:event)
|
||||||
|
" }}}
|
||||||
|
|
||||||
function! s:lock_revision(repo) abort
|
" on_install_exit {{{
|
||||||
let cmd = ['git', '--git-dir', a:repo.path . '/.git', 'checkout', a:repo.rev]
|
|
||||||
call s:VIM_CO.system(cmd)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:on_build_exit(id, data, event) abort
|
|
||||||
if a:id == -1
|
|
||||||
let id = s:jobpid
|
|
||||||
else
|
|
||||||
let id = a:id
|
|
||||||
endif
|
|
||||||
if a:data == 0 && a:event ==# 'exit'
|
|
||||||
call s:msg_on_build_done(s:building_repos[id].name)
|
|
||||||
else
|
|
||||||
call s:msg_on_build_failed(s:building_repos[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(id))
|
|
||||||
call s:recache_rtp(a:id)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" 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:id == -1
|
let id = a:id
|
||||||
let id = s:jobpid
|
|
||||||
else
|
|
||||||
let id = a:id
|
|
||||||
endif
|
|
||||||
if a:data == 0 && a:event ==# 'exit'
|
if a:data == 0 && a:event ==# 'exit'
|
||||||
call s:msg_on_install_done(s:pulling_repos[id].name)
|
call s:msg_on_install_done(s:pulling_repos[id].name)
|
||||||
else
|
else
|
||||||
@ -348,203 +357,128 @@ function! s:on_install_exit(id, data, event) abort
|
|||||||
call s:build(s:pulling_repos[id])
|
call s:build(s:pulling_repos[id])
|
||||||
else
|
else
|
||||||
let s:pct_done += 1
|
let s:pct_done += 1
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')')
|
call s:setline(1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')')
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, 2, s:status_bar())
|
call s:setline(2, s:status_bar())
|
||||||
endif
|
endif
|
||||||
call remove(s:pulling_repos, string(id))
|
call remove(s:pulling_repos, string(id))
|
||||||
if !empty(s:plugins)
|
if !empty(s:plugins)
|
||||||
call s:install(dein#get(s:LIST.shift(s:plugins)))
|
call s:install(dein#get(s:LIST.shift(s:plugins)))
|
||||||
endif
|
endif
|
||||||
call s:recache_rtp(a:id)
|
call s:recache_rtp()
|
||||||
endfunction
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
function! s:pull(repo) abort
|
" on_build_exit {{{
|
||||||
let s:pct += 1
|
function! s:on_build_exit(id, data, event) abort
|
||||||
let s:ui_buf[a:repo.name] = s:pct
|
let id = a:id
|
||||||
let argv = ['git', 'pull', '--progress']
|
if a:data == 0 && a:event ==# 'exit'
|
||||||
if s:JOB.vim_job || s:JOB.nvim_job
|
call s:msg_on_build_done(s:building_repos[id].name)
|
||||||
let jobid = s:JOB.start(argv,{
|
|
||||||
\ 'on_stderr' : function('s:on_install_stdout'),
|
|
||||||
\ 'cwd' : a:repo.path,
|
|
||||||
\ 'on_exit' : function('s:on_pull_exit')
|
|
||||||
\ })
|
|
||||||
if jobid != 0
|
|
||||||
let s:pulling_repos[jobid] = a:repo
|
|
||||||
call s:msg_on_start(a:repo.name)
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
let s:jobpid += 1
|
call s:msg_on_build_failed(s:building_repos[id].name)
|
||||||
let s:pulling_repos[s:jobpid] = a:repo
|
|
||||||
call s:msg_on_start(a:repo.name)
|
|
||||||
redraw!
|
|
||||||
call s:JOB.start(argv,{
|
|
||||||
\ 'on_exit' : function('s:on_pull_exit')
|
|
||||||
\ })
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
let s:pct_done += 1
|
||||||
|
call s:setline(1, 'Updating plugins (' . s:pct_done . '/' . s:total . ')')
|
||||||
|
call s:setline(2, s:status_bar())
|
||||||
|
call remove(s:building_repos, string(id))
|
||||||
|
call s:recache_rtp()
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" message func for update UI
|
||||||
|
|
||||||
|
" update plugins {{{
|
||||||
|
function! s:msg_on_update_start(name) abort
|
||||||
|
call s:setline(s:plugin_nrs[a:name] + 3, '+ ' . a:name . ': Updating...')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:install(repo) abort
|
function! s:msg_on_update_done(name) abort
|
||||||
let s:pct += 1
|
call s:setline(s:plugin_nrs[a:name] + 3, '- ' . a:name . ': Updating done.')
|
||||||
let s:ui_buf[a:repo.name] = s:pct
|
|
||||||
let url = 'https://github.com/' . a:repo.repo
|
|
||||||
let argv = ['git', 'clone', '--recursive', '--progress', url, a:repo.path]
|
|
||||||
if s:JOB.vim_job || s:JOB.nvim_job
|
|
||||||
let jobid = s:JOB.start(argv,{
|
|
||||||
\ 'on_stderr' : function('s:on_install_stdout'),
|
|
||||||
\ 'on_exit' : function('s:on_install_exit')
|
|
||||||
\ })
|
|
||||||
if jobid != 0
|
|
||||||
let s:pulling_repos[jobid] = a:repo
|
|
||||||
call s:msg_on_install_start(a:repo.name)
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
let s:jobpid += 1
|
|
||||||
let s:pulling_repos[s:jobpid] = a:repo
|
|
||||||
call s:msg_on_start(a:repo.name)
|
|
||||||
redraw!
|
|
||||||
call s:JOB.start(argv,{
|
|
||||||
\ 'on_stderr' : function('s:on_install_stdout'),
|
|
||||||
\ 'on_exit' : function('s:on_install_exit')
|
|
||||||
\ })
|
|
||||||
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:build(repo) abort
|
|
||||||
let argv = type(a:repo.build) != 4 ? a:repo.build : s:get_build_argv(a:repo.build)
|
|
||||||
if s:JOB.vim_job || s:JOB.nvim_job
|
|
||||||
let jobid = s:JOB.start(argv,{
|
|
||||||
\ 'on_exit' : function('s:on_build_exit'),
|
|
||||||
\ 'cwd' : a:repo.path,
|
|
||||||
\ })
|
|
||||||
if jobid > 0
|
|
||||||
let s:building_repos[jobid . ''] = a:repo
|
|
||||||
call s:msg_on_build_start(a:repo.name)
|
|
||||||
elseif jobid == 0
|
|
||||||
call s:msg_on_build_failed(a:repo.name)
|
|
||||||
elseif jobid == -1
|
|
||||||
if type(argv) == type([])
|
|
||||||
call s:msg_on_build_failed(a:repo.name, argv[0] . ' is not executable')
|
|
||||||
else
|
|
||||||
call s:msg_on_build_failed(a:repo.name)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
let s:building_repos[s:jobpid] = a:repo
|
|
||||||
call s:msg_on_build_start(a:repo.name)
|
|
||||||
redraw!
|
|
||||||
call s:JOB.start(argv,{
|
|
||||||
\ 'on_exit' : function('s:on_build_exit'),
|
|
||||||
\ 'cwd' : a:repo.path,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
endif
|
|
||||||
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 ')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:get_build_argv(build) abort
|
|
||||||
" TODO check os
|
|
||||||
return a:build
|
|
||||||
endfunction
|
|
||||||
" + foo.vim: Updating...
|
|
||||||
if has('nvim')
|
|
||||||
function! s:msg_on_start(name) abort
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '+ ' . a:name . ': Updating...')
|
|
||||||
endfunction
|
|
||||||
function! s:msg_on_install_start(name) abort
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '+ ' . a:name . ': Installing...')
|
|
||||||
endfunction
|
|
||||||
elseif has('python')
|
|
||||||
function! s:msg_on_start(name) abort
|
|
||||||
call s:append_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '+ ' . a:name . ': Updating...')
|
|
||||||
endfunction
|
|
||||||
function! s:msg_on_install_start(name) abort
|
|
||||||
call s:append_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '+ ' . a:name . ': Installing...')
|
|
||||||
endfunction
|
|
||||||
else
|
|
||||||
function! s:msg_on_start(name) abort
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '+ ' . a:name . ': Updating...')
|
|
||||||
endfunction
|
|
||||||
function! s:msg_on_install_start(name) abort
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '+ ' . a:name . ': Installing...')
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
" - foo.vim: Updating done.
|
|
||||||
function! s:msg_on_updated_done(name) abort
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '- ' . a:name . ': Updating done.')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" - foo.vim: Updating failed.
|
|
||||||
function! s:msg_on_updated_failed(name, ...) abort
|
function! s:msg_on_updated_failed(name, ...) abort
|
||||||
if a:0 == 1
|
call s:setline(s:plugin_nrs[a:name] + 3, 'x ' . a:name . ': Updating failed. ' . get(a:000, 0, ''))
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Updating failed, ' . a:1)
|
endfunction
|
||||||
else
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Updating failed.')
|
" }}}
|
||||||
endif
|
|
||||||
|
" install plugins {{{
|
||||||
|
function! s:msg_on_install_start(name) abort
|
||||||
|
call s:setline(s:plugin_nrs[a:name] + 3, '+ ' . a:name . ': Installing...')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:msg_on_install_process(name, status) abort
|
function! s:msg_on_install_process(name, status) abort
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3,
|
call s:setline(s:plugin_nrs[a:name] + 3,
|
||||||
\ '* ' . a:name . ': Installing ' . a:status)
|
\ '* ' . a:name . ': Installing ' . a:status)
|
||||||
endfunction
|
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:setline(s:plugin_nrs[a:name] + 3, '- ' . a:name . ': Installing done.')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" - foo.vim: Updating failed.
|
" - foo.vim: Updating failed.
|
||||||
function! s:msg_on_install_failed(name, ...) abort
|
function! s:msg_on_install_failed(name, ...) abort
|
||||||
if a:0 == 1
|
call s:setline(s:plugin_nrs[a:name] + 3, 'x ' . a:name . ': Installing failed. ' . get(a:000, 0, ''))
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Installing failed. ' . a:1)
|
endfunction
|
||||||
else
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Installing failed.')
|
" }}}
|
||||||
endif
|
|
||||||
|
" build plugins {{{
|
||||||
|
|
||||||
|
function! s:msg_on_build_start(name) abort
|
||||||
|
call s:setline(s:plugin_nrs[a:name] + 3,
|
||||||
|
\ '* ' . a:name . ': Building ')
|
||||||
|
endfunction
|
||||||
|
" - foo.vim: Updating failed.
|
||||||
|
function! s:msg_on_build_failed(name, ...) abort
|
||||||
|
call s:setline(s:plugin_nrs[a:name] + 3, 'x ' . a:name . ': Building failed, ' . get(a:000, 0, ''))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" - foo.vim: Updating done.
|
" - foo.vim: Updating done.
|
||||||
function! s:msg_on_build_done(name) abort
|
function! s:msg_on_build_done(name) abort
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, '- ' . a:name . ': Building done.')
|
call s:setline(s:plugin_nrs[a:name] + 3, '- ' . a:name . ': Building done.')
|
||||||
endfunction
|
|
||||||
|
|
||||||
" - foo.vim: Updating failed.
|
|
||||||
function! s:msg_on_build_failed(name, ...) abort
|
|
||||||
if a:0 == 1
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Building failed, ' . a:1)
|
|
||||||
else
|
|
||||||
call s:set_buf_line(s:plugin_manager_buffer, s:ui_buf[a:name] + 3, 'x ' . a:name . ': Building failed.')
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" new window {{{
|
||||||
function! s:new_window() abort
|
function! s:new_window() abort
|
||||||
if s:plugin_manager_buffer != 0 && bufexists(s:plugin_manager_buffer)
|
if s:buffer_id != 0 && bufexists(s:buffer_id)
|
||||||
" buffer exist, process has not finished!
|
" buffer exist, process has not finished!
|
||||||
return 0
|
return 0
|
||||||
elseif s:plugin_manager_buffer != 0 && !bufexists(s:plugin_manager_buffer)
|
elseif s:buffer_id != 0 && !bufexists(s:buffer_id)
|
||||||
" buffer is hidden, process has not finished!
|
" buffer is hidden, process has not finished!
|
||||||
call s:resume_window()
|
call s:resume_window()
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
execute get(g:, 'spacevim_window', 'vertical topleft new')
|
execute get(g:, 'spacevim_window', 'vertical topleft new')
|
||||||
let s:plugin_manager_buffer = bufnr('%')
|
let s:buffer_id = bufnr('%')
|
||||||
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nomodifiable nospell
|
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nomodifiable nospell
|
||||||
setf SpaceVimPlugManager
|
setf SpaceVimPlugManager
|
||||||
nnoremap <silent> <buffer> q :bd<CR>
|
nnoremap <silent> <buffer> q :bd<CR>
|
||||||
nnoremap <silent> <buffer> gf :call <SID>open_plugin_dir()<cr>
|
nnoremap <silent> <buffer> gf :call <SID>open_plugin_dir()<cr>
|
||||||
|
nnoremap <silent> <buffer> gi :call <SID>view_plugin_status()<cr>
|
||||||
" process has finished or does not start.
|
" process has finished or does not start.
|
||||||
return 2
|
return 2
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" resume window {{{
|
||||||
|
function! s:resume_window() abort
|
||||||
|
execute get(g:, 'spacevim_window', 'vertical topleft new')
|
||||||
|
let s:buffer_id = bufnr('%')
|
||||||
|
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell
|
||||||
|
setf SpaceVimPlugManager
|
||||||
|
nnoremap <silent> <buffer> q :bd<CR>
|
||||||
|
call setline(1, s:buffer_lines)
|
||||||
|
setlocal nomodifiable
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" func: open_plugin_dir {{{
|
||||||
function! s:open_plugin_dir() abort
|
function! s:open_plugin_dir() abort
|
||||||
let line = line('.') - 3
|
let line = line('.') - 3
|
||||||
let plugin = filter(copy(s:ui_buf), 's:ui_buf[v:key] == line')
|
let plugin = filter(copy(s:plugin_nrs), 's:plugin_nrs[v:key] == line')
|
||||||
if !empty(plugin)
|
if !empty(plugin)
|
||||||
exe 'topleft split'
|
exe 'topleft split'
|
||||||
enew
|
enew
|
||||||
@ -557,87 +491,69 @@ function! s:open_plugin_dir() abort
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
function! s:resume_window() abort
|
function! s:view_plugin_status() abort
|
||||||
execute get(g:, 'spacevim_window', 'vertical topleft new')
|
let line = line('.') - 3
|
||||||
let s:plugin_manager_buffer = bufnr('%')
|
let plugin = filter(copy(s:plugin_nrs), 's:plugin_nrs[v:key] == line')
|
||||||
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell
|
if !empty(plugin) && has_key(s:plugin_status, keys(plugin)[0])
|
||||||
setf SpaceVimPlugManager
|
topleft split __plugin_info__
|
||||||
nnoremap <silent> <buffer> q :bd<CR>
|
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap nocursorline nospell nonu norelativenumber
|
||||||
call setline(1, s:plugin_manager_buffer_lines)
|
exe 'resize ' . &lines * 30 / 100
|
||||||
setlocal nomodifiable
|
call setline(1, s:plugin_status[keys(plugin)[0]])
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" change modifiable before setline
|
" func setline, first line number is 1 {{{
|
||||||
if has('nvim') && exists('*nvim_buf_set_lines')
|
function! s:setline(nr, line) abort
|
||||||
function! s:set_buf_line(bufnr, nr, line) abort
|
if bufexists(s:buffer_id)
|
||||||
call setbufvar(s:plugin_manager_buffer,'&ma', 1)
|
call s:BUFFER.buf_set_lines(s:buffer_id, a:nr -1 , a:nr , 0, [a:line])
|
||||||
if bufexists(s:plugin_manager_buffer)
|
endif
|
||||||
call nvim_buf_set_lines(a:bufnr, a:nr - 1, a:nr, 0, [a:line])
|
if len(s:buffer_lines) >= a:nr
|
||||||
endif
|
let s:buffer_lines[a:nr - 1] = a:line
|
||||||
if len(s:plugin_manager_buffer_lines) >= a:nr
|
else
|
||||||
let s:plugin_manager_buffer_lines[a:nr - 1] = a:line
|
call add(s:buffer_lines, a:line)
|
||||||
else
|
endif
|
||||||
call add(s:plugin_manager_buffer_lines, a:line)
|
endfunction
|
||||||
endif
|
" }}}
|
||||||
call setbufvar(s:plugin_manager_buffer,'&ma', 0)
|
|
||||||
endfunction
|
|
||||||
elseif has('python')
|
|
||||||
py import vim
|
|
||||||
py import string
|
|
||||||
" @vimlint(EVL103, 1, a:bufnr)
|
|
||||||
" @vimlint(EVL103, 1, a:nr)
|
|
||||||
" @vimlint(EVL103, 1, a:line)
|
|
||||||
function! s:set_buf_line(bufnr, nr, line) abort
|
|
||||||
call setbufvar(s:plugin_manager_buffer,'&ma', 1)
|
|
||||||
if bufexists(s:plugin_manager_buffer)
|
|
||||||
py bufnr = string.atoi(vim.eval("a:bufnr"))
|
|
||||||
py linr = string.atoi(vim.eval("a:nr")) - 1
|
|
||||||
py str = vim.eval("a:line")
|
|
||||||
py vim.buffers[bufnr][linr] = str
|
|
||||||
endif
|
|
||||||
if len(s:plugin_manager_buffer_lines) >= a:nr
|
|
||||||
let s:plugin_manager_buffer_lines[a:nr - 1] = a:line
|
|
||||||
else
|
|
||||||
call add(s:plugin_manager_buffer_lines, a:line)
|
|
||||||
endif
|
|
||||||
call setbufvar(s:plugin_manager_buffer,'&ma', 0)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:append_buf_line(bufnr, nr, line) abort
|
" func: status_bar {{{
|
||||||
call setbufvar(s:plugin_manager_buffer,'&ma', 1)
|
function! s:status_bar() abort
|
||||||
if bufexists(s:plugin_manager_buffer)
|
let bar = '['
|
||||||
py bufnr = string.atoi(vim.eval("a:bufnr"))
|
let ct = 50 * s:pct / s:total
|
||||||
py linr = string.atoi(vim.eval("a:nr")) - 1
|
let bar .= repeat('=', ct)
|
||||||
py str = vim.eval("a:line")
|
let bar .= repeat(' ', 50 - ct)
|
||||||
py vim.buffers[bufnr].append(str)
|
let bar .= ']'
|
||||||
|
return bar
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" func: recache_rtp {{{
|
||||||
|
function! s:recache_rtp() abort
|
||||||
|
if empty(s:pulling_repos) && empty(s:building_repos) && !exists('s:recache_done')
|
||||||
|
call s:setline(1, 'Updated. Elapsed time: '
|
||||||
|
\ . split(reltimestr(reltime(s:start_time)))[0] . ' sec.')
|
||||||
|
let s:buffer_id = 0
|
||||||
|
if g:spacevim_plugin_manager ==# 'dein'
|
||||||
|
call dein#recache_runtimepath()
|
||||||
endif
|
endif
|
||||||
call add(s:plugin_manager_buffer_lines, a:line)
|
let s:recache_done = 1
|
||||||
call setbufvar(s:plugin_manager_buffer,'&ma', 0)
|
endif
|
||||||
endfunction
|
|
||||||
" @vimlint(EVL103, 0, a:bufnr)
|
endfunction
|
||||||
" @vimlint(EVL103, 0, a:nr)
|
" }}}
|
||||||
" @vimlint(EVL103, 0, a:line)
|
|
||||||
else
|
" func lock_revision {{{
|
||||||
function! s:focus_main_win() abort
|
function! s:lock_revision(repo) abort
|
||||||
let winnr = bufwinnr(s:plugin_manager_buffer)
|
let cmd = ['git', '--git-dir', a:repo.path . '/.git', 'checkout', a:repo.rev]
|
||||||
if winnr > -1
|
call s:VIM_CO.system(cmd)
|
||||||
exe winnr . 'wincmd w'
|
endfunction
|
||||||
endif
|
" }}}
|
||||||
return winnr
|
|
||||||
endfunction
|
" func: get_build_argv {{{
|
||||||
function! s:set_buf_line(bufnr, nr, line) abort
|
function! s:get_build_argv(build) abort
|
||||||
call setbufvar(a:bufnr,'&ma', 1)
|
" TODO check os
|
||||||
if bufexists(s:plugin_manager_buffer)
|
return a:build
|
||||||
if s:focus_main_win() >= 0
|
endfunction
|
||||||
call setline(a:nr, a:line)
|
" }}}
|
||||||
endif
|
|
||||||
endif
|
|
||||||
if len(s:plugin_manager_buffer_lines) >= a:nr
|
|
||||||
let s:plugin_manager_buffer_lines[a:nr - 1] = a:line
|
|
||||||
else
|
|
||||||
call add(s:plugin_manager_buffer_lines, a:line)
|
|
||||||
endif
|
|
||||||
call setbufvar(a:bufnr,'&ma', 0)
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user