From c1acb0a4b1b3460ad6efcbfd8b0a18f0971e3822 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 7 Jul 2024 10:10:12 +0800 Subject: [PATCH] perf(lazy): lazy load plugins --- autoload/SpaceVim/layers/core.vim | 1 + autoload/SpaceVim/layers/edit.vim | 2 +- autoload/SpaceVim/layers/ui.vim | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 392f52a73..9864c4cd7 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -227,6 +227,7 @@ function! SpaceVim#layers#core#plugins() abort call add(plugins, [g:_spacevim_root_dir . 'bundle/nerdcommenter', { 'loadconf' : 1, 'merged' : 0, 'on_map' : ['NERDCommenter', 'Commenter']}]) if exists('*matchaddpos') + let g:loaded_matchit = 1 call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-matchup', {'merged' : 0, 'on_event' : 'BufReadPost'}]) endif call add(plugins, [g:_spacevim_root_dir . 'bundle/gruvbox', {'loadconf' : 1, 'merged' : 0}]) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index f3bda41d6..7d538037e 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -100,7 +100,7 @@ endfunction function! SpaceVim#layers#edit#plugins() abort let plugins = [ \ [g:_spacevim_root_dir . 'bundle/vim-repeat'], - \ [g:_spacevim_root_dir . 'bundle/vim-emoji'], + \ [g:_spacevim_root_dir . 'bundle/vim-emoji', {'on_event' : 'BufReadPost'}], \ [g:_spacevim_root_dir . 'bundle/vim-grammarous', {'merged' : 0, 'on_cmd' : ['GrammarousCheck', 'GrammarousReset']}], \ [g:_spacevim_root_dir . 'bundle/vim-expand-region', { 'loadconf' : 1}], \ [g:_spacevim_root_dir . 'bundle/vim-textobj-user'], diff --git a/autoload/SpaceVim/layers/ui.vim b/autoload/SpaceVim/layers/ui.vim index dcc844646..a1fda03f1 100644 --- a/autoload/SpaceVim/layers/ui.vim +++ b/autoload/SpaceVim/layers/ui.vim @@ -79,9 +79,9 @@ let s:NVIM_VERSION = SpaceVim#api#import('neovim#version') function! SpaceVim#layers#ui#plugins() abort let plugins = [ - \ [g:_spacevim_root_dir . 'bundle/vim-cursorword', {'merged' : 0}], + \ [g:_spacevim_root_dir . 'bundle/vim-cursorword', {'merged' : 0, 'on_event' : ['CursorMoved', 'CursorMovedI']}], \ [g:_spacevim_root_dir . 'bundle/tagbar', - \ {'loadconf' : 1, 'merged' : 0}], + \ {'loadconf' : 1, 'merged' : 0, 'on_cmd' : ['TagbarToggle', 'Tagbar']}], \ [g:_spacevim_root_dir . 'bundle/tagbar-makefile.vim', \ {'merged': 0}], \ [g:_spacevim_root_dir . 'bundle/tagbar-proto.vim', {'merged': 0}], @@ -101,7 +101,7 @@ function! SpaceVim#layers#ui#plugins() abort if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version()) \ || has('nvim-0.6.0') call add(plugins, [g:_spacevim_root_dir . 'bundle/indent-blankline.nvim', - \ { 'merged' : 0}]) + \ { 'merged' : 0, 'on_event' : ['BufReadPost']}]) else call add(plugins, [g:_spacevim_root_dir . 'bundle/indentLine', \ { 'merged' : 0}])