From e62a6574034da5f158c3ed483893ffc592e08034 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 14 May 2024 18:50:04 +0900 Subject: [PATCH] Reorder --- README.md | 120 +++++++++++++++++++++++++-------------------------- doc/plug.txt | 116 ++++++++++++++++++++++++------------------------- 2 files changed, 118 insertions(+), 118 deletions(-) diff --git a/README.md b/README.md index 89e7b67..94c9b48 100644 --- a/README.md +++ b/README.md @@ -300,66 +300,6 @@ More examples can be found in: - `:PlugDiff` - `X` - Revert the update -### On-demand loading of plugins - -```vim -" NERD tree will be loaded on the first invocation of NERDTreeToggle command -Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' } - -" Multiple commands -Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] } - -" Loaded when clojure file is opened -Plug 'tpope/vim-fireplace', { 'for': 'clojure' } - -" Multiple file types -Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] } - -" On-demand loading on both conditions -Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' } - -" Code to execute when the plugin is lazily loaded on demand -Plug 'junegunn/goyo.vim', { 'for': 'markdown' } -autocmd! User goyo.vim echom 'Goyo is now loaded!' -``` - -> [!NOTE] -> #### Should I set up on-demand loading? -> -> You probably don't need to. -> -> A properly implemented Vim plugin should already load lazily without any -> help from a plugin manager (`:help autoload`). So there are few cases where -> these options actually make much sense. Making a plugin load faster is -> the responsibility of the plugin developer, not the user. If you find -> a plugin that takes too long to load, consider opening an issue on the -> plugin's issue tracker. -> -> Let me give you a perspective. The time it takes to load a plugin is usually -> less than 2 or 3ms on modern computers. So unless you use a very large -> number of plugins, you are unlikely to save more than 50ms. If you have -> spent an hour carefully setting up the options to shave off 50ms, you -> will have to start Vim 72,000 times just to break even. You should ask -> yourself if that's a good investment of your time. -> -> Make sure that you're tackling the right problem by breaking down the -> startup time of Vim using `--startuptime`. -> -> ```sh -> vim --startuptime /tmp/log -> ``` -> -> On-demand loading should only be used as a last resort. It is basically -> a hacky workaround and is not always guaranteed to work. - -> [!TIP] -> You can pass an empty list to `on` or `for` option to disable the loading -> of the plugin. You can manually load the plugin using `plug#load(NAMES...)` -> function. -> -> See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually - - ### Post-update hooks There are some plugins that require extra steps after installation or update. @@ -432,6 +372,66 @@ The installer takes the following steps when installing/updating a plugin: The commands with the `!` suffix ensure that all steps are run unconditionally. +### On-demand loading of plugins + +```vim +" NERD tree will be loaded on the first invocation of NERDTreeToggle command +Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' } + +" Multiple commands +Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] } + +" Loaded when clojure file is opened +Plug 'tpope/vim-fireplace', { 'for': 'clojure' } + +" Multiple file types +Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] } + +" On-demand loading on both conditions +Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' } + +" Code to execute when the plugin is lazily loaded on demand +Plug 'junegunn/goyo.vim', { 'for': 'markdown' } +autocmd! User goyo.vim echom 'Goyo is now loaded!' +``` + +> [!NOTE] +> #### Should I set up on-demand loading? +> +> You probably don't need to. +> +> A properly implemented Vim plugin should already load lazily without any +> help from a plugin manager (`:help autoload`). So there are few cases where +> these options actually make much sense. Making a plugin load faster is +> the responsibility of the plugin developer, not the user. If you find +> a plugin that takes too long to load, consider opening an issue on the +> plugin's issue tracker. +> +> Let me give you a perspective. The time it takes to load a plugin is usually +> less than 2 or 3ms on modern computers. So unless you use a very large +> number of plugins, you are unlikely to save more than 50ms. If you have +> spent an hour carefully setting up the options to shave off 50ms, you +> will have to start Vim 72,000 times just to break even. You should ask +> yourself if that's a good investment of your time. +> +> Make sure that you're tackling the right problem by breaking down the +> startup time of Vim using `--startuptime`. +> +> ```sh +> vim --startuptime /tmp/log +> ``` +> +> On-demand loading should only be used as a last resort. It is basically +> a hacky workaround and is not always guaranteed to work. + +> [!TIP] +> You can pass an empty list to `on` or `for` option to disable the loading +> of the plugin. You can manually load the plugin using `plug#load(NAMES...)` +> function. +> +> See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually + + ### Collaborators - [Jan Edmund Lazo](https://github.com/janlazo) - Windows support diff --git a/doc/plug.txt b/doc/plug.txt index c1c4a59..ed0800e 100644 --- a/doc/plug.txt +++ b/doc/plug.txt @@ -14,9 +14,9 @@ PLUG - TABLE OF CONTENTS *plug* *plug-to Plug options |plug-options| Global options |plug-global-options| Keybindings |plug-keybindings| - On-demand loading of plugins |plug-on-demand-loading-of-plugins| Post-update hooks |plug-post-update-hooks| PlugInstall! and PlugUpdate! |pluginstall-and-plugupdate| + On-demand loading of plugins |plug-on-demand-loading-of-plugins| Collaborators |plug-collaborators| License |plug-license| @@ -287,63 +287,6 @@ More examples can be found in: - `X` - Revert the update -< On-demand loading of plugins >______________________________________________~ - *plug-on-demand-loading-of-plugins* -> - " NERD tree will be loaded on the first invocation of NERDTreeToggle command - Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' } - - " Multiple commands - Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] } - - " Loaded when clojure file is opened - Plug 'tpope/vim-fireplace', { 'for': 'clojure' } - - " Multiple file types - Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] } - - " On-demand loading on both conditions - Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' } - - " Code to execute when the plugin is lazily loaded on demand - Plug 'junegunn/goyo.vim', { 'for': 'markdown' } - autocmd! User goyo.vim echom 'Goyo is now loaded!' -< -[!NOTE] #### Should I set up on-demand loading? - -You probably don't need to. - -A properly implemented Vim plugin should already load lazily without any help -from a plugin manager (`:help autoload`). So there are few cases where these -options actually make much sense. Making a plugin load faster is the -responsibility of the plugin developer, not the user. If you find a plugin -that takes too long to load, consider opening an issue on the plugin's issue -tracker. - -Let me give you a perspective. The time it takes to load a plugin is usually -less than 2 or 3ms on modern computers. So unless you use a very large number -of plugins, you are unlikely to save more than 50ms. If you have spent an hour -carefully setting up the options to shave off 50ms, you will have to start Vim -72,000 times just to break even. You should ask yourself if that's a good -investment of your time. - -Make sure that you're tackling the right problem by breaking down the startup -time of Vim using `--startuptime`. -> - vim --startuptime /tmp/log -< -On-demand loading should only be used as a last resort. It is basically a -hacky workaround and is not always guaranteed to work. - - *plug#load* - -[!TIP] You can pass an empty list to `on` or `for` option to disable the -loading of the plugin. You can manually load the plugin using -`plug#load(NAMES...)` function. - -See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually - - < Post-update hooks >_________________________________________________________~ *plug-post-update-hooks* @@ -408,6 +351,63 @@ The commands with the `!` suffix ensure that all steps are run unconditionally. +< On-demand loading of plugins >______________________________________________~ + *plug-on-demand-loading-of-plugins* +> + " NERD tree will be loaded on the first invocation of NERDTreeToggle command + Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' } + + " Multiple commands + Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] } + + " Loaded when clojure file is opened + Plug 'tpope/vim-fireplace', { 'for': 'clojure' } + + " Multiple file types + Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] } + + " On-demand loading on both conditions + Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' } + + " Code to execute when the plugin is lazily loaded on demand + Plug 'junegunn/goyo.vim', { 'for': 'markdown' } + autocmd! User goyo.vim echom 'Goyo is now loaded!' +< +[!NOTE] #### Should I set up on-demand loading? + +You probably don't need to. + +A properly implemented Vim plugin should already load lazily without any help +from a plugin manager (`:help autoload`). So there are few cases where these +options actually make much sense. Making a plugin load faster is the +responsibility of the plugin developer, not the user. If you find a plugin +that takes too long to load, consider opening an issue on the plugin's issue +tracker. + +Let me give you a perspective. The time it takes to load a plugin is usually +less than 2 or 3ms on modern computers. So unless you use a very large number +of plugins, you are unlikely to save more than 50ms. If you have spent an hour +carefully setting up the options to shave off 50ms, you will have to start Vim +72,000 times just to break even. You should ask yourself if that's a good +investment of your time. + +Make sure that you're tackling the right problem by breaking down the startup +time of Vim using `--startuptime`. +> + vim --startuptime /tmp/log +< +On-demand loading should only be used as a last resort. It is basically a +hacky workaround and is not always guaranteed to work. + + *plug#load* + +[!TIP] You can pass an empty list to `on` or `for` option to disable the +loading of the plugin. You can manually load the plugin using +`plug#load(NAMES...)` function. + +See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually + + < Collaborators >_____________________________________________________________~ *plug-collaborators*