From 0e21be8abc47b5a44172a306626127caa587611e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 21 Mar 2019 00:06:40 +0100 Subject: [PATCH] add lazy loading to many plugins --- .config/nvim/init.vim | 47 ++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 194edf8..e07346b 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -42,7 +42,7 @@ Plug 'christoomey/vim-tmux-navigator' " into / out of focus (requires number & relativenumber to be set) Plug 'jeffkreeftmeijer/vim-numbertoggle' -" Workflow +" " Workflow Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragraphs etc with gc Plug 'tommcdo/vim-exchange' " adds exchange operator with cx. common use: cxiw . on 2 words to switch Plug 'tpope/vim-surround' " lets you change surrounding things with cs (or ds to del, ys to add) @@ -51,32 +51,44 @@ Plug 'kana/vim-textobj-user' " dependency for most other textobj plugins Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection " and allows you to jump to the *end* of this or last sentence. -Plug 'jiangmiao/auto-pairs' " Auto close brackets and '' -" Ecosystem -" Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time +" " Ecosystem +" " Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } " show a directory listing within vim -Plug 'Xuyuanp/nerdtree-git-plugin' " show git status in nerdtree for files and dirs -Plug 'Yggdroot/LeaderF' " fuzzy matcher, apparently faster than fzf, ctrlp, unit, denite +Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' } " show git status in nerdtree for files and dirs +Plug 'Yggdroot/LeaderF', { 'on': ['Leaderf', 'LeaderfFile', 'LeaderfBuffer'], 'do': './install.sh' } " fuzzy matcher, apparently faster than fzf, ctrlp, unit, denite " Language Integration Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language Plug 'stephpy/vim-yaml' -Plug 'mhartington/nvim-typescript', {'do': './install.sh'} +Plug 'mhartington/nvim-typescript', {'for': 'typescript','do': './install.sh'} " HTML Workflow -Plug 'valloric/matchtagalways' -Plug 'alvan/vim-closetag' +Plug 'valloric/matchtagalways', { 'on': [] } +Plug 'alvan/vim-closetag', { 'on': [] } +Plug 'jiangmiao/auto-pairs', { 'on': [] } " Auto close brackets and '' +augroup load_html_utils + autocmd! + autocmd InsertEnter * call plug#load('matchtagalways', 'vim-closetag', 'auto-pairs') + \| autocmd! load_html_utils +augroup END " Markdown & Prose Workflow -Plug 'reedes/vim-pencil' " provide md convenience functions like hard/softwrap -Plug 'junegunn/goyo.vim' " provide distraction free writing -Plug 'junegunn/limelight.vim' " provide even distraction free-er writing (lowlight paragraphs) -Plug 'rhysd/vim-grammarous' " integrate vim with languagetool for grammar checking (needs java8) +Plug 'reedes/vim-pencil', { 'for': ['mkd', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap +Plug 'junegunn/goyo.vim', { 'for': ['mkd', 'txt'], 'on': 'Goyo' } " provide distraction free writing +Plug 'junegunn/limelight.vim', { 'for': ['mkd', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs) +Plug 'rhysd/vim-grammarous', { 'for': ['mkd', 'txt'], 'on': 'Goyo' } " integrate vim with languagetool for grammar checking (needs java8) " For async completion -Plug 'Shougo/deoplete.nvim' " automatic suggestions, can also perhaps be changed for newer plugs -Plug 'w0rp/ale' " asynchronous linting - might be superseded by lsp or coc.nvim at some point +Plug 'Shougo/deoplete.nvim', { 'on': [] } " automatic suggestions, can also perhaps be changed for newer plugs +Plug 'w0rp/ale', { 'on': [] } " asynchronous linting - might be superseded by lsp or coc.nvim at some point +" lazy loading since they require a lot of startup time +augroup load_ide_features + autocmd! + autocmd InsertEnter * call plug#load('ale', 'deoplete.nvim') + \| autocmd! load_ide_features + autocmd InsertEnter * call deoplete#enable() +augroup END " Design Plug 'vim-airline/vim-airline' @@ -167,7 +179,7 @@ autocmd! User GoyoLeave nested call goyo_leave() " PLUGIN: DEOPLETE " enable deoplete at startup -let g:deoplete#enable_at_startup = 1 +let g:deoplete#enable_at_startup = 0 let g:deoplete#enable_ignore_case = 1 let g:deoplete#enable_smart_case = 1 let g:deoplete#enable_camel_case = 1 @@ -318,6 +330,9 @@ nnoremap Q vapJgqap " Enter distraction free prose mode with F11 noremap :Goyo +" Call leaderf with (necessary to enable leaderf lazyloading) +nnoremap f :LeaderfFile + " }}} " ================================================================================ " END