diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 4c146da73..9077cfc1b 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -482,9 +482,14 @@ let g:spacevim_simple_mode = 0 " The default file manager of SpaceVim. Default is 'vimfiler'. let g:spacevim_filemanager = 'vimfiler' "" -" The default plugin manager of SpaceVim. Default is 'dein'. +" The default plugin manager of SpaceVim. +" if has patch 7.4.2071, the default value is dein. Otherwise it is neobundle. " Options are dein, neobundle, or vim-plug. -let g:spacevim_plugin_manager = 'dein' +if has('patch-7.4.2071') + let g:spacevim_plugin_manager = 'dein' +else + let g:spacevim_plugin_manager = 'neobundle' +endif "" " @section plugin_manager_processes, options-plugin_manager_processes diff --git a/autoload/SpaceVim/commands.vim b/autoload/SpaceVim/commands.vim index e50a45dac..a492ba254 100644 --- a/autoload/SpaceVim/commands.vim +++ b/autoload/SpaceVim/commands.vim @@ -63,7 +63,11 @@ endfunction " @vimlint(EVL103, 1, a:CmdLine) " @vimlint(EVL103, 1, a:CursorPos) function! SpaceVim#commands#complete_plugin(ArgLead, CmdLine, CursorPos) abort - return join(keys(dein#get()) + ['SpaceVim'], "\n") + if g:spacevim_plugin_manager ==# 'dein' + return join(keys(dein#get()) + ['SpaceVim'], "\n") + elseif g:spacevim_plugin_manager ==# 'neobundle' + return join(map(neobundle#config#get_neobundles(), 'v:val.name'), "\n") + endif endfunction " @vimlint(EVL103, 0, a:ArgLead) " @vimlint(EVL103, 0, a:CmdLine) @@ -98,6 +102,11 @@ endfunction function! SpaceVim#commands#update_plugin(...) abort if g:spacevim_plugin_manager ==# 'neobundle' + if a:0 == 0 + call SpaceVim#plugins#manager#update() + else + call SpaceVim#plugins#manager#update(a:000) + endif elseif g:spacevim_plugin_manager ==# 'dein' if a:0 == 0 call SpaceVim#plugins#manager#update() @@ -118,11 +127,16 @@ endfunction function! SpaceVim#commands#install_plugin(...) abort if g:spacevim_plugin_manager ==# 'neobundle' + if a:0 == 0 + call SpaceVim#plugins#manager#install() + else + call SpaceVim#plugins#manager#install(a:000) + endif elseif g:spacevim_plugin_manager ==# 'dein' if a:0 == 0 call SpaceVim#plugins#manager#install() else - call dein#install(a:000) + call SpaceVim#plugins#manager#install(a:000) endif elseif g:spacevim_plugin_manager ==# 'vim-plug' endif diff --git a/autoload/SpaceVim/plugins/manager.vim b/autoload/SpaceVim/plugins/manager.vim index fc2ef8776..80fdd6e3d 100644 --- a/autoload/SpaceVim/plugins/manager.vim +++ b/autoload/SpaceVim/plugins/manager.vim @@ -106,14 +106,25 @@ function! s:need_cmd(cmd) abort endif endfunction -function! s:get_uninstalled_plugins() abort - return filter(values(dein#get()), '!isdirectory(v:val.path)') -endfunction +if g:spacevim_plugin_manager ==# 'neobundle' + function! s:get_uninstalled_plugins() abort + return filter(neobundle#config#get_neobundles(), '!isdirectory(v:val.path)') + endfunction +elseif g:spacevim_plugin_manager ==# 'dein' + function! s:get_uninstalled_plugins() abort + return filter(values(dein#get()), '!isdirectory(v:val.path)') + endfunction +endif - -function! SpaceVim#plugins#manager#reinstall(...) abort - call dein#reinstall(a:1) -endfunction +if g:spacevim_plugin_manager ==# 'neobundle' + function! SpaceVim#plugins#manager#reinstall(...) abort + call neobundle#commands#reinstall(a:1) + endfunction +elseif g:spacevim_plugin_manager ==# 'dein' + function! SpaceVim#plugins#manager#reinstall(...) abort + call dein#reinstall(a:1) + endfunction +endif " @vimlint(EVL102, 1, l:i) @@ -152,7 +163,11 @@ function! SpaceVim#plugins#manager#install(...) abort let s:start_time = reltime() for i in range(g:spacevim_plugin_manager_processes) if !empty(s:plugins) - let repo = dein#get(s:LIST.shift(s:plugins)) + if g:spacevim_plugin_manager ==# 'dein' + let repo = dein#get(s:LIST.shift(s:plugins)) + elseif g:spacevim_plugin_manager ==# 'neobundle' + let repo = neobundle#get(s:LIST.shift(s:plugins)) + endif if !empty(repo) call s:install(repo) endif @@ -184,7 +199,12 @@ function! SpaceVim#plugins#manager#update(...) abort if exists('s:recache_done') unlet s:recache_done endif - let s:plugins = a:0 == 0 ? sort(keys(dein#get())) : sort(copy(a:1)) + if g:spacevim_plugin_manager ==# 'dein' + let s:plugins = a:0 == 0 ? sort(keys(dein#get())) : sort(copy(a:1)) + elseif g:spacevim_plugin_manager ==# 'neobundle' + let s:plugins = a:0 == 0 ? sort(map(neobundle#config#get_neobundles(), 'v:val.name')) : sort(copy(a:1)) + elseif g:spacevim_plugin_manager ==# 'vim-plug' + endif if a:0 == 0 call add(s:plugins, 'SpaceVim') endif @@ -203,8 +223,13 @@ function! SpaceVim#plugins#manager#update(...) abort let s:start_time = reltime() for i in range(g:spacevim_plugin_manager_processes) if !empty(s:plugins) - let reponame = s:LIST.shift(s:plugins) - let repo = dein#get(reponame) + if g:spacevim_plugin_manager ==# 'dein' + let reponame = s:LIST.shift(s:plugins) + let repo = dein#get(reponame) + elseif g:spacevim_plugin_manager ==# 'neobundle' + let reponame = s:LIST.shift(s:plugins) + let repo = neobundle#get(reponame) + endif if !empty(repo) call s:pull(repo) elseif reponame ==# 'SpaceVim' @@ -388,7 +413,7 @@ endfunction 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 url = 'https://github.com/' . (has_key(a:repo, 'repo') ? a:repo.repo : a:repo.orig_path) 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,{ @@ -550,12 +575,18 @@ function! s:open_plugin_dir() abort enew exe 'resize ' . &lines * 30 / 100 let shell = empty($SHELL) ? SpaceVim#api#import('system').isWindows ? 'cmd.exe' : 'bash' : $SHELL + if g:spacevim_plugin_manager ==# 'dein' + let path = dein#get(keys(plugin)[0]).path + elseif g:spacevim_plugin_manager ==# 'neobundle' + let path = neobundle#get(keys(plugin)[0]).path + elseif g:spacevim_plugin_manager ==# 'vim-plug' + endif if has('nvim') && exists('*termopen') - call termopen(shell, {'cwd' : dein#get(keys(plugin)[0]).path}) + call termopen(shell, {'cwd' : path}) elseif exists('*term_start') - call term_start(shell, {'curwin' : 1, 'term_finish' : 'close', 'cwd' : dein#get(keys(plugin)[0]).path}) + call term_start(shell, {'curwin' : 1, 'term_finish' : 'close', 'cwd' : path}) else - exe 'VimShell ' . dein#get(keys(plugin)[0]).path + exe 'VimShell ' . path endif endif endfunction diff --git a/autoload/zvim/plug.vim b/autoload/zvim/plug.vim index 282a5dbd3..eb89e9c3d 100644 --- a/autoload/zvim/plug.vim +++ b/autoload/zvim/plug.vim @@ -103,7 +103,13 @@ function! zvim#plug#end() abort if g:spacevim_plugin_manager ==# 'neobundle' call neobundle#end() if g:spacevim_checkinstall == 1 - NeoBundleCheck + silent! let g:_spacevim_checking_flag = neobundle#exists_not_installed_bundles() + if g:_spacevim_checking_flag + augroup SpaceVimCheckInstall + au! + au VimEnter * SPInstall + augroup END + endif endif elseif g:spacevim_plugin_manager ==# 'dein' call dein#end() diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 3b5388bbb..44fbbeaac 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -540,10 +540,6 @@ plugins will be installed. *g:spacevim_filemanager* The default file manager of SpaceVim. Default is 'vimfiler'. - *g:spacevim_plugin_manager* -The default plugin manager of SpaceVim. Default is 'dein'. Options are dein, -neobundle, or vim-plug. - *g:spacevim_plugin_manager_processes* Set the max process of SpaceVim plugin manager diff --git a/init.vim b/init.vim index 66a1a99d5..2febcbc48 100644 --- a/init.vim +++ b/init.vim @@ -6,4 +6,6 @@ " License: GPLv3 "============================================================================= +" call neobundle#get() + execute 'source' fnamemodify(expand(''), ':h').'/config/main.vim'