Skip to content

Commit d54f8d5

Browse files
authored
README: Use markdown alerts (#1276)
1 parent 61b6df6 commit d54f8d5

File tree

1 file changed

+52
-18
lines changed

1 file changed

+52
-18
lines changed

README.md

+52-18
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,42 @@ Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
309309
autocmd! User goyo.vim echom 'Goyo is now loaded!'
310310
```
311311

312-
The `for` option is generally not needed as most plugins for specific file types
313-
usually don't have too much code in the `plugin` directory. You might want to
314-
examine the output of `vim --startuptime` before applying the option.
312+
> [!NOTE]
313+
> #### Should I set up on-demand loading?
314+
>
315+
> You probably don't need to.
316+
>
317+
> A properly implemented Vim plugin should already load lazily without any
318+
> help from a plugin manager (`:help autoload`). So there are few cases where
319+
> these options actually make much sense. Making a plugin load faster is
320+
> the responsibility of the plugin developer, not the user. If you find
321+
> a plugin that takes too long to load, consider opening an issue on the
322+
> plugin's issue tracker.
323+
>
324+
> Let me give you a perspective. The time it takes to load a plugin is usually
325+
> less than 2 or 3ms on modern computers. So unless you use a very large
326+
> number of plugins, you are unlikely to save more than 50ms. If you have
327+
> spent an hour carefully setting up the options to shave off 50ms, you
328+
> will have to start Vim 72,000 times just to break even. You should ask
329+
> yourself if that's a good investment of your time.
330+
>
331+
> Make sure that you're tackling the right problem by breaking down the
332+
> startup of time of Vim using `--startuptime`.
333+
>
334+
> ```sh
335+
> vim --startuptime /tmp/log
336+
> ```
337+
>
338+
> On-demand loading should only be used as a last resort. It is basically
339+
> a hacky workaround and is not always guaranteed to work.
340+
341+
> [!TIP]
342+
> You can pass an empty list to `on` or `for` option to disable the loading
343+
> of the plugin. You can manually load the plugin using `plug#load(NAMES...)`
344+
> function.
345+
>
346+
> See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually
347+
315348
316349
### Post-update hooks
317350
@@ -356,21 +389,22 @@ A post-update hook is executed inside the directory of the plugin and only run
356389
when the repository has changed, but you can force it to run unconditionally
357390
with the bang-versions of the commands: `PlugInstall!` and `PlugUpdate!`.
358391
359-
Make sure to escape BARs and double-quotes when you write the `do` option
360-
inline as they are mistakenly recognized as command separator or the start of
361-
the trailing comment.
362-
363-
```vim
364-
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
365-
```
366-
367-
But you can avoid the escaping if you extract the inline specification using a
368-
variable (or any Vimscript expression) as follows:
369-
370-
```vim
371-
let g:fzf_install = 'yes | ./install'
372-
Plug 'junegunn/fzf', { 'do': g:fzf_install }
373-
```
392+
> [!TIP]
393+
> Make sure to escape BARs and double-quotes when you write the `do` option
394+
> inline as they are mistakenly recognized as command separator or the start of
395+
> the trailing comment.
396+
>
397+
> ```vim
398+
> Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
399+
> ```
400+
>
401+
> But you can avoid the escaping if you extract the inline specification using a
402+
> variable (or any Vimscript expression) as follows:
403+
>
404+
> ```vim
405+
> let g:fzf_install = 'yes | ./install'
406+
> Plug 'junegunn/fzf', { 'do': g:fzf_install }
407+
> ```
374408
375409
### `PlugInstall!` and `PlugUpdate!`
376410

0 commit comments

Comments
 (0)