mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 23:10:06 +08:00
Merge branch 'fix_issue_232' into dev
This commit is contained in:
commit
45a8f52809
@ -66,7 +66,7 @@ let g:spacevim_vim_plug_installed = 0
|
||||
" >
|
||||
" let g:spacevim_plugin_bundle_dir = '~/.cache/vimplugs'
|
||||
" <
|
||||
let g:spacevim_plugin_bundle_dir = $HOME. join(['', '.cache', 'vimfiles', ''], '/')
|
||||
let g:spacevim_plugin_bundle_dir = $HOME. join(['', '.cache', 'vimfiles', ''], SpaceVim#api#import('file').separator)
|
||||
""
|
||||
" Disable/Enable realtime leader guide, by default it is 0.
|
||||
" to enable this feature:
|
||||
|
8
autoload/SpaceVim/api.vim
Normal file
8
autoload/SpaceVim/api.vim
Normal file
@ -0,0 +1,8 @@
|
||||
function! SpaceVim#api#import(name) abort
|
||||
let p = {}
|
||||
try
|
||||
let p = SpaceVim#api#{a:name}#get()
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
endtry
|
||||
return p
|
||||
endfunction
|
15
autoload/SpaceVim/api/file.vim
Normal file
15
autoload/SpaceVim/api/file.vim
Normal file
@ -0,0 +1,15 @@
|
||||
let s:file = {}
|
||||
let s:system = SpaceVim#api#import('system')
|
||||
|
||||
if s:system.isWindows
|
||||
let s:file['separator'] = '\'
|
||||
else
|
||||
let s:file['separator'] = '/'
|
||||
endif
|
||||
|
||||
function! SpaceVim#api#file#get() abort
|
||||
return deepcopy(s:file)
|
||||
endfunction
|
||||
|
||||
|
||||
|
12
autoload/SpaceVim/api/system.vim
Normal file
12
autoload/SpaceVim/api/system.vim
Normal file
@ -0,0 +1,12 @@
|
||||
let s:system = {}
|
||||
|
||||
let s:system['isWindows'] = has('win16') || has('win32') || has('win64')
|
||||
|
||||
let s:system['isLinux'] = has('unix') && !has('macunix') && !has('win32unix')
|
||||
|
||||
let s:system['isOSX'] = has('macunix')
|
||||
|
||||
|
||||
function! SpaceVim#api#system#get() abort
|
||||
return deepcopy(s:system)
|
||||
endfunction
|
@ -1,6 +1,6 @@
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
function! s:install_manager()
|
||||
function! s:install_manager() abort
|
||||
" Fsep && Psep
|
||||
if has('win16') || has('win32') || has('win64')
|
||||
let s:Psep = ';'
|
||||
@ -21,19 +21,19 @@ function! s:install_manager()
|
||||
\ .'https://github.com/'
|
||||
\ .'Shougo/neobundle.vim'
|
||||
\ . ' '
|
||||
\ . g:spacevim_plugin_bundle_dir
|
||||
\ . fnameescape(g:spacevim_plugin_bundle_dir)
|
||||
\ . 'neobundle.vim'
|
||||
let g:spacevim_neobundle_installed = 1
|
||||
else
|
||||
echohl WarningMsg
|
||||
echom "You need install git!"
|
||||
echom 'You need install git!'
|
||||
echohl None
|
||||
endif
|
||||
endif
|
||||
exec 'set runtimepath+='
|
||||
\ . g:spacevim_plugin_bundle_dir
|
||||
\ . fnameescape(g:spacevim_plugin_bundle_dir)
|
||||
\ . 'neobundle.vim'
|
||||
elseif g:spacevim_plugin_manager == 'dein'
|
||||
elseif g:spacevim_plugin_manager ==# 'dein'
|
||||
"auto install dein
|
||||
if filereadable(expand(g:spacevim_plugin_bundle_dir)
|
||||
\ . join(['repos', 'github.com',
|
||||
@ -42,21 +42,21 @@ function! s:install_manager()
|
||||
let g:spacevim_dein_installed = 1
|
||||
else
|
||||
if executable('git')
|
||||
exec '!git clone https://github.com/Shougo/dein.vim '
|
||||
exec '!git clone https://github.com/Shougo/dein.vim "'
|
||||
\ . g:spacevim_plugin_bundle_dir
|
||||
\ . join(['repos', 'github.com',
|
||||
\ 'Shougo', 'dein.vim'], s:Fsep)
|
||||
\ 'Shougo', 'dein.vim"'], s:Fsep)
|
||||
let g:spacevim_dein_installed = 1
|
||||
else
|
||||
echohl WarningMsg
|
||||
echom "You need install git!"
|
||||
echom 'You need install git!'
|
||||
echohl None
|
||||
endif
|
||||
endif
|
||||
exec 'set runtimepath+='.g:spacevim_plugin_bundle_dir
|
||||
exec 'set runtimepath+='. fnameescape(g:spacevim_plugin_bundle_dir)
|
||||
\ . join(['repos', 'github.com', 'Shougo',
|
||||
\ 'dein.vim'], s:Fsep)
|
||||
elseif g:spacevim_plugin_manager == 'vim-plug'
|
||||
elseif g:spacevim_plugin_manager ==# 'vim-plug'
|
||||
"auto install vim-plug
|
||||
if filereadable(expand('~/.cache/vim-plug/autoload/plug.vim'))
|
||||
let g:spacevim_vim_plug_installed = 1
|
||||
@ -70,7 +70,7 @@ function! s:install_manager()
|
||||
let g:spacevim_vim_plug_installed = 1
|
||||
else
|
||||
echohl WarningMsg
|
||||
echom "You need install curl!"
|
||||
echom 'You need install curl!'
|
||||
echohl None
|
||||
endif
|
||||
endif
|
||||
@ -90,22 +90,22 @@ function! zvim#plug#begin(path) abort
|
||||
let g:unite_source_menu_menus.AddedPlugins.command_candidates = []
|
||||
nnoremap <silent><Leader>lp :Unite -silent
|
||||
\ -winheight=17 -start-insert menu:AddedPlugins<CR>
|
||||
if g:spacevim_plugin_manager == 'neobundle'
|
||||
if g:spacevim_plugin_manager ==# 'neobundle'
|
||||
call neobundle#begin(a:path)
|
||||
elseif g:spacevim_plugin_manager == 'dein'
|
||||
elseif g:spacevim_plugin_manager ==# 'dein'
|
||||
call dein#begin(a:path)
|
||||
elseif g:spacevim_plugin_manager == 'vim-plug'
|
||||
elseif g:spacevim_plugin_manager ==# 'vim-plug'
|
||||
call plug#begin(a:path)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zvim#plug#end() abort
|
||||
if g:spacevim_plugin_manager == 'neobundle'
|
||||
if g:spacevim_plugin_manager ==# 'neobundle'
|
||||
call neobundle#end()
|
||||
if g:spacevim_checkinstall == 1
|
||||
NeoBundleCheck
|
||||
endif
|
||||
elseif g:spacevim_plugin_manager == 'dein'
|
||||
elseif g:spacevim_plugin_manager ==# 'dein'
|
||||
call dein#end()
|
||||
if g:spacevim_checkinstall == 1
|
||||
silent! let flag = dein#check_install()
|
||||
@ -117,18 +117,18 @@ function! zvim#plug#end() abort
|
||||
endif
|
||||
endif
|
||||
call dein#call_hook('source')
|
||||
elseif g:spacevim_plugin_manager == 'vim-plug'
|
||||
elseif g:spacevim_plugin_manager ==# 'vim-plug'
|
||||
call plug#end()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! zvim#plug#defind_hooks(bundle) abort
|
||||
if g:spacevim_plugin_manager == 'neobundle'
|
||||
if g:spacevim_plugin_manager ==# 'neobundle'
|
||||
let s:hooks = neobundle#get_hooks(a:bundle)
|
||||
func! s:hooks.on_source(bundle) abort
|
||||
call zvim#util#source_rc('plugins/' . split(a:bundle['name'],'\.')[0] . '.vim')
|
||||
endf
|
||||
elseif g:spacevim_plugin_manager == 'dein'
|
||||
elseif g:spacevim_plugin_manager ==# 'dein'
|
||||
call dein#config(g:dein#name, {
|
||||
\ 'hook_source' : "call zvim#util#source_rc('plugins/" . split(g:dein#name,'\.')[0] . ".vim')"
|
||||
\ })
|
||||
@ -136,32 +136,32 @@ function! zvim#plug#defind_hooks(bundle) abort
|
||||
endfunction
|
||||
|
||||
function! zvim#plug#fetch() abort
|
||||
if g:spacevim_plugin_manager == 'neobundle'
|
||||
if g:spacevim_plugin_manager ==# 'neobundle'
|
||||
NeoBundleFetch 'Shougo/neobundle.vim'
|
||||
elseif g:spacevim_plugin_manager == 'dein'
|
||||
elseif g:spacevim_plugin_manager ==# 'dein'
|
||||
call dein#add('Shougo/dein.vim')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
let s:plugins = []
|
||||
|
||||
fu! s:parser(args)
|
||||
fu! s:parser(args) abort
|
||||
return a:args
|
||||
endf
|
||||
|
||||
function! zvim#plug#add(repo,...) abort
|
||||
let g:spacevim_plugin_name = ''
|
||||
if g:spacevim_plugin_manager == 'neobundle'
|
||||
if g:spacevim_plugin_manager ==# 'neobundle'
|
||||
exec 'NeoBundle "'.a:repo.'"'.','.join(a:000,',')
|
||||
let g:spacevim_plugin_name = split(a:repo, '/')[-1]
|
||||
elseif g:spacevim_plugin_manager == 'dein'
|
||||
elseif g:spacevim_plugin_manager ==# 'dein'
|
||||
if len(a:000) > 0
|
||||
call dein#add(a:repo,s:parser(a:000[0]))
|
||||
else
|
||||
call dein#add(a:repo)
|
||||
endif
|
||||
let g:spacevim_plugin_name = g:dein#name
|
||||
elseif g:spacevim_plugin_manager == 'vim-plug'
|
||||
elseif g:spacevim_plugin_manager ==# 'vim-plug'
|
||||
if len(a:000) > 0
|
||||
exec "Plug '".a:repo."', ".join(a:000,',')
|
||||
else
|
||||
@ -185,9 +185,9 @@ function! zvim#plug#add(repo,...) abort
|
||||
endfunction
|
||||
|
||||
function! zvim#plug#tap(plugin) abort
|
||||
if g:spacevim_plugin_manager == 'neobundle'
|
||||
if g:spacevim_plugin_manager ==# 'neobundle'
|
||||
return neobundle#tap(a:plugin)
|
||||
elseif g:spacevim_plugin_manager == 'dein'
|
||||
elseif g:spacevim_plugin_manager ==# 'dein'
|
||||
return dein#tap(a:plugin)
|
||||
endif
|
||||
endfunction
|
||||
@ -199,7 +199,7 @@ function! zvim#plug#enable_plug() abort
|
||||
endfunction
|
||||
|
||||
function! zvim#plug#loadPluginBefore(plugin) abort
|
||||
if matchend(a:plugin, ".vim") == len(a:plugin)
|
||||
if matchend(a:plugin, '.vim') == len(a:plugin)
|
||||
call zvim#util#source_rc('plugins_before/' . a:plugin)
|
||||
else
|
||||
call zvim#util#source_rc('plugins_before/' . a:plugin . '.vim')
|
||||
|
Loading…
Reference in New Issue
Block a user