Compare commits

..

No commits in common. "master" and "0.10.0" have entirely different histories.

13 changed files with 674 additions and 1472 deletions

1
.github/FUNDING.yml vendored
View File

@ -1 +0,0 @@
github: junegunn

View File

@ -10,12 +10,7 @@ Explain the problem here ...
------------------------------ ------------------------------
<!-- Paste your Plug block (from `call plug#begin()` to `call plug#end()`) --> <!-- Put the contents of `:version` below -->
```
```
<!-- Paste the contents of `:version` below -->
``` ```
``` ```
@ -29,7 +24,7 @@ Explain the problem here ...
- OS: - OS:
- [ ] All/Other - [ ] All/Other
- [ ] Linux - [ ] Linux
- [ ] macOS - [ ] OS X
- [ ] Windows - [ ] Windows
- Vim: - Vim:
- [ ] Terminal Vim - [ ] Terminal Vim

View File

@ -1,52 +0,0 @@
---
name: Test vim-plug
on:
push:
branches: [master, devel]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
vim:
- vim
# FIXME: (core dumped) https://github.com/junegunn/vim-plug/runs/4422576984?check_suite_focus=true#step:3:238
# - neovim-stable
# - neovim-unstable
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install packages and test
env:
ENV: ${{ matrix.vim }}
run: |
export DEPS=~/deps
export PATH=~/deps/bin:$PATH
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
case "$ENV" in
vim)
sudo apt-get install vim
;;
neovim-*)
sudo add-apt-repository ppa:neovim-ppa/${ENV/neovim-/}
sudo apt-get update
sudo apt-get install neovim
mkdir -p $DEPS/bin
echo 'nvim "$@"' > $DEPS/bin/vim
chmod +x $DEPS/bin/vim
export VADER_OUTPUT_FILE=/dev/stderr
;;
esac
test/run !

1
.gitignore vendored
View File

@ -1 +0,0 @@
doc/tags

View File

@ -1,63 +1,54 @@
language: minimal language: ruby
dist: trusty
sudo: false
env: env:
global: global:
- DEPS=$HOME/deps - DEPS=$HOME/deps
- PATH=$DEPS/bin:$PATH - PATH=$DEPS/bin:$PATH
jobs: matrix:
include: include:
- env: ENV=vim80-bionic - env: ENV=vim72
dist: bionic rvm: 1.8.7
stage: vim8 addons: { apt: { packages: [vim-nox] } }
- env: ENV=vim-nightly - env: ENV=python
dist: trusty rvm: 1.8.7
stage: vim8 addons: { apt: { packages: [python2.7-dev] } }
- env: ENV=neovim-stable - env: ENV=python3
dist: bionic rvm: 1.8.7
addons: {apt: {packages: [neovim], sources: [{sourceline: 'ppa:neovim-ppa/stable'}]}} addons: { apt: { packages: [python3-dev] } }
stage: neovim - env: ENV=ruby18
- env: ENV=neovim-nightly rvm: 1.8.7
dist: bionic - env: ENV=ruby20
addons: {apt: {packages: [neovim], sources: [{sourceline: 'ppa:neovim-ppa/unstable'}]}} rvm: 2.0.0
stage: neovim - env: ENV=neovim
- env: ENV=vim74-trusty-python - env: ENV=vim8
dist: trusty
stage: vim74
- env: ENV=vim74-xenial-python3
dist: xenial
stage: vim74
- env: ENV=vim74-trusty-ruby
dist: trusty
addons: {apt: {packages: [vim-nox]}}
stage: vim74
- env: ENV=vim74-xenial-ruby
dist: xenial
addons: {apt: {packages: [vim-nox]}}
stage: vim74
- env: ENV=osx-highsierra
os: osx
osx_image: xcode9.4
stage: vim8
install: | install: |
git config --global user.email "you@example.com" git config --global user.email "you@example.com"
git config --global user.name "Your Name" git config --global user.name "Your Name"
if [ "$ENV" == "vim72" ]; then
mkdir -p ${DEPS}/bin
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
return
elif [ "$ENV" == "neovim" ]; then
# https://github.com/neovim/bot-ci#nightly-builds
eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64"
mkdir -p ${DEPS}/bin
ln -s $(which nvim) ${DEPS}/bin/vim
export VADER_OUTPUT_FILE=/dev/stderr
return
fi
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui " C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui "
case "$ENV" in case "$ENV" in
vim-*) python)
C_OPTS+=--enable-pythoninterp
;; ;;
neovim-*) python3)
mkdir -p ${DEPS}/bin C_OPTS+=--enable-python3interp
ln -s /usr/bin/nvim ${DEPS}/bin/vim
export VADER_OUTPUT_FILE=/dev/stderr
return
;; ;;
vim74-* | vim80-*) ruby*)
mkdir -p ${DEPS}/bin C_OPTS+=--enable-rubyinterp
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
return
;;
*)
return
;; ;;
esac esac

485
README.md
View File

@ -1,44 +1,16 @@
<div align="center"> <img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="75" alt="vim-plug">[![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)](https://travis-ci.org/junegunn/vim-plug)
<sup>Special thanks to:</sup> ===
<br>
<br>
<a href="https://warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=vimplug_20240209">
<div>
<img src="https://raw.githubusercontent.com/junegunn/i/master/warp.png" width="300" alt="Warp">
</div>
<b>Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.</b>
<div>
<sup>Visit warp.dev to learn more.</sup>
</div>
</a>
<br>
<hr>
</div>
<br>
<h1 title="vim-plug">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./plug-dark.png">
<img src="./plug.png" height="75" alt="vim-plug">
</picture>
<a href="https://github.com/junegunn/vim-plug/actions/workflows/test.yml?query=branch%3Amaster">
<img src="https://img.shields.io/github/actions/workflow/status/junegunn/vim-plug/test.yml?branch=master">
</a>
</h1>
A minimalist Vim plugin manager. A minimalist Vim plugin manager.
<img src="https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif" height="450"> <img src="https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif" height="450">
## Pros. ### Pros.
- Minimalist design - Easier to setup: Single file. No boilerplate code required.
- Just one file with no dependencies. Super easy to set up. - Easier to use: Concise, intuitive syntax
- Concise, intuitive syntax that you can learn within minutes. No boilerplate code required.
- No feature bloat
- Extremely stable with flawless backward compatibility
- Works perfectly with all versions of Vim since 2006 and all versions of Neovim ever released
- [Super-fast][40/4] parallel installation/update - [Super-fast][40/4] parallel installation/update
(with any of `+job`, `+python`, `+python3`, `+ruby`, or [Neovim][nv])
- Creates shallow clones to minimize disk space usage and download time - Creates shallow clones to minimize disk space usage and download time
- On-demand loading for [faster startup time][startup-time] - On-demand loading for [faster startup time][startup-time]
- Can review and rollback updates - Can review and rollback updates
@ -47,19 +19,17 @@ A minimalist Vim plugin manager.
- Support for externally managed plugins - Support for externally managed plugins
[40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif [40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
[nv]: http://neovim.org/
[startup-time]: https://github.com/junegunn/vim-startuptime-benchmark#result [startup-time]: https://github.com/junegunn/vim-startuptime-benchmark#result
## Installation ### Installation
[Download plug.vim](https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim) [Download plug.vim](https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim)
and put it in the "autoload" directory. and put it in the "autoload" directory.
<details> #### Vim
<summary>Click to see the instructions</summary>
### Vim ###### Unix
#### Unix
```sh ```sh
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
@ -71,232 +41,133 @@ file as suggested [here][auto].
[auto]: https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation [auto]: https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
#### Windows (PowerShell) ###### Windows (PowerShell)
```powershell ```powershell
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |` md ~\vimfiles\autoload
ni $HOME/vimfiles/autoload/plug.vim -Force $uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile(
$uri,
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"~\vimfiles\autoload\plug.vim"
)
)
``` ```
### Neovim #### Neovim
#### Unix, Linux ###### Unix
```sh ```sh
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
```
#### Linux (Flatpak)
```sh
curl -fLo ~/.var/app/io.neovim.nvim/data/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
``` ```
#### Windows (PowerShell) ###### Windows (PowerShell)
```powershell ```powershell
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |` md ~\AppData\Local\nvim\autoload
ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force $uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile(
$uri,
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"~\AppData\Local\nvim\autoload\plug.vim"
)
)
``` ```
</details>
## Usage
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/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
* `:PlugClean` to remove plugins no longer in the list
> [!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.
> [!TIP]
> `plug#end()` automatically executes `filetype plugin indent on` and `syntax
> enable`. We believe this is a good default for most users, but if you don't
> want this behavior, you can revert the settings after the call.
>
> ```vim
> call plug#end()
> filetype indent off " Disable file-type-specific indentation
> syntax off " Disable syntax highlighting
> ```
### Getting Help ### Getting Help
- See [tutorial] page to learn more about the basics of vim-plug - See [tutorial] page to learn 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
## Examples ### Usage
The following examples demonstrate the additional features of vim-plug. Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neovim):
### Vim script example 1. Begin the section with `call plug#begin()`
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.
#### Example
```vim ```vim
call plug#begin() " Specify a directory for plugins
" The default plugin directory will be as follows: " - For Neovim: ~/.local/share/nvim/plugged
" - Vim (Linux/macOS): '~/.vim/plugged' " - Avoid using standard Vim directory names like 'plugin'
" - Vim (Windows): '~/vimfiles/plugged' call plug#begin('~/.vim/plugged')
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes " Make sure you use single quotes
" Shorthand notation for GitHub; translates to https://github.com/junegunn/seoul256.vim.git " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/seoul256.vim' Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed " Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-easy-align.git' Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above) " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' } Plug 'fatih/vim-go', { 'tag': '*' }
" Using a non-default branch " Plugin options
Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Use 'dir' option to install plugin in a non-default directory " Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf' }
" Post-update hook: run a shell command after installing or updating the plugin
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Post-update hook can be a lambda expression
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
" If the vim plugin is in a subdirectory, use 'rtp' option to specify its path
Plug 'nsf/gocode', { 'rtp': 'vim' }
" On-demand loading: loaded when the specified command is executed
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
" On-demand loading: loaded when a file with a specific file type is opened
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'
" Call plug#end to update &runtimepath and initialize the plugin system. " Initialize plugin system
" - 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:
" filetype indent off " Disable file-type-specific indentation
" syntax off " Disable syntax highlighting
" Color schemes should be loaded after plug#end().
" We prepend it with 'silent!' to ignore errors when it's not yet installed.
silent! colorscheme seoul256
``` ```
### Lua example for Neovim Reload .vimrc and `:PlugInstall` to install plugins.
In Neovim, you can write your configuration in a Lua script file named ### Commands
`init.lua`. The following code is the Lua script equivalent to the Vim script
example above.
```lua
local vim = vim
local Plug = vim.fn['plug#']
vim.call('plug#begin')
-- Shorthand notation for GitHub; translates to https://github.com/junegunn/seoul256.vim.git
Plug('junegunn/seoul256.vim')
-- Any valid git URL is allowed
Plug('https://github.com/junegunn/vim-easy-align.git')
-- Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug('fatih/vim-go', { ['tag'] = '*' })
-- Using a non-default branch
Plug('neoclide/coc.nvim', { ['branch'] = 'release' })
-- Use 'dir' option to install plugin in a non-default directory
Plug('junegunn/fzf', { ['dir'] = '~/.fzf' })
-- Post-update hook: run a shell command after installing or updating the plugin
Plug('junegunn/fzf', { ['dir'] = '~/.fzf', ['do'] = './install --all' })
-- Post-update hook can be a lambda expression
Plug('junegunn/fzf', { ['do'] = function()
vim.fn['fzf#install']()
end })
-- If the vim plugin is in a subdirectory, use 'rtp' option to specify its path
Plug('nsf/gocode', { ['rtp'] = 'vim' })
-- On-demand loading: loaded when the specified command is executed
Plug('preservim/nerdtree', { ['on'] = 'NERDTreeToggle' })
-- On-demand loading: loaded when a file with a specific file type is opened
Plug('tpope/vim-fireplace', { ['for'] = 'clojure' })
-- Unmanaged plugin (manually installed and updated)
Plug('~/my-prototype-plugin')
vim.call('plug#end')
-- Color schemes should be loaded after plug#end().
-- We prepend it with 'silent!' to ignore errors when it's not yet installed.
vim.cmd('silent! colorscheme seoul256')
```
## Commands
| Command | Description | | Command | Description |
| ----------------------------------- | ------------------------------------------------------------------ | | ----------------------------------- | ------------------------------------------------------------------ |
| `PlugInstall [name ...] [#threads]` | Install plugins | | `PlugInstall [name ...] [#threads]` | Install plugins |
| `PlugUpdate [name ...] [#threads]` | Install or update plugins | | `PlugUpdate [name ...] [#threads]` | Install or update plugins |
| `PlugClean[!]` | Remove unlisted plugins (bang version will clean without prompt) | | `PlugClean[!]` | Remove unused directories (bang version will clean without prompt) |
| `PlugUpgrade` | Upgrade vim-plug itself | | `PlugUpgrade` | Upgrade vim-plug itself |
| `PlugStatus` | Check the status of plugins | | `PlugStatus` | Check the status of plugins |
| `PlugDiff` | Examine changes from the previous update and the pending changes | | `PlugDiff` | Examine changes from the previous update and the pending changes |
| `PlugSnapshot[!] [output path]` | Generate script for restoring the current snapshot of the plugins | | `PlugSnapshot[!] [output path]` | Generate script for restoring the current snapshot of the plugins |
## `Plug` options ### `Plug` options
| 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 |
| `dir` | Custom directory for the plugin | | `dir` | Custom directory for the plugin |
| `as` | Use different name for the plugin | | `as` | Use different name for the plugin |
| `do` | Post-update hook (string or funcref) | | `do` | Post-update hook (string or funcref) |
| `on` | On-demand loading: Commands or `<Plug>`-mappings | | `on` | On-demand loading: Commands or `<Plug>`-mappings |
| `for` | On-demand loading: File types | | `for` | On-demand loading: File types |
| `frozen` | Do not remove and do not update unless explicitly specified | | `frozen` | Do not update unless explicitly specified |
## Global options ### Global options
| Flag | Default | Description | | Flag | Default | Description |
| ------------------- | --------------------------------- | ------------------------------------------------------ | | ------------------- | --------------------------------- | ------------------------------------------------------ |
@ -304,100 +175,36 @@ vim.cmd('silent! colorscheme seoul256')
| `g:plug_timeout` | 60 | Time limit of each task in seconds (*Ruby & Python*) | | `g:plug_timeout` | 60 | Time limit of each task in seconds (*Ruby & Python*) |
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) | | `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
| `g:plug_shallow` | 1 | Use shallow clone | | `g:plug_shallow` | 1 | Use shallow clone |
| `g:plug_window` | `-tabnew` | Command to open plug window | | `g:plug_window` | `vertical topleft new` | Command to open plug window |
| `g:plug_pwindow` | `vertical rightbelow new` | Command to open preview window in `PlugDiff` | | `g:plug_pwindow` | `above 12new` | Command to open preview window in `PlugDiff` |
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands) | | `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands) |
## Keybindings ### Keybindings
- `D` - `PlugDiff` - `D` - `PlugDiff`
- `S` - `PlugStatus` - `S` - `PlugStatus`
- `R` - Retry failed update or installation tasks - `R` - Retry failed update or installation tasks
- `U` - Update plugins in the selected range - `U` - Update plugins in the selected range
- `q` - Abort the running tasks or close the window - `q` - Close the window
- `:PlugStatus` - `:PlugStatus`
- `L` - Load plugin - `L` - Load plugin
- `:PlugDiff` - `:PlugDiff`
- `X` - Revert the update - `X` - Revert the update
## Post-update hooks ### Example: A small [sensible](https://github.com/tpope/vim-sensible) Vim configuration
There are some plugins that require extra steps after installation or update.
In that case, use the `do` option to describe the task to be performed.
```vim ```vim
Plug 'Shougo/vimproc.vim', { 'do': 'make' } call plug#begin()
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' } Plug 'tpope/vim-sensible'
call plug#end()
``` ```
If the value starts with `:`, it will be recognized as a Vim command. ### On-demand loading of plugins
```vim
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
takes a dictionary argument.
```vim
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force
!./install.py
endif
endfunction
Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
```
A post-update hook is executed inside the directory of the plugin and only run
when the repository has changed, but you can force it to run unconditionally
with the bang-versions of the commands: `PlugInstall!` and `PlugUpdate!`.
> [!TIP]
> 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
> the trailing comment.
>
> ```vim
> Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
> ```
>
> But you can avoid the escaping if you extract the inline specification using a
> variable (or any Vim script expression) as follows:
>
> ```vim
> let g:fzf_install = 'yes | ./install'
> Plug 'junegunn/fzf', { 'do': g:fzf_install }
> ```
### `PlugInstall!` and `PlugUpdate!`
The installer takes the following steps when installing/updating a plugin:
1. `git clone` or `git fetch` from its origin
2. Check out branch, tag, or commit and optionally `git merge` remote branch
3. If the plugin was updated (or installed for the first time)
1. Update submodules
2. Execute post-update hooks
The commands with the `!` suffix ensure that all steps are run unconditionally.
## On-demand loading of plugins
```vim ```vim
" NERD tree will be loaded on the first invocation of NERDTreeToggle command " NERD tree will be loaded on the first invocation of NERDTreeToggle command
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Multiple commands " Multiple commands
Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] } Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
@ -416,48 +223,84 @@ Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
autocmd! User goyo.vim echom 'Goyo is now loaded!' autocmd! User goyo.vim echom 'Goyo is now loaded!'
``` ```
> [!NOTE] `for` option is generally not needed as most plugins for specific file types
> #### Should I set up on-demand loading? usually don't have too much code in `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 (`: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] ### Post-update hooks
> 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
There are some plugins that require extra steps after installation or update.
In that case, use `do` option to describe the task to be performed.
## Collaborators ```vim
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
```
- [Jan Edmund Lazo](https://github.com/janlazo) - Windows support If the value starts with `:`, it will be recognized as a Vim command.
- [Jeremy Pallats](https://github.com/starcraftman) - Python installer
## License ```vim
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
```
If you need more control, you can pass a reference to a Vim function that
takes a single argument.
```vim
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force
!./install.py
endif
endfunction
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
```
Both forms of post-update hook are executed inside the directory of the plugin
and only run when the repository has changed, but you can force it to run
unconditionally with the bang-versions of the commands: `PlugInstall!` and
`PlugUpdate!`.
Make sure to escape BARs and double-quotes when you write `do` option inline
as they are mistakenly recognized as command separator or the start of the
trailing comment.
```vim
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
```
But you can avoid the escaping if you extract the inline specification using a
variable (or any Vimscript expression) as follows:
```vim
let g:fzf_install = 'yes | ./install'
Plug 'junegunn/fzf', { 'do': g:fzf_install }
```
### `PlugInstall!` and `PlugUpdate!`
The installer takes the following steps when installing/updating a plugin:
1. `git clone` or `git fetch` from its origin
2. Check out branch, tag, or commit and optionally `git merge` remote branch
3. If the plugin was updated (or installed for the first time)
1. Update submodules
2. Execute post-update hooks
The commands with `!` suffix ensure that all steps are run unconditionally.
### Articles
- [Writing my own Vim plugin manager](http://junegunn.kr/2013/09/writing-my-own-vim-plugin-manager)
- [Vim plugins and startup time](http://junegunn.kr/2014/07/vim-plugins-and-startup-time)
- ~~[Thoughts on Vim plugin dependency](http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency)~~
- *Support for Plugfile has been removed since 0.5.0*
### License
MIT MIT

View File

@ -1,249 +1,213 @@
plug.txt plug Last change: Jun 1 2024 plug.txt plug Last change: November 27 2017
PLUG - TABLE OF CONTENTS *plug* *plug-toc* PLUG - TABLE OF CONTENTS *plug* *plug-toc*
============================================================================== ==============================================================================
vim-plug |vim-plug| vim-plug
Pros. |plug-pros| Pros.
Installation |plug-installation| Installation
Usage |plug-usage| Vim
Getting Help |plug-getting-help| Unix
Examples |plug-examples| Windows (PowerShell)
Vim script example |plug-vim-script-example| Neovim
Lua example for Neovim |plug-lua-example-for-neovim| Unix
Commands |plug-commands| Windows (PowerShell)
Plug options |plug-options| Getting Help
Global options |plug-global-options| Usage
Keybindings |plug-keybindings| Example
Post-update hooks |plug-post-update-hooks| Commands
PlugInstall! and PlugUpdate! |pluginstall-and-plugupdate| Plug options
On-demand loading of plugins |plug-on-demand-loading-of-plugins| Global options
Collaborators |plug-collaborators| Keybindings
License |plug-license| Example: A small sensible Vim configuration
On-demand loading of plugins
Post-update hooks
PlugInstall! and PlugUpdate!
Articles
License
VIM-PLUG *vim-plug* VIM-PLUG *vim-plug*
============================================================================== ==============================================================================
A minimalist Vim plugin manager. A minimalist Vim plugin manager.
https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif
PROS. *plug-pros*
==============================================================================
- Minimalist design < Pros. >_____________________________________________________________________~
- Just one file with no dependencies. Super easy to set up. *plug-pros*
- Concise, intuitive syntax that you can learn within minutes. No
boilerplate code required. - Easier to setup: Single file. No boilerplate code required.
- No feature bloat - Easier to use: Concise, intuitive syntax
- Extremely stable with flawless backward compatibility - {Super-fast}{1} parallel installation/update (with any of `+job`, `+python`,
- Works perfectly with all versions of Vim since 2006 and all versions of `+python3`, `+ruby`, or {Neovim}{2})
Neovim ever released
- {Super-fast}{1} parallel installation/update
- Creates shallow clones to minimize disk space usage and download time - Creates shallow clones to minimize disk space usage and download time
- On-demand loading for {faster startup time}{2} - On-demand loading for {faster startup time}{3}
- Can review and rollback updates - Can review and rollback updates
- Branch/tag/commit support - Branch/tag/commit support
- Post-update hooks - Post-update hooks
- Support for externally managed plugins - Support for externally managed plugins
{1} https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif {1} https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
{2} https://github.com/junegunn/vim-startuptime-benchmark#result {2} http://neovim.org/
{3} https://github.com/junegunn/vim-startuptime-benchmark#result
INSTALLATION *plug-installation* < Installation >______________________________________________________________~
============================================================================== *plug-installation*
{Download plug.vim}{3} and put it in the "autoload" directory. {Download plug.vim}{4} and put it in the "autoload" directory.
{3} https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim {4} https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
USAGE *plug-usage* Vim~
============================================================================== *plug-vim*
Add a vim-plug section to your `~/.vimrc` (or `init.vim` for Neovim)
>> Unix~
>
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
<
You can automate the process by putting the command in your Vim configuration
file as suggested {here}{5}.
{5} https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
>> Windows (PowerShell)~
>
md ~\vimfiles\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile(
$uri,
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"~\vimfiles\autoload\plug.vim"
)
)
<
Neovim~
*plug-neovim*
>> Unix~
>
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
<
>> Windows (PowerShell)~
>
md ~\AppData\Local\nvim\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile(
$uri,
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"~\AppData\Local\nvim\autoload\plug.vim"
)
)
<
< Getting Help >______________________________________________________________~
*plug-getting-help*
- See {tutorial}{6} page to learn the basics of vim-plug
- See {tips}{7} and {FAQ}{8} pages for common problems and questions
- See {requirements}{9} page for debugging information & tested configurations
- Create an {issue}{10}
{6} https://github.com/junegunn/vim-plug/wiki/tutorial
{7} https://github.com/junegunn/vim-plug/wiki/tips
{8} https://github.com/junegunn/vim-plug/wiki/faq
{9} https://github.com/junegunn/vim-plug/wiki/requirements
{10} https://github.com/junegunn/vim-plug/issues/new
< Usage >_____________________________________________________________________~
*plug-usage*
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for
Neovim):
*plug#begin* *plug#end* *plug#begin* *plug#end*
1. Begin the section with `callplug#begin()` 1. Begin the section with `callplug#begin()`
2. List the plugins with `Plug` commands 2. List the plugins with `Plug` commands
3. End the section with `callplug#end()` 3. `callplug#end()` to update 'runtimepath' and initialize plugin system
- Automatically executes `filetypepluginindenton` and `syntaxenable`.
You can revert the settings after the call. e.g. `filetypeindentoff`,
`syntaxoff`, etc.
For example,
Example~
*plug-example*
> >
call plug#begin() " Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" List your plugins here " - Avoid using standard Vim directory names like 'plugin'
Plug 'tpope/vim-sensible' call plug#begin('~/.vim/plugged')
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.
< Getting Help >______________________________________________________________~
*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
EXAMPLES *plug-examples*
==============================================================================
The following examples demonstrate the additional features of vim-plug.
< Vim script example >________________________________________________________~
*plug-vim-script-example*
>
call plug#begin()
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" - Vim (Windows): '~/vimfiles/plugged'
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes " Make sure you use single quotes
" Shorthand notation for GitHub; translates to https://github.com/junegunn/seoul256.vim.git " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/seoul256.vim' Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed " Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-easy-align.git' Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above) " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' } Plug 'fatih/vim-go', { 'tag': '*' }
" Using a non-default branch " Plugin options
Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Use 'dir' option to install plugin in a non-default directory " Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf' }
" Post-update hook: run a shell command after installing or updating the plugin
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Post-update hook can be a lambda expression
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
" If the vim plugin is in a subdirectory, use 'rtp' option to specify its path
Plug 'nsf/gocode', { 'rtp': 'vim' }
" On-demand loading: loaded when the specified command is executed
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
" On-demand loading: loaded when a file with a specific file type is opened
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'
" Call plug#end to update &runtimepath and initialize the plugin system. " Initialize plugin system
" - 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:
" filetype indent off " Disable file-type-specific indentation
" syntax off " Disable syntax highlighting
" Color schemes should be loaded after plug#end().
" We prepend it with 'silent!' to ignore errors when it's not yet installed.
silent! colorscheme seoul256
< <
*:PlugInstall*
< Lua example for Neovim >____________________________________________________~ Reload .vimrc and `:PlugInstall` to install plugins.
*plug-lua-example-for-neovim*
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 Vim script
example above.
>
local vim = vim
local Plug = vim.fn['plug#']
vim.call('plug#begin') < Commands >__________________________________________________________________~
*plug-commands*
-- Shorthand notation for GitHub; translates to https://github.com/junegunn/seoul256.vim.git ------------------------------------+-------------------------------------------------------------------
Plug('junegunn/seoul256.vim') Command | Description ~
------------------------------------+-------------------------------------------------------------------
-- Any valid git URL is allowed `PlugInstall[name...][#threads]` | Install plugins
Plug('https://github.com/junegunn/vim-easy-align.git') `PlugUpdate[name...][#threads]` | Install or update plugins
`PlugClean[!]` | Remove unused directories (bang version will clean without prompt)
-- Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug('fatih/vim-go', { ['tag'] = '*' })
-- Using a non-default branch
Plug('neoclide/coc.nvim', { ['branch'] = 'release' })
-- Use 'dir' option to install plugin in a non-default directory
Plug('junegunn/fzf', { ['dir'] = '~/.fzf' })
-- Post-update hook: run a shell command after installing or updating the plugin
Plug('junegunn/fzf', { ['dir'] = '~/.fzf', ['do'] = './install --all' })
-- Post-update hook can be a lambda expression
Plug('junegunn/fzf', { ['do'] = function()
vim.fn['fzf#install']()
end })
-- If the vim plugin is in a subdirectory, use 'rtp' option to specify its path
Plug('nsf/gocode', { ['rtp'] = 'vim' })
-- On-demand loading: loaded when the specified command is executed
Plug('preservim/nerdtree', { ['on'] = 'NERDTreeToggle' })
-- On-demand loading: loaded when a file with a specific file type is opened
Plug('tpope/vim-fireplace', { ['for'] = 'clojure' })
-- Unmanaged plugin (manually installed and updated)
Plug('~/my-prototype-plugin')
vim.call('plug#end')
-- Color schemes should be loaded after plug#end().
-- We prepend it with 'silent!' to ignore errors when it's not yet installed.
vim.cmd('silent! colorscheme seoul256')
<
COMMANDS *plug-commands*
==============================================================================
-------------------------------------+------------------------------------------------------------------
Command | Description ~
-------------------------------------+------------------------------------------------------------------
`PlugInstall [name ...] [#threads]` | Install plugins
`PlugUpdate [name ...] [#threads]` | Install or update plugins
`PlugClean[!]` | Remove unlisted plugins (bang version will clean without prompt)
`PlugUpgrade` | Upgrade vim-plug itself `PlugUpgrade` | Upgrade vim-plug itself
`PlugStatus` | Check the status of plugins `PlugStatus` | Check the status of plugins
`PlugDiff` | Examine changes from the previous update and the pending changes `PlugDiff` | Examine changes from the previous update and the pending changes
`PlugSnapshot[!] [output path]` | Generate script for restoring the current snapshot of the plugins `PlugSnapshot[!][outputpath]` | Generate script for restoring the current snapshot of the plugins
-------------------------------------+------------------------------------------------------------------ ------------------------------------+-------------------------------------------------------------------
PLUG OPTIONS *plug-options* < Plug options >______________________________________________________________~
============================================================================== *plug-options*
*<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
`dir` | Custom directory for the plugin `dir` | Custom directory for the plugin
@ -251,12 +215,12 @@ PLUG OPTIONS *plug-options*
`do` | Post-update hook (string or funcref) `do` | Post-update hook (string or funcref)
`on` | On-demand loading: Commands or <Plug>-mappings `on` | On-demand loading: Commands or <Plug>-mappings
`for` | On-demand loading: File types `for` | On-demand loading: File types
`frozen` | Do not remove and do not update unless explicitly specified `frozen` | Do not update unless explicitly specified
------------------------+------------------------------------------------------------ ------------------------+-----------------------------------------------
GLOBAL OPTIONS *plug-global-options* < Global options >____________________________________________________________~
============================================================================== *plug-global-options*
*g:plug_threads* *g:plug_timeout* *g:plug_retries* *g:plug_shallow* *g:plug_window* *g:plug_threads* *g:plug_timeout* *g:plug_retries* *g:plug_shallow* *g:plug_window*
*g:plug_pwindow* *g:plug_url_format* *g:plug_pwindow* *g:plug_url_format*
@ -268,14 +232,16 @@ GLOBAL OPTIONS *plug-global-options*
`g:plug_timeout` | 60 | Time limit of each task in seconds (Ruby & Python) `g:plug_timeout` | 60 | Time limit of each task in seconds (Ruby & Python)
`g:plug_retries` | 2 | Number of retries in case of timeout (Ruby & Python) `g:plug_retries` | 2 | Number of retries in case of timeout (Ruby & Python)
`g:plug_shallow` | 1 | Use shallow clone `g:plug_shallow` | 1 | Use shallow clone
`g:plug_window` | `-tabnew` | Command to open plug window `g:plug_window` | `verticaltopleftnew` | Command to open plug window
`g:plug_pwindow` | `vertical rightbelow new` | Command to open preview window in `PlugDiff` `g:plug_pwindow` | `above12new` | Command to open preview window in `PlugDiff`
`g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands) `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands)
--------------------+-----------------------------------+----------------------------------------------------------------------------------- --------------------+-----------------------------------+-----------------------------------------------------------------------------------
KEYBINDINGS *plug-keybindings* < Keybindings >_______________________________________________________________~
============================================================================== *plug-keybindings*
*:PlugStatus* *:PlugDiff*
- `D` - `PlugDiff` - `D` - `PlugDiff`
- `S` - `PlugStatus` - `S` - `PlugStatus`
@ -288,75 +254,19 @@ KEYBINDINGS *plug-keybindings*
- `X` - Revert the update - `X` - Revert the update
POST-UPDATE HOOKS *plug-post-update-hooks* < Example: A small sensible Vim configuration >_______________________________~
============================================================================== *plug-example-a-small-sensible-vim-configuration*
There are some plugins that require extra steps after installation or update.
In that case, use the `do` option to describe the task to be performed.
> >
Plug 'Shougo/vimproc.vim', { 'do': 'make' } call plug#begin()
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' } Plug 'tpope/vim-sensible'
< call plug#end()
If the value starts with `:`, it will be recognized as a Vim command.
>
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
takes a dictionary argument.
>
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force
!./install.py
endif
endfunction
Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
<
A post-update hook is executed inside the directory of the plugin and only run
when the repository has changed, but you can force it to run unconditionally
with the bang-versions of the commands: `PlugInstall!` and `PlugUpdate!`.
[!TIP] 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 the trailing comment.
>
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
<
But you can avoid the escaping if you extract the inline specification using a
variable (or any Vim script expression) as follows:
>
let g:fzf_install = 'yes | ./install'
Plug 'junegunn/fzf', { 'do': g:fzf_install }
< <
< PlugInstall! and PlugUpdate! >______________________________________________~ < On-demand loading of plugins >______________________________________________~
*pluginstall-and-plugupdate* *plug-on-demand-loading-of-plugins*
The installer takes the following steps when installing/updating a plugin:
1. `git clone` or `git fetch` from its origin
2. Check out branch, tag, or commit and optionally `git merge` remote branch
3. If the plugin was updated (or installed for the first time)
1. Update submodules
2. Execute post-update hooks
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 " NERD tree will be loaded on the first invocation of NERDTreeToggle command
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Multiple commands " Multiple commands
Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] } Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
@ -374,55 +284,93 @@ ON-DEMAND LOADING OF PLUGINS *plug-on-demand-loading-of-plugins*
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!'
< <
[!NOTE] #### Should I set up on-demand loading? `for` option is generally not needed as most plugins for specific file types
usually don't have too much code in `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 < Post-update hooks >_________________________________________________________~
from a plugin manager (`:helpautoload`). So there are few cases where these *plug-post-update-hooks*
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 There are some plugins that require extra steps after installation or update.
less than 2 or 3ms on modern computers. So unless you use a very large number In that case, use `do` option to describe the task to be performed.
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 Plug 'Shougo/vimproc.vim', { 'do': 'make' }
Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
< <
On-demand loading should only be used as a last resort. It is basically a If the value starts with `:`, it will be recognized as a Vim command.
hacky workaround and is not always guaranteed to work.
*plug#load* *:GoInstallBinaries*
>
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
<
If you need more control, you can pass a reference to a Vim function that
takes a single argument.
>
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force
!./install.py
endif
endfunction
[!TIP] You can pass an empty list to `on` or `for` option to disable the Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
loading of the plugin. You can manually load the plugin using <
`plug#load(NAMES...)` function. Both forms of post-update hook are executed inside the directory of the plugin
and only run when the repository has changed, but you can force it to run
unconditionally with the bang-versions of the commands: `PlugInstall!` and
`PlugUpdate!`.
See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually Make sure to escape BARs and double-quotes when you write `do` option inline
as they are mistakenly recognized as command separator or the start of the
trailing comment.
>
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
<
But you can avoid the escaping if you extract the inline specification using a
variable (or any Vimscript expression) as follows:
*g:fzf_install*
>
let g:fzf_install = 'yes | ./install'
Plug 'junegunn/fzf', { 'do': g:fzf_install }
<
< PlugInstall! and PlugUpdate! >______________________________________________~
*pluginstall-and-plugupdate*
The installer takes the following steps when installing/updating a plugin:
1. `gitclone` or `gitfetch` from its origin
2. Check out branch, tag, or commit and optionally `gitmerge` remote branch
3. If the plugin was updated (or installed for the first time)
1. Update submodules
2. Execute post-update hooks
The commands with `!` suffix ensure that all steps are run unconditionally.
COLLABORATORS *plug-collaborators* < Articles >__________________________________________________________________~
============================================================================== *plug-articles*
- {Jan Edmund Lazo}{7} - Windows support - {Writing my own Vim plugin manager}{11}
- {Jeremy Pallats}{8} - Python installer - {Vim plugins and startup time}{12}
- ~~{Thoughts on Vim plugin dependency}{13}~~
- Support for Plugfile has been removed since 0.5.0
{7} https://github.com/janlazo {11} http://junegunn.kr/2013/09/writing-my-own-vim-plugin-manager
{8} https://github.com/starcraftman {12} http://junegunn.kr/2014/07/vim-plugins-and-startup-time
{13} http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency
LICENSE *plug-license* < License >___________________________________________________________________~
============================================================================== *plug-license*
MIT MIT
============================================================================== ==============================================================================
vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap: vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

767
plug.vim

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +0,0 @@
Execute (plug#shellescape() works without optional arguments):
if has('unix')
AssertEqual "''", plug#shellescape("")
AssertEqual "'foo'\\'''", plug#shellescape("foo'")
endif
Execute (plug#shellescape() ignores invalid optional argument):
if has('unix')
AssertEqual "''", plug#shellescape("", '')
AssertEqual "'foo'\\'''", plug#shellescape("foo'", [])
endif
Execute (plug#shellescape() depends on the shell):
AssertEqual "'foo'\\'''", plug#shellescape("foo'", {'shell': 'sh'})
AssertEqual '^"foo''^"', plug#shellescape("foo'", {'shell': 'cmd.exe'})
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'powershell'})
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'powershell.exe'})
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'pwsh'})
Execute (plug#shellescape() supports non-trivial cmd.exe escaping):
" batchfile
AssertEqual '^"^^%%PATH^^%%^"', plug#shellescape("^%PATH^%", {
\ 'shell': 'cmd.exe',
\ })
AssertEqual '^"^^%%PATH^^%%^"', plug#shellescape("^%PATH^%", {
\ 'shell': 'cmd.exe',
\ 'script': 1,
\ })
" command prompt
AssertEqual '^"^^^%PATH^^^%^"', plug#shellescape("^%PATH^%", {
\ 'shell': 'cmd.exe',
\ 'script': 0,
\ }),
Execute (plug#shellescape() supports non-trivial powershell.exe escaping):
AssertEqual '''\"Foo\\''''\\Bar\"''', plug#shellescape('"Foo\''\Bar"', {
\ 'shell': 'powershell',
\ }),
AssertEqual '''\"Foo\\''''\\Bar\"''', plug#shellescape('"Foo\''\Bar"', {
\ 'shell': 'powershell.exe',
\ }),

View File

@ -62,7 +62,7 @@ EOF
gitinit() ( gitinit() (
cd "$PLUG_FIXTURES/$1" cd "$PLUG_FIXTURES/$1"
git init -b master git init
git commit -m 'commit' --allow-empty git commit -m 'commit' --allow-empty
) )
@ -91,14 +91,9 @@ DOC
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim" echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim" echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
chmod +w "$PLUG_FIXTURES/cant-delete/autoload" || rm -rf "$PLUG_FIXTURES/cant-delete"
mkdir -p "$PLUG_FIXTURES/cant-delete/autoload"
touch "$PLUG_FIXTURES/cant-delete/autoload/cant-delete.vim"
chmod -w "$PLUG_FIXTURES/cant-delete/autoload"
rm -rf $TEMP/new-branch rm -rf $TEMP/new-branch
cd $TEMP cd $TEMP
git init new-branch -b master git init new-branch
cd new-branch cd new-branch
mkdir plugin mkdir plugin
echo 'let g:foo = 1' > plugin/foo.vim echo 'let g:foo = 1' > plugin/foo.vim
@ -127,11 +122,9 @@ git --version
vim=$(select_vim) vim=$(select_vim)
echo "Selected Vim: $vim" echo "Selected Vim: $vim"
if [ "${1:-}" = '!' ]; then if [ "${1:-}" = '!' ]; then
FAIL=0 $vim -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
$vim -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null || FAIL=1 prepare &&
prepare $vim -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
$vim -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null || FAIL=1
test $FAIL -eq 0
else else
$vim -Nu $TEMP/mini-vimrc -c 'Vader test.vader' $vim -Nu $TEMP/mini-vimrc -c 'Vader test.vader'
fi fi

View File

@ -18,6 +18,10 @@ Execute (Initialize test environment):
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction', \ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction',
\ 'function! CompareURI(a, b)', 'return s:compare_git_uri(a:a, a:b)', 'endfunction'] \ 'function! CompareURI(a, b)', 'return s:compare_git_uri(a:a, a:b)', 'endfunction']
if $ENV != 'vim8'
call add(patch, 'let s:vim8 = 0')
endif
call writefile(extend(readfile($PLUG_TMP), patch), $PLUG_TMP) call writefile(extend(readfile($PLUG_TMP), patch), $PLUG_TMP)
set t_Co=256 set t_Co=256
@ -86,7 +90,6 @@ Execute (Print Interpreter Version):
Include: workflow.vader Include: workflow.vader
Include: regressions.vader Include: regressions.vader
Include: functional.vader
Execute (Cleanup): Execute (Cleanup):
silent! call RmRf(g:temp_plugged) silent! call RmRf(g:temp_plugged)

View File

@ -2,7 +2,7 @@ Execute (plug#end() before plug#begin() should fail):
redir => out redir => out
silent! AssertEqual 0, plug#end() silent! AssertEqual 0, plug#end()
redir END redir END
Assert stridx(out, 'plug#end() called without calling plug#begin() first') >= 0 Assert stridx(out, 'Call plug#begin() first') >= 0
Execute (plug#begin() without path argument): Execute (plug#begin() without path argument):
call plug#begin() call plug#begin()
@ -49,32 +49,24 @@ Execute (Test Plug command):
AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
^ Git repo with tag (DEPRECATED. USE TAG OPTION) ^ Git repo with tag (DEPRECATED. USE TAG OPTION)
redir => out
silent Plug 'foo/bar.vim', ''
redir END
Assert out =~ 'Invalid argument for "tag" option of :Plug (expected: string)'
Plug 'junegunn/goyo.vim', '1.5.2' Plug 'junegunn/goyo.vim', '1.5.2'
AssertEqual 'file:///tmp/vim-plug-test/junegunn/goyo.vim', g:plugs['goyo.vim'].uri AssertEqual 'file:///tmp/vim-plug-test/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
AssertEqual '1.5.2', g:plugs['goyo.vim'].tag AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
redir => out
silent Plug 'foo/bar.vim', {'tag': ''}
redir END
Assert out =~ 'Invalid argument for "tag" option of :Plug (expected: string)'
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
AssertEqual '1.5.3', g:plugs['goyo.vim'].tag AssertEqual '1.5.3', g:plugs['goyo.vim'].tag
" Git URI " Git URI
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji' Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
AssertEqual 'file:///tmp/vim-plug-test/jg/vim-emoji', g:plugs['vim-emoji'].uri AssertEqual 'file:///tmp/vim-plug-test/jg/vim-emoji', g:plugs['vim-emoji'].uri
AssertEqual '', g:plugs['vim-emoji'].branch AssertEqual 'master', g:plugs['vim-emoji'].branch
AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
" vim-scripts/ " vim-scripts/
Plug 'vim-scripts/beauty256' Plug 'vim-scripts/beauty256'
AssertEqual 'file:///tmp/vim-plug-test/vim-scripts/beauty256', g:plugs.beauty256.uri AssertEqual 'file:///tmp/vim-plug-test/vim-scripts/beauty256', g:plugs.beauty256.uri
AssertEqual '', g:plugs.beauty256.branch AssertEqual 'master', g:plugs.beauty256.branch
AssertEqual 4, len(g:plugs) AssertEqual 4, len(g:plugs)
@ -85,26 +77,6 @@ Execute (Test Plug command):
Execute (Plug command with dictionary option): Execute (Plug command with dictionary option):
Log string(g:plugs) Log string(g:plugs)
for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as']
let opts = {}
let opts[opt] = ''
redir => out
silent Plug 'foo/bar.vim', opts
redir END
Assert out =~ 'Invalid argument for "'.opt.'" option of :Plug (expected: string)'
endfor
for opt in ['on', 'for']
let opts = {}
let opts[opt] = ''
redir => out
silent Plug 'foo/bar.vim', opts
redir END
Assert out =~ 'Invalid argument for "'.opt.'" option of :Plug (expected: string or list)'
endfor
redir => out
silent Plug 'foo/bar.vim', {'do': ''}
redir END
Assert out =~ 'Invalid argument for "do" option of :Plug (expected: string or funcref)'
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' } Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual '././', g:plugs['seoul256.vim'].rtp AssertEqual '././', g:plugs['seoul256.vim'].rtp
@ -371,9 +343,6 @@ Execute (PlugDiff - 'No updates.'):
q q
Execute (New commits on remote, PlugUpdate, then PlugDiff): Execute (New commits on remote, PlugUpdate, then PlugDiff):
let g:plug_window = 'vertical topleft new'
let g:plug_pwindow = 'above 12new'
for repo in ['seoul256.vim', 'vim-emoji'] for repo in ['seoul256.vim', 'vim-emoji']
for _ in range(2) for _ in range(2)
call system(printf('cd /tmp/vim-plug-test/junegunn/%s && git commit --allow-empty -m "update"', repo)) call system(printf('cd /tmp/vim-plug-test/junegunn/%s && git commit --allow-empty -m "update"', repo))
@ -385,7 +354,6 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
" Now we have updates " Now we have updates
normal D normal D
AssertEqual '2 plugin(s) updated.', getline(1) AssertEqual '2 plugin(s) updated.', getline(1)
AssertThrows execute('/gpg')
" Preview commit " Preview commit
silent! wincmd P silent! wincmd P
@ -396,14 +364,6 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
let lnum = line('.') let lnum = line('.')
AssertEqual 3, col('.') AssertEqual 3, col('.')
" Open full diff (empty)
execute "normal \<cr>"
wincmd P
AssertEqual 1, &previewwindow
AssertEqual 'git', &filetype
AssertEqual [''], getline(1, '$')
pclose
" Open commit preview " Open commit preview
execute "normal j\<cr>" execute "normal j\<cr>"
wincmd P wincmd P
@ -439,17 +399,13 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
execute "normal Xy\<cr>" execute "normal Xy\<cr>"
AssertExpect '^- ', 1 AssertExpect '^- ', 1
" q will only close preview window " q will close preview window as well
normal q normal q
" We no longer have preview window " We no longer have preview window
silent! wincmd P silent! wincmd P
AssertEqual 0, &previewwindow AssertEqual 0, &previewwindow
" And we're still on main vim-plug window
AssertEqual 'vim-plug', &filetype
normal q
" q should not close preview window if it's already open " q should not close preview window if it's already open
pedit pedit
PlugDiff PlugDiff
@ -461,8 +417,6 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
AssertEqual 1, &previewwindow AssertEqual 1, &previewwindow
pclose pclose
unlet g:plug_window g:plug_pwindow
Execute (Test g:plug_pwindow): Execute (Test g:plug_pwindow):
let g:plug_pwindow = 'below 5new' let g:plug_pwindow = 'below 5new'
PlugDiff PlugDiff
@ -476,11 +430,6 @@ Execute (Test g:plug_pwindow):
AssertEqual 2, winnr() AssertEqual 2, winnr()
AssertEqual 5, winheight('.') AssertEqual 5, winheight('.')
wincmd p wincmd p
" Close preview window
normal q
" Close main window
normal q normal q
unlet g:plug_pwindow unlet g:plug_pwindow
@ -588,51 +537,6 @@ Execute (PlugDiff):
Assert !empty(mapcheck("\<cr>")) Assert !empty(mapcheck("\<cr>"))
q q
Execute (Do not show diff for commits outside of rtp):
call plug#begin()
call plug#end()
PlugClean!
call plug#begin()
Plug 'file://'.expand('$PLUG_FIXTURES').'/xxx'
Plug 'file://'.expand('$PLUG_FIXTURES').'/yyy', { 'rtp': 'rtp' }
call plug#end()
PlugInstall
Log getline(1, '$')
call system('cd "$PLUG_FIXTURES/xxx" && git commit --allow-empty -m update-xxx && git tag -f xxx')
call system('cd "$PLUG_FIXTURES/yyy" && git commit --allow-empty -m update-yyy && git tag -f yyy')
let g:plugs.yyy.tag = 'yyy'
PlugUpdate
Log getline(1, '$')
PlugDiff
" 1 plugin(s) updated.
" [==]
"
" Last update:
" ------------
"
" - xxx:
" * 7faa9b2 update-xxx (0 seconds ago)
"
" Pending updates:
" ----------------
"
" N/A
"
Log getline(1, '$')
AssertEqual 14, line('$')
AssertEqual '1 plugin(s) updated.', getline(1)
AssertEqual '[==]', getline(2)
AssertEqual 'Last update:', getline(4)
AssertEqual '- xxx:', getline(7)
Assert !empty(mapcheck('o'))
Assert !empty(mapcheck('X'))
Assert !empty(mapcheck("\<cr>"))
q
********************************************************************** **********************************************************************
~ On-demand loading / Partial installation/update ~ ~ On-demand loading / Partial installation/update ~
********************************************************************** **********************************************************************
@ -804,14 +708,6 @@ Execute (Check &rtp after SomeCommand):
AssertEqual g:first_rtp, split(&rtp, ',')[0] AssertEqual g:first_rtp, split(&rtp, ',')[0]
AssertEqual g:last_rtp, split(&rtp, ',')[-1] AssertEqual g:last_rtp, split(&rtp, ',')[-1]
Execute (PlugClean should not care about frozen plugins):
call plug#begin()
Plug 'xxx/vim-easy-align', { 'frozen': 1 }
call plug#end()
PlugClean
AssertExpect 'Already clean', 1
q
Execute (Common parent): Execute (Common parent):
call plug#begin() call plug#begin()
Plug 'junegunn/vim-pseudocl' Plug 'junegunn/vim-pseudocl'
@ -996,8 +892,7 @@ Execute (PlugInstall!):
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed2'), Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
\ 'vim-easy-align/installed2 should exist' \ 'vim-easy-align/installed2 should exist'
AssertEqual '7f8cd78cb1fe52185b98b16a3749811f0cc508af', GitCommit('vim-pseudocl') AssertEqual '7f8cd78cb1fe52185b98b16a3749811f0cc508af', GitCommit('vim-pseudocl')
" Was updated to the default branch of origin by previous PlugUpdate AssertEqual 'no-t_co', GitBranch('seoul256.vim')
AssertEqual 'master', GitBranch('seoul256.vim')
AssertEqual '1.5.3', GitTag('goyo.vim') AssertEqual '1.5.3', GitTag('goyo.vim')
Execute (When submodules are not initialized): Execute (When submodules are not initialized):
@ -1096,10 +991,9 @@ Execute (Post-update hook output; success and failure):
Execute (Post-update hook output; invalid type or funcref): Execute (Post-update hook output; invalid type or funcref):
call plug#begin() call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': ':echo 1' } Plug 'junegunn/vim-easy-align', { 'do': 1 }
Plug 'junegunn/vim-pseudocl', { 'do': function('call') } Plug 'junegunn/vim-pseudocl', { 'do': function('call') }
call plug#end() call plug#end()
let g:plugs['vim-easy-align'].do = 1
silent PlugInstall! 1 silent PlugInstall! 1
AssertEqual 'x Post-update hook for vim-pseudocl ... Vim(call):E119: Not enough arguments for function: call', getline(5) AssertEqual 'x Post-update hook for vim-pseudocl ... Vim(call):E119: Not enough arguments for function: call', getline(5)
@ -1503,7 +1397,6 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home
Plug '$PLUG_FIXTURES/fzf' Plug '$PLUG_FIXTURES/fzf'
Plug '$PLUG_FIXTURES/xxx' Plug '$PLUG_FIXTURES/xxx'
Plug '$PLUG_FIXTURES/yyy' Plug '$PLUG_FIXTURES/yyy'
Plug '$PLUG_FIXTURES/cant-delete'
call plug#end() call plug#end()
" Remove z1, z2 " Remove z1, z2
@ -1642,12 +1535,10 @@ Execute (Commit hash support):
Assert empty(mapcheck('X')) Assert empty(mapcheck('X'))
Assert !empty(mapcheck("\<cr>")) Assert !empty(mapcheck("\<cr>"))
" The exact hash values in PlugSnapshot output " Nor in PlugSnapshot output
PlugSnapshot PlugSnapshot
Log getline(1, '$') Log getline(1, '$')
AssertEqual "silent! let g:plugs['goyo.vim'].commit = 'ffffffff'", getline(6) AssertEqual 8, line('$')
AssertEqual "silent! let g:plugs['vim-emoji'].commit = '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a'", getline(7)
AssertEqual 10, line('$')
q q
Execute (Commit hash support - cleared): Execute (Commit hash support - cleared):
@ -1722,8 +1613,6 @@ Execute (#530 - Comparison of incompatible git URIs):
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com:12345/junegunn/vim-plug.git') Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com:12345/junegunn/vim-plug.git')
Execute (#532 - Reuse plug window): Execute (#532 - Reuse plug window):
let g:plug_window = 'vertical topleft new'
let g:plug_pwindow = 'above 12new'
call plug#begin() call plug#begin()
Plug 'junegunn/goyo.vim' Plug 'junegunn/goyo.vim'
call plug#end() call plug#end()
@ -1750,8 +1639,6 @@ Execute (#532 - Reuse plug window):
AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')' AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')'
q q
unlet g:plug_window g:plug_pwindow
Execute (#766 - Allow cloning into an empty directory): Execute (#766 - Allow cloning into an empty directory):
let d = '/tmp/vim-plug-test/goyo-already' let d = '/tmp/vim-plug-test/goyo-already'
call system('rm -rf ' . d) call system('rm -rf ' . d)
@ -1763,25 +1650,3 @@ Execute (#766 - Allow cloning into an empty directory):
AssertExpect! '[=]', 1 AssertExpect! '[=]', 1
q q
unlet d unlet d
Execute (#982 - PlugClean should report when directories cannot be removed):
call plug#begin('$PLUG_FIXTURES')
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': [] }
Plug '$PLUG_FIXTURES/fzf'
Plug '$PLUG_FIXTURES/xxx'
Plug '$PLUG_FIXTURES/yyy'
call plug#end()
" Fail to remove cant-delete
PlugClean!
AssertEqual 'Removed 0 directories. Failed to remove 1 directories.', getline(4)
AssertExpect '^x ', 1
q
" Delete tmp but fail to remove cant-delete
call mkdir(expand('$PLUG_FIXTURES/tmp'))
PlugClean!
AssertEqual 'Removed 1 directories. Failed to remove 1 directories.', getline(4)
AssertExpect '^x ', 1
AssertExpect '^\~ ', 1
q