mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 02:25:35 -07:00
README: Lambda expression as post-update hook
This commit is contained in:
parent
eee20c7e79
commit
6154433e22
21
README.md
21
README.md
@ -311,8 +311,14 @@ If the value starts with `:`, it will be recognized as a Vim command.
|
|||||||
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To call a Vim function, you can pass a lambda expression like so:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||||
|
```
|
||||||
|
|
||||||
If you need more control, you can pass a reference to a Vim function that
|
If you need more control, you can pass a reference to a Vim function that
|
||||||
takes a single argument.
|
takes a dictionary argument.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
function! BuildYCM(info)
|
function! BuildYCM(info)
|
||||||
@ -328,14 +334,13 @@ endfunction
|
|||||||
Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
|
Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
|
||||||
```
|
```
|
||||||
|
|
||||||
Both forms of post-update hook are executed inside the directory of the plugin
|
A post-update hook is executed inside the directory of the plugin and only run
|
||||||
and only run when the repository has changed, but you can force it to run
|
when the repository has changed, but you can force it to run unconditionally
|
||||||
unconditionally with the bang-versions of the commands: `PlugInstall!` and
|
with the bang-versions of the commands: `PlugInstall!` and `PlugUpdate!`.
|
||||||
`PlugUpdate!`.
|
|
||||||
|
|
||||||
Make sure to escape BARs and double-quotes when you write the `do` option inline
|
Make sure to escape BARs and double-quotes when you write the `do` option
|
||||||
as they are mistakenly recognized as command separator or the start of the
|
inline as they are mistakenly recognized as command separator or the start of
|
||||||
trailing comment.
|
the trailing comment.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
|
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
|
||||||
|
17
doc/plug.txt
17
doc/plug.txt
@ -1,4 +1,4 @@
|
|||||||
plug.txt plug Last change: January 19 2023
|
plug.txt plug Last change: February 23 2024
|
||||||
PLUG - TABLE OF CONTENTS *plug* *plug-toc*
|
PLUG - TABLE OF CONTENTS *plug* *plug-toc*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
@ -297,13 +297,15 @@ In that case, use the `do` option to describe the task to be performed.
|
|||||||
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
|
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
|
||||||
<
|
<
|
||||||
If the value starts with `:`, it will be recognized as a Vim command.
|
If the value starts with `:`, it will be recognized as a Vim command.
|
||||||
|
|
||||||
*:GoInstallBinaries*
|
|
||||||
>
|
>
|
||||||
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
||||||
<
|
<
|
||||||
|
To call a Vim function, you can pass a lambda expression like so:
|
||||||
|
>
|
||||||
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||||
|
<
|
||||||
If you need more control, you can pass a reference to a Vim function that
|
If you need more control, you can pass a reference to a Vim function that
|
||||||
takes a single argument.
|
takes a dictionary argument.
|
||||||
>
|
>
|
||||||
function! BuildYCM(info)
|
function! BuildYCM(info)
|
||||||
" info is a dictionary with 3 fields
|
" info is a dictionary with 3 fields
|
||||||
@ -317,10 +319,9 @@ takes a single argument.
|
|||||||
|
|
||||||
Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
|
Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
|
||||||
<
|
<
|
||||||
Both forms of post-update hook are executed inside the directory of the plugin
|
A post-update hook is executed inside the directory of the plugin and only run
|
||||||
and only run when the repository has changed, but you can force it to run
|
when the repository has changed, but you can force it to run unconditionally
|
||||||
unconditionally with the bang-versions of the commands: `PlugInstall!` and
|
with the bang-versions of the commands: `PlugInstall!` and `PlugUpdate!`.
|
||||||
`PlugUpdate!`.
|
|
||||||
|
|
||||||
Make sure to escape BARs and double-quotes when you write the `do` option
|
Make sure to escape BARs and double-quotes when you write the `do` option
|
||||||
inline as they are mistakenly recognized as command separator or the start of
|
inline as they are mistakenly recognized as command separator or the start of
|
||||||
|
Loading…
Reference in New Issue
Block a user