Update README and vimdoc

This commit is contained in:
Junegunn Choi 2024-05-14 18:46:41 +09:00
parent c0992146e2
commit c5a870e117
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
2 changed files with 182 additions and 87 deletions

View File

@ -32,9 +32,10 @@ A minimalist Vim plugin manager.
### Pros. ### Pros.
- Easy to set up: Single file. No boilerplate code required. - Minimalist design
- Easy to use: Concise, intuitive syntax - Just one file with no dependencies. Super easy to set up.
- Minimalist: No feature bloat - Concise, intuitive syntax that you can learn within minutes. No boilerplate code required.
- No feature bloat
- Extremely stable with flawless backward compatibility - Extremely stable with flawless backward compatibility
- Works perfectly with Vim 7.0+ since 2006 and with all versions of Neovim since 2014 - Works perfectly with Vim 7.0+ since 2006 and with all versions of Neovim since 2014
- [Super-fast][40/4] parallel installation/update - [Super-fast][40/4] parallel installation/update
@ -97,30 +98,50 @@ iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force
``` ```
### Getting Help ### Usage
- See [tutorial] page to learn the basics of vim-plug Add a vim-plug section to your `~/.vimrc` (or `init.vim` for Neovim)
1. Begin the section with `call plug#begin()`
1. List the plugins with `Plug` commands
1. End the section with `call plug#end()`
For example,
```vim
call plug#begin()
" List your plugins here
Plug 'tpope/vim-sensible'
call plug#end()
```
Reload the file or restart Vim, then you can,
* `:PlugInstall` to install the plugins
* `:PlugUpdate` to install or update the plugins
* `:PlugDiff` to review the changes from the last update
> [!NOTE]
> That's basically all you need to know to get started. The rest of the
> document is for advanced users who want to know more about the features and
> options.
#### Getting Help
- See [tutorial] page to learn more about the basics of vim-plug
- See [tips] and [FAQ] pages for common problems and questions - See [tips] and [FAQ] pages for common problems and questions
- See [requirements] page for debugging information & tested configurations
- Create an [issue](https://github.com/junegunn/vim-plug/issues/new)
[tutorial]: https://github.com/junegunn/vim-plug/wiki/tutorial [tutorial]: https://github.com/junegunn/vim-plug/wiki/tutorial
[tips]: https://github.com/junegunn/vim-plug/wiki/tips [tips]: https://github.com/junegunn/vim-plug/wiki/tips
[FAQ]: https://github.com/junegunn/vim-plug/wiki/faq [FAQ]: https://github.com/junegunn/vim-plug/wiki/faq
[requirements]: https://github.com/junegunn/vim-plug/wiki/requirements
### Usage ### More examples
Add a vim-plug section to your `~/.vimrc` (or `stdpath('config') . '/init.vim'` for Neovim) The following examples demonstrate the additional features of vim-plug.
1. Begin the section with `call plug#begin([PLUGIN_DIR])` #### Vim script example
1. List the plugins with `Plug` commands
1. `call plug#end()` to update `&runtimepath` and initialize plugin system
- Automatically executes `filetype plugin indent on` and `syntax enable`.
You can revert the settings after the call. e.g. `filetype indent off`, `syntax off`, etc.
1. Reload the file or restart Vim and run `:PlugInstall` to install plugins.
#### Example
```vim ```vim
call plug#begin() call plug#begin()
@ -167,18 +188,18 @@ Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Unmanaged plugin (manually installed and updated) " Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin' Plug '~/my-prototype-plugin'
" Initialize plugin system " Call plug#end to update &runtimepath and initialize the plugin system.
" - Automatically executes `filetype plugin indent on` and `syntax enable`. " - It automatically executes `filetype plugin indent on` and `syntax enable`
call plug#end() call plug#end()
" You can revert the settings after the call like so: " You can revert the settings after the call like so:
" filetype indent off " Disable file-type-specific indentation " filetype indent off " Disable file-type-specific indentation
" syntax off " Disable syntax highlighting " syntax off " Disable syntax highlighting
``` ```
#### Example (Lua configuration for Neovim) #### Lua configuration example for Neovim
In Neovim, you can write your configuration in a Lua script file named In Neovim, you can write your configuration in a Lua script file named
`init.lua`. The following code is the Lua script equivalent to the VimScript `init.lua`. The following code is the Lua script equivalent to the Vim script
example above. example above.
```lua ```lua
@ -279,14 +300,6 @@ More examples can be found in:
- `:PlugDiff` - `:PlugDiff`
- `X` - Revert the update - `X` - Revert the update
### Example: A small [sensible](https://github.com/tpope/vim-sensible) Vim configuration
```vim
call plug#begin()
Plug 'tpope/vim-sensible'
call plug#end()
```
### On-demand loading of plugins ### On-demand loading of plugins
```vim ```vim
@ -400,7 +413,7 @@ with the bang-versions of the commands: `PlugInstall!` and `PlugUpdate!`.
> ``` > ```
> >
> But you can avoid the escaping if you extract the inline specification using a > But you can avoid the escaping if you extract the inline specification using a
> variable (or any Vimscript expression) as follows: > variable (or any Vim script expression) as follows:
> >
> ```vim > ```vim
> let g:fzf_install = 'yes | ./install' > let g:fzf_install = 'yes | ./install'

View File

@ -1,21 +1,24 @@
plug.txt plug Last change: March 31 2024 plug.txt plug Last change: May 14 2024
PLUG - TABLE OF CONTENTS *plug* *plug-toc* PLUG - TABLE OF CONTENTS *plug* *plug-toc*
============================================================================== ==============================================================================
vim-plug |vim-plug| vim-plug |vim-plug|
Getting Help |plug-getting-help| Pros. |plug-pros|
Usage |plug-usage| Installation |plug-installation|
Example |plug-example| Usage |plug-usage|
Example (Lua configuration for Neovim) |plug-examplelua-configuration-for-neovim| Getting Help |plug-getting-help|
Commands |plug-commands| More examples |plug-more-examples|
Plug options |plug-options| Vim script example |plug-vim-script-example|
Global options |plug-global-options| Lua configuration example for Neovim |plug-lua-configuration-example-for-neovim|
Keybindings |plug-keybindings| Commands |plug-commands|
Example: A small sensible Vim configuration |plug-example-a-small-sensible-vim-configuration| Plug options |plug-options|
On-demand loading of plugins |plug-on-demand-loading-of-plugins| Global options |plug-global-options|
Post-update hooks |plug-post-update-hooks| Keybindings |plug-keybindings|
PlugInstall! and PlugUpdate! |pluginstall-and-plugupdate| On-demand loading of plugins |plug-on-demand-loading-of-plugins|
License |plug-license| Post-update hooks |plug-post-update-hooks|
PlugInstall! and PlugUpdate! |pluginstall-and-plugupdate|
Collaborators |plug-collaborators|
License |plug-license|
VIM-PLUG *vim-plug* VIM-PLUG *vim-plug*
============================================================================== ==============================================================================
@ -23,40 +26,89 @@ VIM-PLUG *vim-plug*
A minimalist Vim plugin manager. A minimalist Vim plugin manager.
< Getting Help >______________________________________________________________~ < Pros. >_____________________________________________________________________~
*plug-getting-help* *plug-pros*
- See {tutorial}{1} page to learn the basics of vim-plug - Minimalist design
- See {tips}{2} and {FAQ}{3} pages for common problems and questions - Just one file with no dependencies. Super easy to set up.
- See {requirements}{4} page for debugging information & tested configurations - Concise, intuitive syntax that you can learn within minutes. No
- Create an {issue}{5} boilerplate code required.
- No feature bloat
- Extremely stable with flawless backward compatibility
- Works perfectly with Vim 7.0+ since 2006 and with all versions of Neovim
since 2014
- {Super-fast}{1} parallel installation/update
- Creates shallow clones to minimize disk space usage and download time
- On-demand loading for {faster startup time}{2}
- Can review and rollback updates
- Branch/tag/commit support
- Post-update hooks
- Support for externally managed plugins
{1} https://github.com/junegunn/vim-plug/wiki/tutorial {1} https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
{2} https://github.com/junegunn/vim-plug/wiki/tips {2} https://github.com/junegunn/vim-startuptime-benchmark#result
{3} https://github.com/junegunn/vim-plug/wiki/faq
{4} https://github.com/junegunn/vim-plug/wiki/requirements
{5} https://github.com/junegunn/vim-plug/issues/new < Installation >______________________________________________________________~
*plug-installation*
{Download plug.vim}{3} and put it in the "autoload" directory.
{3} https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
< Usage >_____________________________________________________________________~ < Usage >_____________________________________________________________________~
*plug-usage* *plug-usage*
Add a vim-plug section to your `~/.vimrc` (or Add a vim-plug section to your `~/.vimrc` (or `init.vim` for Neovim)
`stdpath('config') . '/init.vim'` for Neovim)
*plug#begin* *plug#end* *plug#begin* *plug#end*
1. Begin the section with `call plug#begin([PLUGIN_DIR])` 1. Begin the section with `callplug#begin()`
2. List the plugins with `Plug` commands 2. List the plugins with `Plug` commands
3. `call plug#end()` to update 'runtimepath' and initialize plugin system 3. End the section with `callplug#end()`
- Automatically executes `filetype plugin indent on` and `syntax enable`.
You can revert the settings after the call. e.g. `filetype indent off`, For example,
`syntax off`, etc. >
4. Reload the file or restart Vim and run `:PlugInstall` to install plugins. call plug#begin()
" List your plugins here
Plug 'tpope/vim-sensible'
call plug#end()
<
Reload the file or restart Vim, then you can,
*:PlugInstall* *:PlugUpdate* *:PlugDiff*
- `:PlugInstall` to install the plugins
- `:PlugUpdate` to install or update the plugins
- `:PlugDiff` to review the changes from the last update
[!NOTE] That's basically all you need to know to get started. The rest of the
document is for advanced users who want to know more about the features and
options.
Example~ Getting Help~
*plug-example* *plug-getting-help*
- See {tutorial}{4} page to learn more about the basics of vim-plug
- See {tips}{5} and {FAQ}{6} pages for common problems and questions
{4} https://github.com/junegunn/vim-plug/wiki/tutorial
{5} https://github.com/junegunn/vim-plug/wiki/tips
{6} https://github.com/junegunn/vim-plug/wiki/faq
< More examples >_____________________________________________________________~
*plug-more-examples*
The following examples demonstrate the additional features of vim-plug.
Vim script example~
*plug-vim-script-example*
> >
call plug#begin() call plug#begin()
" The default plugin directory will be as follows: " The default plugin directory will be as follows:
@ -102,19 +154,19 @@ Example~
" Unmanaged plugin (manually installed and updated) " Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin' Plug '~/my-prototype-plugin'
" Initialize plugin system " Call plug#end to update &runtimepath and initialize the plugin system.
" - Automatically executes `filetype plugin indent on` and `syntax enable`. " - It automatically executes `filetype plugin indent on` and `syntax enable`
call plug#end() call plug#end()
" You can revert the settings after the call like so: " You can revert the settings after the call like so:
" filetype indent off " Disable file-type-specific indentation " filetype indent off " Disable file-type-specific indentation
" syntax off " Disable syntax highlighting " syntax off " Disable syntax highlighting
< <
Example (Lua configuration for Neovim)~ Lua configuration example for Neovim~
*plug-example-lua-configuration-for-neovim* *plug-lua-configuration-example-for-neovim*
In Neovim, you can write your configuration in a Lua script file named In Neovim, you can write your configuration in a Lua script file named
`init.lua`. The following code is the Lua script equivalent to the VimScript `init.lua`. The following code is the Lua script equivalent to the Vim script
example above. example above.
> >
local vim = vim local vim = vim
@ -189,7 +241,7 @@ More examples can be found in:
*<Plug>-mappings* *<Plug>-mappings*
------------------------+------------------------------------------------------------ ------------------------+------------------------------------------------------------
Option | Description ~ Option | Description ~
------------------------+------------------------------------------------------------ ------------------------+------------------------------------------------------------
`branch` / `tag` / `commit` | Branch/tag/commit of the repository to use `branch` / `tag` / `commit` | Branch/tag/commit of the repository to use
`rtp` | Subdirectory that contains Vim plugin `rtp` | Subdirectory that contains Vim plugin
@ -235,14 +287,6 @@ More examples can be found in:
- `X` - Revert the update - `X` - Revert the update
< Example: A small sensible Vim configuration >_______________________________~
*plug-example-a-small-sensible-vim-configuration*
>
call plug#begin()
Plug 'tpope/vim-sensible'
call plug#end()
<
< On-demand loading of plugins >______________________________________________~ < On-demand loading of plugins >______________________________________________~
*plug-on-demand-loading-of-plugins* *plug-on-demand-loading-of-plugins*
> >
@ -265,9 +309,39 @@ More examples can be found in:
Plug 'junegunn/goyo.vim', { 'for': 'markdown' } Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
autocmd! User goyo.vim echom 'Goyo is now loaded!' autocmd! User goyo.vim echom 'Goyo is now loaded!'
< <
The `for` option is generally not needed as most plugins for specific file [!NOTE] #### Should I set up on-demand loading?
types usually don't have too much code in the `plugin` directory. You might
want to examine the output of `vim --startuptime` before applying the option. You probably don't need to.
A properly implemented Vim plugin should already load lazily without any help
from a plugin manager (`:helpautoload`). 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 >_________________________________________________________~ < Post-update hooks >_________________________________________________________~
@ -313,9 +387,7 @@ the trailing comment.
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' } Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
< <
But you can avoid the escaping if you extract the inline specification using a But you can avoid the escaping if you extract the inline specification using a
variable (or any Vimscript expression) as follows: variable (or any Vim script expression) as follows:
*g:fzf_install*
> >
let g:fzf_install = 'yes | ./install' let g:fzf_install = 'yes | ./install'
Plug 'junegunn/fzf', { 'do': g:fzf_install } Plug 'junegunn/fzf', { 'do': g:fzf_install }
@ -336,6 +408,16 @@ The commands with the `!` suffix ensure that all steps are run
unconditionally. unconditionally.
< Collaborators >_____________________________________________________________~
*plug-collaborators*
- {Jan Edmund Lazo}{7} - Windows support
- {Jeremy Pallats}{8} - Python installer
{7} https://github.com/janlazo
{8} https://github.com/starcraftman
< License >___________________________________________________________________~ < License >___________________________________________________________________~
*plug-license* *plug-license*