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

perf(start): lazy load plugins

This commit is contained in:
Eric Wong 2024-06-25 12:02:50 +08:00
parent d40346455c
commit 408cc9fbef
7 changed files with 11 additions and 11 deletions

View File

@ -93,7 +93,7 @@ function! s:git_branch() abort
endif
catch
endtry
elseif exists('g:loaded_git')
else
let prefix = g:spacevim_statusline_unicode ? '' : ''
return printf('%%{git#branch#current("%s")}', prefix)
endif

View File

@ -196,7 +196,7 @@ function! SpaceVim#layers#core#plugins() abort
\ }])
call add(plugins, [g:_spacevim_root_dir . 'bundle/vimproc.vim', {'build' : [(executable('gmake') ? 'gmake' : 'make')]}])
elseif g:spacevim_filemanager ==# 'defx'
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx.nvim',{'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx.nvim',{'merged' : 0, 'loadconf' : 1 , 'loadconf_before' : 1, 'on_cmd' : 'Defx'}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx-git',{'merged' : 0, 'loadconf' : 1}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx-icons',{'merged' : 0}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/defx-sftp',{'merged' : 0}])

View File

@ -115,12 +115,12 @@ function! SpaceVim#layers#edit#plugins() abort
\ ['andrewradev/splitjoin.vim',{ 'on_cmd':['SplitjoinJoin', 'SplitjoinSplit'],'merged' : 0, 'loadconf' : 1}],
\ ]
if has('nvim-0.8.0')
call add(plugins,[g:_spacevim_root_dir . 'bundle/nvim-surround', { 'merged' : 0, 'loadconf' : 1}])
call add(plugins,[g:_spacevim_root_dir . 'bundle/nvim-surround', { 'merged' : 0, 'loadconf' : 1, 'on_event' : ['BufReadPost']}])
else
call add(plugins,[g:_spacevim_root_dir . 'bundle/vim-surround', { 'merged' : 0, 'loadconf' : 1}])
endif
if has('nvim-0.6.0') && s:enable_hop
call add(plugins,[g:_spacevim_root_dir . 'bundle/hop.nvim', { 'merged' : 0, 'loadconf' : 1}])
call add(plugins,[g:_spacevim_root_dir . 'bundle/hop.nvim', { 'merged' : 0, 'loadconf' : 1, 'on_cmd' : ['HopChar1', 'HopChar2', 'HopWord', 'HopLine']}])
else
call add(plugins,[g:_spacevim_root_dir . 'bundle/vim-easymotion', { 'merged' : 0}])
call add(plugins,[g:_spacevim_root_dir . 'bundle/vim-easyoperator-line', { 'merged' : 0}])

View File

@ -65,7 +65,7 @@ let s:git_plugin = 'git'
function! SpaceVim#layers#git#plugins() abort
let plugins = [
\ ]
call add(plugins, ['airblade/vim-gitgutter', { 'merged' : 0}])
call add(plugins, ['airblade/vim-gitgutter', { 'merged' : 0, 'on_event' : ['BufReadPost']}])
if s:git_plugin ==# 'gina'
call add(plugins, [g:_spacevim_root_dir . 'bundle/gina.vim', { 'merged' : 0}])
elseif s:git_plugin ==# 'fugitive'
@ -74,7 +74,7 @@ function! SpaceVim#layers#git#plugins() abort
elseif s:git_plugin ==# 'gita'
call add(plugins, ['lambdalisue/vim-gita', { 'on_cmd' : 'Gita'}])
else
call add(plugins, [g:_spacevim_root_dir . 'bundle/git.vim', { 'merged' : 0}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/git.vim', { 'merged' : 0, 'on_event' : 'Git', 'on_func' : 'git#branch#current'}])
endif
return plugins
endfunction

View File

@ -126,11 +126,11 @@ function! SpaceVim#layers#lang#python#plugins() abort
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-pythonsense',
\ { 'on_ft' : 'python'}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/coveragepy.vim',
\ { 'merged' : 0}])
\ { 'merged' : 0, 'on_ft' : 'python'}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/python-imports.vim',
\ { 'merged' : 0}])
\ { 'merged' : 0, 'on_ft' : 'python'}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-virtualenv',
\ { 'merged' : 0}])
\ { 'merged' : 0, 'on_ft' : 'python'}])
return plugins
endfunction

View File

@ -101,7 +101,7 @@ endif
function! SpaceVim#layers#lang#ruby#plugins() abort
return [
\ [g:_spacevim_root_dir . 'bundle/vim-ruby', {'merged' : 0}]
\ [g:_spacevim_root_dir . 'bundle/vim-ruby', {'merged' : 0, 'on_ft' : ['ruby']}]
\ ]
endfunction

View File

@ -69,7 +69,7 @@ endfunction
function! SpaceVim#layers#lsp#plugins() abort
let plugins = []
if has('nvim-0.9.1')
call add(plugins, [g:_spacevim_root_dir . 'bundle/nvim-lspconfig-latest', {'merged' : 0, 'loadconf' : 1}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/nvim-lspconfig-latest', {'merged' : 0, 'loadconf' : 1, 'on_event' : ['BufReadPost']}])
if g:spacevim_autocomplete_method ==# 'deoplete'
call add(plugins, [g:_spacevim_root_dir . 'bundle/deoplete-lsp', {'merged' : 0}])
elseif g:spacevim_autocomplete_method ==# 'nvim-cmp'