1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 23:10:06 +08:00

fix lint and issue 232

This commit is contained in:
wsdjeg 2017-02-14 22:41:44 +08:00
parent 3ef3437074
commit 084ee3fcc8

View File

@ -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',
@ -43,20 +43,20 @@ function! s:install_manager()
else
if executable('git')
exec '!git clone https://github.com/Shougo/dein.vim '
\ . g:spacevim_plugin_bundle_dir
\ . fnameescape(g:spacevim_plugin_bundle_dir)
\ . join(['repos', 'github.com',
\ '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')