Compare commits
No commits in common. "master" and "0.11.0" have entirely different histories.
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
|
@ -1 +0,0 @@
|
||||||
github: junegunn
|
|
9
.github/ISSUE_TEMPLATE.md
vendored
9
.github/ISSUE_TEMPLATE.md
vendored
|
@ -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
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
doc/tags
|
|
446
README.md
446
README.md
|
@ -1,44 +1,16 @@
|
||||||
<div align="center">
|
<img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="75" alt="vim-plug">[](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
|
- Easy to set up: Single file. No boilerplate code required.
|
||||||
- Just one file with no dependencies. Super easy to set up.
|
- Easy 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,94 +41,59 @@ 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 |`
|
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
|
||||||
ni $HOME/vimfiles/autoload/plug.vim -Force
|
ni $HOME/vimfiles/autoload/plug.vim -Force
|
||||||
```
|
```
|
||||||
|
|
||||||
### Neovim
|
#### Neovim
|
||||||
|
|
||||||
#### Unix, Linux
|
###### Unix, Linux
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/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'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Linux (Flatpak)
|
###### Linux (Flatpak)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -fLo ~/.var/app/io.neovim.nvim/data/nvim/site/autoload/plug.vim --create-dirs \
|
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 |`
|
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
|
||||||
```
|
```
|
||||||
|
|
||||||
</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 `stdpath('config') . '/init.vim'` for Neovim)
|
||||||
|
|
||||||
### Vim script example
|
1. Begin the section with `call plug#begin([PLUGIN_DIR])`
|
||||||
|
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()
|
call plug#begin()
|
||||||
|
@ -172,131 +107,66 @@ call plug#begin()
|
||||||
|
|
||||||
" 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-default 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 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[!] [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 +174,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 +222,88 @@ 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]
|
The `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 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 (`: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 the `do` option to describe the task to be performed.
|
||||||
|
|
||||||
## Collaborators
|
```vim
|
||||||
|
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
|
||||||
|
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
|
||||||
|
```
|
||||||
|
|
||||||
|
If the value starts with `:`, it will be recognized as a Vim command.
|
||||||
|
|
||||||
|
```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 'ycm-core/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 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 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 the `!` 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*
|
||||||
|
|
||||||
|
### Collaborators
|
||||||
|
|
||||||
- [Jan Edmund Lazo](https://github.com/janlazo) - Windows support
|
- [Jan Edmund Lazo](https://github.com/janlazo) - Windows support
|
||||||
- [Jeremy Pallats](https://github.com/starcraftman) - Python installer
|
- [Jeremy Pallats](https://github.com/starcraftman) - Python installer
|
||||||
|
|
||||||
## License
|
### License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|
497
doc/plug.txt
497
doc/plug.txt
|
@ -1,114 +1,136 @@
|
||||||
plug.txt plug Last change: Jun 1 2024
|
plug.txt plug Last change: January 3 2022
|
||||||
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
|
||||||
|
Collaborators
|
||||||
|
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.
|
- Easy to set up: Single file. No boilerplate code required.
|
||||||
- No feature bloat
|
- Easy 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)
|
|
||||||
|
|
||||||
*plug#begin* *plug#end*
|
>> Unix~
|
||||||
|
|
||||||
1. Begin the section with `call plug#begin()`
|
|
||||||
2. List the plugins with `Plug` commands
|
|
||||||
3. End the section with `call plug#end()`
|
|
||||||
|
|
||||||
For example,
|
|
||||||
>
|
>
|
||||||
call plug#begin()
|
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||||
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
" List your plugins here
|
|
||||||
Plug 'tpope/vim-sensible'
|
|
||||||
|
|
||||||
call plug#end()
|
|
||||||
<
|
<
|
||||||
Reload the file or restart Vim, then you can,
|
You can automate the process by putting the command in your Vim configuration
|
||||||
|
file as suggested {here}{5}.
|
||||||
|
|
||||||
*:PlugInstall* *:PlugUpdate* *:PlugDiff*
|
{5} https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
|
||||||
|
|
||||||
- `: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
|
>> Windows (PowerShell)~
|
||||||
document is for advanced users who want to know more about the features and
|
>
|
||||||
options.
|
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
|
||||||
|
ni $HOME/vimfiles/autoload/plug.vim -Force
|
||||||
|
<
|
||||||
|
|
||||||
|
Neovim~
|
||||||
|
*plug-neovim*
|
||||||
|
|
||||||
|
|
||||||
|
>> Unix~
|
||||||
|
>
|
||||||
|
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
||||||
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||||
|
<
|
||||||
|
|
||||||
|
>> Windows (PowerShell)~
|
||||||
|
>
|
||||||
|
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
|
||||||
|
<
|
||||||
|
|
||||||
< Getting Help >______________________________________________________________~
|
< Getting Help >______________________________________________________________~
|
||||||
*plug-getting-help*
|
*plug-getting-help*
|
||||||
|
|
||||||
- See {tutorial}{4} page to learn more about the basics of vim-plug
|
- See {tutorial}{6} page to learn the basics of vim-plug
|
||||||
- See {tips}{5} and {FAQ}{6} pages for common problems and questions
|
- 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}
|
||||||
|
|
||||||
{4} https://github.com/junegunn/vim-plug/wiki/tutorial
|
{6} https://github.com/junegunn/vim-plug/wiki/tutorial
|
||||||
{5} https://github.com/junegunn/vim-plug/wiki/tips
|
{7} https://github.com/junegunn/vim-plug/wiki/tips
|
||||||
{6} https://github.com/junegunn/vim-plug/wiki/faq
|
{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
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES *plug-examples*
|
< Usage >_____________________________________________________________________~
|
||||||
==============================================================================
|
*plug-usage*
|
||||||
|
|
||||||
The following examples demonstrate the additional features of vim-plug.
|
Add a vim-plug section to your `~/.vimrc` (or `stdpath('config') . '/init.vim'` for
|
||||||
|
Neovim)
|
||||||
|
|
||||||
|
*plug#begin* *plug#end*
|
||||||
|
|
||||||
|
1. Begin the section with `call plug#begin([PLUGIN_DIR])`
|
||||||
|
2. List the plugins with `Plug` commands
|
||||||
|
3. `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.
|
||||||
|
|
||||||
|
|
||||||
< Vim script example >________________________________________________________~
|
Example~
|
||||||
*plug-vim-script-example*
|
*plug-example*
|
||||||
>
|
>
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
" The default plugin directory will be as follows:
|
" The default plugin directory will be as follows:
|
||||||
|
@ -121,129 +143,65 @@ The following examples demonstrate the additional features of vim-plug.
|
||||||
|
|
||||||
" 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-default 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
|
||||||
|
|
||||||
-- 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)
|
`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[!] [output path]` | Generate script for restoring the current snapshot of the plugins
|
||||||
-------------------------------------+------------------------------------------------------------------
|
------------------------------------+-------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
PLUG OPTIONS *plug-options*
|
< Plug options >______________________________________________________________~
|
||||||
==============================================================================
|
*plug-options*
|
||||||
|
*:Plug*
|
||||||
|
|
||||||
*<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 +209,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 +226,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` | `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 *plug-keybindings*
|
< Keybindings >_______________________________________________________________~
|
||||||
==============================================================================
|
*plug-keybindings*
|
||||||
|
|
||||||
|
*:PlugStatus* *:PlugDiff*
|
||||||
|
|
||||||
- `D` - `PlugDiff`
|
- `D` - `PlugDiff`
|
||||||
- `S` - `PlugStatus`
|
- `S` - `PlugStatus`
|
||||||
|
@ -288,75 +248,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 +278,104 @@ 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?
|
The `for` option is generally not needed as most plugins for specific file
|
||||||
|
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
|
< Post-update hooks >_________________________________________________________~
|
||||||
from a plugin manager (`:help autoload`). 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 the `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 'ycm-core/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 'ycm-core/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 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 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. `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.
|
||||||
|
|
||||||
|
|
||||||
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*
|
< Collaborators >_____________________________________________________________~
|
||||||
==============================================================================
|
*plug-collaborators*
|
||||||
|
|
||||||
|
- {Jan Edmund Lazo}{14} - Windows support
|
||||||
|
- {Jeremy Pallats}{15} - Python installer
|
||||||
|
|
||||||
|
{14} https://github.com/janlazo
|
||||||
|
{15} https://github.com/starcraftman
|
||||||
|
|
||||||
|
|
||||||
|
< 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:
|
||||||
|
|
BIN
plug-dark.png
BIN
plug-dark.png
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
267
plug.vim
267
plug.vim
|
@ -1,36 +1,67 @@
|
||||||
" vim-plug: Vim plugin manager
|
" vim-plug: Vim plugin manager
|
||||||
" ============================
|
" ============================
|
||||||
"
|
"
|
||||||
" 1. Download plug.vim and put it in 'autoload' directory
|
" Download plug.vim and put it in ~/.vim/autoload
|
||||||
"
|
"
|
||||||
" # Vim
|
|
||||||
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
" curl -fLo ~/.vim/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
|
||||||
"
|
"
|
||||||
" # Neovim
|
" Edit your .vimrc
|
||||||
" sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
|
||||||
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
|
||||||
"
|
"
|
||||||
" 2. Add a vim-plug section to your ~/.vimrc (or ~/.config/nvim/init.vim for Neovim)
|
" call plug#begin('~/.vim/plugged')
|
||||||
"
|
"
|
||||||
" call plug#begin()
|
" " Make sure you use single quotes
|
||||||
"
|
"
|
||||||
" " List your plugins here
|
" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
|
||||||
" Plug 'tpope/vim-sensible'
|
" Plug 'junegunn/vim-easy-align'
|
||||||
"
|
"
|
||||||
|
" " Any valid git URL is allowed
|
||||||
|
" 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-default branch
|
||||||
|
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
|
||||||
|
"
|
||||||
|
" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
|
||||||
|
" Plug 'fatih/vim-go', { 'tag': '*' }
|
||||||
|
"
|
||||||
|
" " Plugin options
|
||||||
|
" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
|
||||||
|
"
|
||||||
|
" " Plugin outside ~/.vim/plugged with post-update hook
|
||||||
|
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||||
|
"
|
||||||
|
" " Unmanaged plugin (manually installed and updated)
|
||||||
|
" Plug '~/my-prototype-plugin'
|
||||||
|
"
|
||||||
|
" " Initialize plugin system
|
||||||
" call plug#end()
|
" call plug#end()
|
||||||
"
|
"
|
||||||
" 3. Reload the file or restart Vim, then you can,
|
" Then reload .vimrc and :PlugInstall to install plugins.
|
||||||
"
|
"
|
||||||
" :PlugInstall to install plugins
|
" Plug options:
|
||||||
" :PlugUpdate to update plugins
|
|
||||||
" :PlugDiff to review the changes from the last update
|
|
||||||
" :PlugClean to remove plugins no longer in the list
|
|
||||||
"
|
"
|
||||||
" For more information, see https://github.com/junegunn/vim-plug
|
"| Option | Description |
|
||||||
|
"| ----------------------- | ------------------------------------------------ |
|
||||||
|
"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
|
||||||
|
"| `rtp` | Subdirectory that contains Vim plugin |
|
||||||
|
"| `dir` | Custom directory for the plugin |
|
||||||
|
"| `as` | Use different name for the plugin |
|
||||||
|
"| `do` | Post-update hook (string or funcref) |
|
||||||
|
"| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
||||||
|
"| `for` | On-demand loading: File types |
|
||||||
|
"| `frozen` | Do not update unless explicitly specified |
|
||||||
|
"
|
||||||
|
" More information: https://github.com/junegunn/vim-plug
|
||||||
"
|
"
|
||||||
"
|
"
|
||||||
" Copyright (c) 2024 Junegunn Choi
|
" Copyright (c) 2017 Junegunn Choi
|
||||||
"
|
"
|
||||||
" MIT License
|
" MIT License
|
||||||
"
|
"
|
||||||
|
@ -207,6 +238,7 @@ endfunction
|
||||||
|
|
||||||
function! plug#begin(...)
|
function! plug#begin(...)
|
||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
|
let s:plug_home_org = a:1
|
||||||
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
|
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
|
||||||
elseif exists('g:plug_home')
|
elseif exists('g:plug_home')
|
||||||
let home = s:path(g:plug_home)
|
let home = s:path(g:plug_home)
|
||||||
|
@ -320,7 +352,7 @@ function! plug#end()
|
||||||
endif
|
endif
|
||||||
let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
|
let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
|
||||||
|
|
||||||
if get(g:, 'did_load_filetypes', 0)
|
if exists('g:did_load_filetypes')
|
||||||
filetype off
|
filetype off
|
||||||
endif
|
endif
|
||||||
for name in g:plugs_order
|
for name in g:plugs_order
|
||||||
|
@ -359,9 +391,6 @@ function! plug#end()
|
||||||
if !empty(types)
|
if !empty(types)
|
||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim')
|
call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim')
|
||||||
if has('nvim-0.5.0')
|
|
||||||
call s:source(s:rtp(plug), 'ftdetect/**/*.lua', 'after/ftdetect/**/*.lua')
|
|
||||||
endif
|
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
for type in types
|
for type in types
|
||||||
|
@ -409,9 +438,6 @@ endfunction
|
||||||
|
|
||||||
function! s:load_plugin(spec)
|
function! s:load_plugin(spec)
|
||||||
call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
|
call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
|
||||||
if has('nvim-0.5.0')
|
|
||||||
call s:source(s:rtp(a:spec), 'plugin/**/*.lua', 'after/plugin/**/*.lua')
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:reload_plugins()
|
function! s:reload_plugins()
|
||||||
|
@ -629,9 +655,6 @@ function! s:lod(names, types, ...)
|
||||||
let rtp = s:rtp(g:plugs[name])
|
let rtp = s:rtp(g:plugs[name])
|
||||||
for dir in a:types
|
for dir in a:types
|
||||||
call s:source(rtp, dir.'/**/*.vim')
|
call s:source(rtp, dir.'/**/*.vim')
|
||||||
if has('nvim-0.5.0') " see neovim#14686
|
|
||||||
call s:source(rtp, dir.'/**/*.lua')
|
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
if a:0
|
if a:0
|
||||||
if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
|
if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
|
||||||
|
@ -783,11 +806,10 @@ endfunction
|
||||||
function! s:syntax()
|
function! s:syntax()
|
||||||
syntax clear
|
syntax clear
|
||||||
syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber
|
syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber
|
||||||
syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX,plugAbort
|
syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX
|
||||||
syn match plugNumber /[0-9]\+[0-9.]*/ contained
|
syn match plugNumber /[0-9]\+[0-9.]*/ contained
|
||||||
syn match plugBracket /[[\]]/ contained
|
syn match plugBracket /[[\]]/ contained
|
||||||
syn match plugX /x/ contained
|
syn match plugX /x/ contained
|
||||||
syn match plugAbort /\~/ contained
|
|
||||||
syn match plugDash /^-\{1}\ /
|
syn match plugDash /^-\{1}\ /
|
||||||
syn match plugPlus /^+/
|
syn match plugPlus /^+/
|
||||||
syn match plugStar /^*/
|
syn match plugStar /^*/
|
||||||
|
@ -812,7 +834,6 @@ function! s:syntax()
|
||||||
hi def link plug2 Repeat
|
hi def link plug2 Repeat
|
||||||
hi def link plugH2 Type
|
hi def link plugH2 Type
|
||||||
hi def link plugX Exception
|
hi def link plugX Exception
|
||||||
hi def link plugAbort Ignore
|
|
||||||
hi def link plugBracket Structure
|
hi def link plugBracket Structure
|
||||||
hi def link plugNumber Number
|
hi def link plugNumber Number
|
||||||
|
|
||||||
|
@ -848,7 +869,7 @@ function! s:lastline(msg)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:new_window()
|
function! s:new_window()
|
||||||
execute get(g:, 'plug_window', '-tabnew')
|
execute get(g:, 'plug_window', 'vertical topleft new')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:plug_window_exists()
|
function! s:plug_window_exists()
|
||||||
|
@ -910,7 +931,7 @@ function! s:prepare(...)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
call s:job_abort(0)
|
call s:job_abort()
|
||||||
if s:switch_in()
|
if s:switch_in()
|
||||||
if b:plug_preview == 1
|
if b:plug_preview == 1
|
||||||
pc
|
pc
|
||||||
|
@ -946,8 +967,6 @@ function! s:close_pane()
|
||||||
if b:plug_preview == 1
|
if b:plug_preview == 1
|
||||||
pc
|
pc
|
||||||
let b:plug_preview = -1
|
let b:plug_preview = -1
|
||||||
elseif exists('s:jobs') && !empty(s:jobs)
|
|
||||||
call s:job_abort(1)
|
|
||||||
else
|
else
|
||||||
bd
|
bd
|
||||||
endif
|
endif
|
||||||
|
@ -1012,11 +1031,6 @@ function! s:is_updated(dir)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:do(pull, force, todo)
|
function! s:do(pull, force, todo)
|
||||||
if has('nvim')
|
|
||||||
" Reset &rtp to invalidate Neovim cache of loaded Lua modules
|
|
||||||
" See https://github.com/junegunn/vim-plug/pull/1157#issuecomment-1809226110
|
|
||||||
let &rtp = &rtp
|
|
||||||
endif
|
|
||||||
for [name, spec] in items(a:todo)
|
for [name, spec] in items(a:todo)
|
||||||
if !isdirectory(spec.dir)
|
if !isdirectory(spec.dir)
|
||||||
continue
|
continue
|
||||||
|
@ -1078,14 +1092,12 @@ endfunction
|
||||||
function! s:checkout(spec)
|
function! s:checkout(spec)
|
||||||
let sha = a:spec.commit
|
let sha = a:spec.commit
|
||||||
let output = s:git_revision(a:spec.dir)
|
let output = s:git_revision(a:spec.dir)
|
||||||
let error = 0
|
|
||||||
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
||||||
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
|
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
|
||||||
let output = s:system(
|
let output = s:system(
|
||||||
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
||||||
let error = v:shell_error
|
|
||||||
endif
|
endif
|
||||||
return [output, error]
|
return output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:finish(pull)
|
function! s:finish(pull)
|
||||||
|
@ -1146,7 +1158,7 @@ function! s:update_impl(pull, force, args) abort
|
||||||
let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
|
let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
|
||||||
\ remove(args, -1) : get(g:, 'plug_threads', 16)
|
\ remove(args, -1) : get(g:, 'plug_threads', 16)
|
||||||
|
|
||||||
let managed = filter(deepcopy(g:plugs), 's:is_managed(v:key)')
|
let managed = filter(copy(g:plugs), 's:is_managed(v:key)')
|
||||||
let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') :
|
let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') :
|
||||||
\ filter(managed, 'index(args, v:key) >= 0')
|
\ filter(managed, 'index(args, v:key) >= 0')
|
||||||
|
|
||||||
|
@ -1280,11 +1292,9 @@ function! s:update_finish()
|
||||||
if !pos
|
if !pos
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
let out = ''
|
|
||||||
let error = 0
|
|
||||||
if has_key(spec, 'commit')
|
if has_key(spec, 'commit')
|
||||||
call s:log4(name, 'Checking out '.spec.commit)
|
call s:log4(name, 'Checking out '.spec.commit)
|
||||||
let [out, error] = s:checkout(spec)
|
let out = s:checkout(spec)
|
||||||
elseif has_key(spec, 'tag')
|
elseif has_key(spec, 'tag')
|
||||||
let tag = spec.tag
|
let tag = spec.tag
|
||||||
if tag =~ '\*'
|
if tag =~ '\*'
|
||||||
|
@ -1297,16 +1307,19 @@ function! s:update_finish()
|
||||||
endif
|
endif
|
||||||
call s:log4(name, 'Checking out '.tag)
|
call s:log4(name, 'Checking out '.tag)
|
||||||
let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir)
|
let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir)
|
||||||
let error = v:shell_error
|
else
|
||||||
|
let branch = s:git_origin_branch(spec)
|
||||||
|
call s:log4(name, 'Merging origin/'.s:esc(branch))
|
||||||
|
let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1'
|
||||||
|
\. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir)
|
||||||
endif
|
endif
|
||||||
if !error && filereadable(spec.dir.'/.gitmodules') &&
|
if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
|
||||||
\ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir))
|
\ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir))
|
||||||
call s:log4(name, 'Updating submodules. This may take a while.')
|
call s:log4(name, 'Updating submodules. This may take a while.')
|
||||||
let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir)
|
let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir)
|
||||||
let error = v:shell_error
|
|
||||||
endif
|
endif
|
||||||
let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
|
let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
|
||||||
if error
|
if v:shell_error
|
||||||
call add(s:update.errors, name)
|
call add(s:update.errors, name)
|
||||||
call s:regress_bar()
|
call s:regress_bar()
|
||||||
silent execute pos 'd _'
|
silent execute pos 'd _'
|
||||||
|
@ -1330,12 +1343,7 @@ function! s:update_finish()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:mark_aborted(name, message)
|
function! s:job_abort()
|
||||||
let attrs = { 'running': 0, 'error': 1, 'abort': 1, 'lines': [a:message] }
|
|
||||||
let s:jobs[a:name] = extend(get(s:jobs, a:name, {}), attrs)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:job_abort(cancel)
|
|
||||||
if (!s:nvim && !s:vim8) || !exists('s:jobs')
|
if (!s:nvim && !s:vim8) || !exists('s:jobs')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
@ -1349,18 +1357,8 @@ function! s:job_abort(cancel)
|
||||||
if j.new
|
if j.new
|
||||||
call s:rm_rf(g:plugs[name].dir)
|
call s:rm_rf(g:plugs[name].dir)
|
||||||
endif
|
endif
|
||||||
if a:cancel
|
|
||||||
call s:mark_aborted(name, 'Aborted')
|
|
||||||
endif
|
|
||||||
endfor
|
endfor
|
||||||
|
let s:jobs = {}
|
||||||
if a:cancel
|
|
||||||
for todo in values(s:update.todo)
|
|
||||||
let todo.abort = 1
|
|
||||||
endfor
|
|
||||||
else
|
|
||||||
let s:jobs = {}
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:last_non_empty_line(lines)
|
function! s:last_non_empty_line(lines)
|
||||||
|
@ -1374,16 +1372,6 @@ function! s:last_non_empty_line(lines)
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:bullet_for(job, ...)
|
|
||||||
if a:job.running
|
|
||||||
return a:job.new ? '+' : '*'
|
|
||||||
endif
|
|
||||||
if get(a:job, 'abort', 0)
|
|
||||||
return '~'
|
|
||||||
endif
|
|
||||||
return a:job.error ? 'x' : get(a:000, 0, '-')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:job_out_cb(self, data) abort
|
function! s:job_out_cb(self, data) abort
|
||||||
let self = a:self
|
let self = a:self
|
||||||
let data = remove(self.lines, -1) . a:data
|
let data = remove(self.lines, -1) . a:data
|
||||||
|
@ -1392,10 +1380,9 @@ function! s:job_out_cb(self, data) abort
|
||||||
" To reduce the number of buffer updates
|
" To reduce the number of buffer updates
|
||||||
let self.tick = get(self, 'tick', -1) + 1
|
let self.tick = get(self, 'tick', -1) + 1
|
||||||
if !self.running || self.tick % len(s:jobs) == 0
|
if !self.running || self.tick % len(s:jobs) == 0
|
||||||
|
let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-')
|
||||||
let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
|
let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
|
||||||
if len(result)
|
call s:log(bullet, self.name, result)
|
||||||
call s:log(s:bullet_for(self), self.name, result)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -1408,7 +1395,7 @@ endfunction
|
||||||
|
|
||||||
function! s:job_cb(fn, job, ch, data)
|
function! s:job_cb(fn, job, ch, data)
|
||||||
if !s:plug_window_exists() " plug window closed
|
if !s:plug_window_exists() " plug window closed
|
||||||
return s:job_abort(0)
|
return s:job_abort()
|
||||||
endif
|
endif
|
||||||
call call(a:fn, [a:job, a:data])
|
call call(a:fn, [a:job, a:data])
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1419,17 +1406,16 @@ function! s:nvim_cb(job_id, data, event) dict abort
|
||||||
\ s:job_cb('s:job_exit_cb', self, 0, a:data)
|
\ s:job_cb('s:job_exit_cb', self, 0, a:data)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:spawn(name, spec, queue, opts)
|
function! s:spawn(name, cmd, opts)
|
||||||
let job = { 'name': a:name, 'spec': a:spec, 'running': 1, 'error': 0, 'lines': [''],
|
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
|
||||||
\ 'new': get(a:opts, 'new', 0), 'queue': copy(a:queue) }
|
\ 'new': get(a:opts, 'new', 0) }
|
||||||
let Item = remove(job.queue, 0)
|
|
||||||
let argv = type(Item) == s:TYPE.funcref ? call(Item, [a:spec]) : Item
|
|
||||||
let s:jobs[a:name] = job
|
let s:jobs[a:name] = job
|
||||||
|
|
||||||
if s:nvim
|
if s:nvim
|
||||||
if has_key(a:opts, 'dir')
|
if has_key(a:opts, 'dir')
|
||||||
let job.cwd = a:opts.dir
|
let job.cwd = a:opts.dir
|
||||||
endif
|
endif
|
||||||
|
let argv = a:cmd
|
||||||
call extend(job, {
|
call extend(job, {
|
||||||
\ 'on_stdout': function('s:nvim_cb'),
|
\ 'on_stdout': function('s:nvim_cb'),
|
||||||
\ 'on_stderr': function('s:nvim_cb'),
|
\ 'on_stderr': function('s:nvim_cb'),
|
||||||
|
@ -1445,7 +1431,7 @@ function! s:spawn(name, spec, queue, opts)
|
||||||
\ 'Invalid arguments (or job table is full)']
|
\ 'Invalid arguments (or job table is full)']
|
||||||
endif
|
endif
|
||||||
elseif s:vim8
|
elseif s:vim8
|
||||||
let cmd = join(map(copy(argv), 'plug#shellescape(v:val, {"script": 0})'))
|
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"script": 0})'))
|
||||||
if has_key(a:opts, 'dir')
|
if has_key(a:opts, 'dir')
|
||||||
let cmd = s:with_cd(cmd, a:opts.dir, 0)
|
let cmd = s:with_cd(cmd, a:opts.dir, 0)
|
||||||
endif
|
endif
|
||||||
|
@ -1465,33 +1451,27 @@ function! s:spawn(name, spec, queue, opts)
|
||||||
let job.lines = ['Failed to start job']
|
let job.lines = ['Failed to start job']
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [argv, a:opts.dir] : [argv]))
|
let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd]))
|
||||||
let job.error = v:shell_error != 0
|
let job.error = v:shell_error != 0
|
||||||
let job.running = 0
|
let job.running = 0
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:reap(name)
|
function! s:reap(name)
|
||||||
let job = remove(s:jobs, a:name)
|
let job = s:jobs[a:name]
|
||||||
if job.error
|
if job.error
|
||||||
call add(s:update.errors, a:name)
|
call add(s:update.errors, a:name)
|
||||||
elseif get(job, 'new', 0)
|
elseif get(job, 'new', 0)
|
||||||
let s:update.new[a:name] = 1
|
let s:update.new[a:name] = 1
|
||||||
endif
|
endif
|
||||||
|
let s:update.bar .= job.error ? 'x' : '='
|
||||||
|
|
||||||
let more = len(get(job, 'queue', []))
|
let bullet = job.error ? 'x' : '-'
|
||||||
let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
|
let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
|
||||||
if len(result)
|
call s:log(bullet, a:name, empty(result) ? 'OK' : result)
|
||||||
call s:log(s:bullet_for(job), a:name, result)
|
call s:bar()
|
||||||
endif
|
|
||||||
|
|
||||||
if !job.error && more
|
call remove(s:jobs, a:name)
|
||||||
let job.spec.queue = job.queue
|
|
||||||
let s:update.todo[a:name] = job.spec
|
|
||||||
else
|
|
||||||
let s:update.bar .= s:bullet_for(job, '=')
|
|
||||||
call s:bar()
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:bar()
|
function! s:bar()
|
||||||
|
@ -1544,16 +1524,6 @@ function! s:update_vim()
|
||||||
call s:tick()
|
call s:tick()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:checkout_command(spec)
|
|
||||||
let a:spec.branch = s:git_origin_branch(a:spec)
|
|
||||||
return ['git', 'checkout', '-q', a:spec.branch, '--']
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:merge_command(spec)
|
|
||||||
let a:spec.branch = s:git_origin_branch(a:spec)
|
|
||||||
return ['git', 'merge', '--ff-only', 'origin/'.a:spec.branch]
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:tick()
|
function! s:tick()
|
||||||
let pull = s:update.pull
|
let pull = s:update.pull
|
||||||
let prog = s:progress_opt(s:nvim || s:vim8)
|
let prog = s:progress_opt(s:nvim || s:vim8)
|
||||||
|
@ -1568,24 +1538,13 @@ while 1 " Without TCO, Vim stack is bound to explode
|
||||||
|
|
||||||
let name = keys(s:update.todo)[0]
|
let name = keys(s:update.todo)[0]
|
||||||
let spec = remove(s:update.todo, name)
|
let spec = remove(s:update.todo, name)
|
||||||
if get(spec, 'abort', 0)
|
let new = empty(globpath(spec.dir, '.git', 1))
|
||||||
call s:mark_aborted(name, 'Skipped')
|
|
||||||
call s:reap(name)
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
let queue = get(spec, 'queue', [])
|
call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
|
||||||
let new = empty(globpath(spec.dir, '.git', 1))
|
redraw
|
||||||
|
|
||||||
if empty(queue)
|
|
||||||
call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
|
|
||||||
redraw
|
|
||||||
endif
|
|
||||||
|
|
||||||
let has_tag = has_key(spec, 'tag')
|
let has_tag = has_key(spec, 'tag')
|
||||||
if len(queue)
|
if !new
|
||||||
call s:spawn(name, spec, queue, { 'dir': spec.dir })
|
|
||||||
elseif !new
|
|
||||||
let [error, _] = s:git_validate(spec, 0)
|
let [error, _] = s:git_validate(spec, 0)
|
||||||
if empty(error)
|
if empty(error)
|
||||||
if pull
|
if pull
|
||||||
|
@ -1596,11 +1555,7 @@ while 1 " Without TCO, Vim stack is bound to explode
|
||||||
if !empty(prog)
|
if !empty(prog)
|
||||||
call add(cmd, prog)
|
call add(cmd, prog)
|
||||||
endif
|
endif
|
||||||
let queue = [cmd, split('git remote set-head origin -a')]
|
call s:spawn(name, cmd, { 'dir': spec.dir })
|
||||||
if !has_tag && !has_key(spec, 'commit')
|
|
||||||
call extend(queue, [function('s:checkout_command'), function('s:merge_command')])
|
|
||||||
endif
|
|
||||||
call s:spawn(name, spec, queue, { 'dir': spec.dir })
|
|
||||||
else
|
else
|
||||||
let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 }
|
let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 }
|
||||||
endif
|
endif
|
||||||
|
@ -1615,7 +1570,7 @@ while 1 " Without TCO, Vim stack is bound to explode
|
||||||
if !empty(prog)
|
if !empty(prog)
|
||||||
call add(cmd, prog)
|
call add(cmd, prog)
|
||||||
endif
|
endif
|
||||||
call s:spawn(name, spec, [extend(cmd, [spec.uri, s:trim(spec.dir)]), function('s:checkout_command'), function('s:merge_command')], { 'new': 1 })
|
call s:spawn(name, extend(cmd, [spec.uri, s:trim(spec.dir)]), { 'new': 1 })
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !s:jobs[name].running
|
if !s:jobs[name].running
|
||||||
|
@ -2314,10 +2269,7 @@ endfunction
|
||||||
|
|
||||||
function! s:with_cd(cmd, dir, ...)
|
function! s:with_cd(cmd, dir, ...)
|
||||||
let script = a:0 > 0 ? a:1 : 1
|
let script = a:0 > 0 ? a:1 : 1
|
||||||
let pwsh = s:is_powershell(&shell)
|
return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd)
|
||||||
let cd = s:is_win && !pwsh ? 'cd /d' : 'cd'
|
|
||||||
let sep = pwsh ? ';' : '&&'
|
|
||||||
return printf('%s %s %s %s', cd, plug#shellescape(a:dir, {'script': script, 'shell': &shell}), sep, a:cmd)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:system(cmd, ...)
|
function! s:system(cmd, ...)
|
||||||
|
@ -2394,21 +2346,18 @@ function! s:git_validate(spec, check_branch)
|
||||||
\ current_branch, origin_branch)
|
\ current_branch, origin_branch)
|
||||||
endif
|
endif
|
||||||
if empty(err)
|
if empty(err)
|
||||||
let ahead_behind = split(s:lastline(s:system([
|
let [ahead, behind] = split(s:lastline(s:system([
|
||||||
\ 'git', 'rev-list', '--count', '--left-right',
|
\ 'git', 'rev-list', '--count', '--left-right',
|
||||||
\ printf('HEAD...origin/%s', origin_branch)
|
\ printf('HEAD...origin/%s', origin_branch)
|
||||||
\ ], a:spec.dir)), '\t')
|
\ ], a:spec.dir)), '\t')
|
||||||
if v:shell_error || len(ahead_behind) != 2
|
if !v:shell_error && ahead
|
||||||
let err = "Failed to compare with the origin. The default branch might have changed.\nPlugClean required."
|
if behind
|
||||||
else
|
|
||||||
let [ahead, behind] = ahead_behind
|
|
||||||
if ahead && behind
|
|
||||||
" Only mention PlugClean if diverged, otherwise it's likely to be
|
" Only mention PlugClean if diverged, otherwise it's likely to be
|
||||||
" pushable (and probably not that messed up).
|
" pushable (and probably not that messed up).
|
||||||
let err = printf(
|
let err = printf(
|
||||||
\ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
|
\ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
|
||||||
\ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind)
|
\ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind)
|
||||||
elseif ahead
|
else
|
||||||
let err = printf("Ahead of origin/%s by %d commit(s).\n"
|
let err = printf("Ahead of origin/%s by %d commit(s).\n"
|
||||||
\ .'Cannot update until local changes are pushed.',
|
\ .'Cannot update until local changes are pushed.',
|
||||||
\ origin_branch, ahead)
|
\ origin_branch, ahead)
|
||||||
|
@ -2440,7 +2389,7 @@ function! s:clean(force)
|
||||||
let errs = {}
|
let errs = {}
|
||||||
let [cnt, total] = [0, len(g:plugs)]
|
let [cnt, total] = [0, len(g:plugs)]
|
||||||
for [name, spec] in items(g:plugs)
|
for [name, spec] in items(g:plugs)
|
||||||
if !s:is_managed(name) || get(spec, 'frozen', 0)
|
if !s:is_managed(name)
|
||||||
call add(dirs, spec.dir)
|
call add(dirs, spec.dir)
|
||||||
else
|
else
|
||||||
let [err, clean] = s:git_validate(spec, 1)
|
let [err, clean] = s:git_validate(spec, 1)
|
||||||
|
@ -2672,34 +2621,26 @@ function! s:preview_commit()
|
||||||
|
|
||||||
let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
|
let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
|
||||||
if empty(sha)
|
if empty(sha)
|
||||||
let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$')
|
return
|
||||||
if empty(name)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
let title = 'HEAD@{1}..'
|
|
||||||
let command = 'git diff --no-color HEAD@{1}'
|
|
||||||
else
|
|
||||||
let title = sha
|
|
||||||
let command = 'git show --no-color --pretty=medium '.sha
|
|
||||||
let name = s:find_name(line('.'))
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let name = s:find_name(line('.'))
|
||||||
if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
|
if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !s:is_preview_window_open()
|
if exists('g:plug_pwindow') && !s:is_preview_window_open()
|
||||||
execute get(g:, 'plug_pwindow', 'vertical rightbelow new')
|
execute g:plug_pwindow
|
||||||
execute 'e' title
|
execute 'e' sha
|
||||||
else
|
else
|
||||||
execute 'pedit' title
|
execute 'pedit' sha
|
||||||
wincmd P
|
wincmd P
|
||||||
endif
|
endif
|
||||||
setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable
|
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
|
||||||
let batchfile = ''
|
let batchfile = ''
|
||||||
try
|
try
|
||||||
let [sh, shellcmdflag, shrd] = s:chsh(1)
|
let [sh, shellcmdflag, shrd] = s:chsh(1)
|
||||||
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command
|
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
|
||||||
if s:is_win
|
if s:is_win
|
||||||
let [batchfile, cmd] = s:batchfile(cmd)
|
let [batchfile, cmd] = s:batchfile(cmd)
|
||||||
endif
|
endif
|
||||||
|
@ -2825,9 +2766,9 @@ function! s:snapshot(force, ...) abort
|
||||||
1
|
1
|
||||||
let anchor = line('$') - 3
|
let anchor = line('$') - 3
|
||||||
let names = sort(keys(filter(copy(g:plugs),
|
let names = sort(keys(filter(copy(g:plugs),
|
||||||
\'has_key(v:val, "uri") && isdirectory(v:val.dir)')))
|
\'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)')))
|
||||||
for name in reverse(names)
|
for name in reverse(names)
|
||||||
let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir)
|
let sha = s:git_revision(g:plugs[name].dir)
|
||||||
if !empty(sha)
|
if !empty(sha)
|
||||||
call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
|
call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
|
||||||
redraw
|
redraw
|
||||||
|
|
4
test/run
4
test/run
|
@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ DOC
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -371,9 +371,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))
|
||||||
|
@ -396,14 +393,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
|
||||||
|
@ -461,8 +450,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
|
||||||
|
@ -804,14 +791,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 +975,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):
|
||||||
|
@ -1642,12 +1620,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 +1698,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 +1724,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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user