mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-07 01:24:27 +08:00
Compare commits
317 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b44ea685aa | ||
|
|
9df0580eff | ||
|
|
e15598fe45 | ||
|
|
326cb71a2a | ||
|
|
c9a7ca1e9e | ||
|
|
5695fb8474 | ||
|
|
f68a4fddae | ||
|
|
17996cedce | ||
|
|
460fbe82e0 | ||
|
|
05a1620bb1 | ||
|
|
cb5bed0e35 | ||
|
|
44893a1901 | ||
|
|
765a2d21d3 | ||
|
|
eb25f320a0 | ||
|
|
7c7ef8cf2f | ||
|
|
a8b09617f9 | ||
|
|
bf1e0fb8eb | ||
|
|
656ccef8dc | ||
|
|
41de3c713c | ||
|
|
0507fc897e | ||
|
|
e6ea538558 | ||
|
|
3de4567bc0 | ||
|
|
0d9efb01c7 | ||
|
|
92bcecddd6 | ||
|
|
d1752e7d14 | ||
|
|
367e61b6b0 | ||
|
|
612ee1d461 | ||
|
|
c6ed41f47e | ||
|
|
0f3bd51d44 | ||
|
|
3595d5b52a | ||
|
|
10008e5843 | ||
|
|
d1351201d9 | ||
|
|
a61d097037 | ||
|
|
158fd28bc4 | ||
|
|
76e9076ef4 | ||
|
|
36973defbd | ||
|
|
82ac9d9075 | ||
|
|
bdc5c8d3cc | ||
|
|
c1f9d7cdb4 | ||
|
|
f666048052 | ||
|
|
db223a4d84 | ||
|
|
eb47183af2 | ||
|
|
e4ddb89c20 | ||
|
|
a4e2c064f0 | ||
|
|
820cc63569 | ||
|
|
c463c9fe83 | ||
|
|
7218143147 | ||
|
|
c3d57ac6b5 | ||
|
|
16902f9003 | ||
|
|
b082ae3847 | ||
|
|
6246ad284c | ||
|
|
c06d222480 | ||
|
|
b0f714e812 | ||
|
|
31b26aa266 | ||
|
|
d96e303692 | ||
|
|
a88753ef4e | ||
|
|
396c60f24c | ||
|
|
ffd54224a0 | ||
|
|
8d4c341a0a | ||
|
|
3e712f3936 | ||
|
|
88e2fa380c | ||
|
|
03590d8422 | ||
|
|
d5a5697dc0 | ||
|
|
799e20a682 | ||
|
|
c88ab60007 | ||
|
|
7d494b4a7b | ||
|
|
676174c34d | ||
|
|
6f60192d71 | ||
|
|
7e7dec9252 | ||
|
|
13234b4029 | ||
|
|
03504f26b1 | ||
|
|
46dda37494 | ||
|
|
fa2569dc84 | ||
|
|
fe0ff38cd9 | ||
|
|
77413875da | ||
|
|
f695463daf | ||
|
|
e6f40479ee | ||
|
|
6843e5aeec | ||
|
|
0cfa683cd0 | ||
|
|
e929534199 | ||
|
|
52d7da3925 | ||
|
|
cd26cd562e | ||
|
|
24a71f9a91 | ||
|
|
b836656556 | ||
|
|
7f598e5b58 | ||
|
|
87b426e381 | ||
|
|
ba97f4458e | ||
|
|
060c0e6d6c | ||
|
|
80e5b3eab5 | ||
|
|
aae282e4f0 | ||
|
|
7cdd4036de | ||
|
|
173bfea4c5 | ||
|
|
c233234bd9 | ||
|
|
84faabe4cc | ||
|
|
6173ecc210 | ||
|
|
dbd045e995 | ||
|
|
0611369d0d | ||
|
|
d478351363 | ||
|
|
8381041ac1 | ||
|
|
93d9e434a2 | ||
|
|
c3bcd95459 | ||
|
|
f820fb9f0d | ||
|
|
072d28e86e | ||
|
|
8fb0efe4e5 | ||
|
|
e11e045577 | ||
|
|
e00be1b493 | ||
|
|
38e1e6335c | ||
|
|
0c710f75f4 | ||
|
|
8292b3f31a | ||
|
|
26e4a77317 | ||
|
|
dd28fc7368 | ||
|
|
fb8a5f9246 | ||
|
|
eb29cc9b47 | ||
|
|
a93bdfc175 | ||
|
|
ded1ab7562 | ||
|
|
91fe6ad3e9 | ||
|
|
86e75e5d08 | ||
|
|
7e1dc1bcc8 | ||
|
|
58d39115f9 | ||
|
|
675b09dbfc | ||
|
|
a190f4e843 | ||
|
|
27289deb5c | ||
|
|
a6f3a020e3 | ||
|
|
4e5b5b978e | ||
|
|
2653f4bdfd | ||
|
|
69d6c9d545 | ||
|
|
51cf219213 | ||
|
|
6286337e5b | ||
|
|
23b508e5fd | ||
|
|
c34b35d50e | ||
|
|
240dc9cbb6 | ||
|
|
f85d4d774b | ||
|
|
50cd5e5819 | ||
|
|
099057da65 | ||
|
|
8e0fcf88c0 | ||
|
|
025f314144 | ||
|
|
48fba1454b | ||
|
|
2ed1f27aa2 | ||
|
|
7760f1c22b | ||
|
|
0bd23f5b47 | ||
|
|
0227c78910 | ||
|
|
8a72305371 | ||
|
|
018b48e071 | ||
|
|
7ace0c42db | ||
|
|
179fa7bb82 | ||
|
|
76bce26ab8 | ||
|
|
36e4364b81 | ||
|
|
76ec644114 | ||
|
|
9e0a082a3d | ||
|
|
9bee42ca0a | ||
|
|
18313fa43e | ||
|
|
32eb4f5cbe | ||
|
|
96824ccd14 | ||
|
|
ef4549d2d1 | ||
|
|
d738da2ddb | ||
|
|
d17d10dccb | ||
|
|
6677e8bffd | ||
|
|
80ca4ebf54 | ||
|
|
8f1df15cc3 | ||
|
|
2218b8fe20 | ||
|
|
c632c1fd6a | ||
|
|
42300e0c4d | ||
|
|
13de76383d | ||
|
|
481a400ba4 | ||
|
|
02710070a1 | ||
|
|
e04f93b162 | ||
|
|
923f3fb3d5 | ||
|
|
6a7efea26b | ||
|
|
0e3e1cab75 | ||
|
|
27354c826e | ||
|
|
650927980d | ||
|
|
047fbba4cd | ||
|
|
fa5ece81f7 | ||
|
|
e1b7f1ae85 | ||
|
|
cf1f644aa8 | ||
|
|
8da3942484 | ||
|
|
cbaf4f3088 | ||
|
|
a06687b4ed | ||
|
|
9abd50facd | ||
|
|
b3226fbbf6 | ||
|
|
d0120cfb45 | ||
|
|
d9b70554e3 | ||
|
|
3c6ac68947 | ||
|
|
51dc024b2e | ||
|
|
30a2c5cc14 | ||
|
|
a34b745a21 | ||
|
|
c759170ce2 | ||
|
|
44410a32e3 | ||
|
|
5698a055c3 | ||
|
|
59748b0680 | ||
|
|
95aa96a884 | ||
|
|
bb48508c3e | ||
|
|
8a525f165c | ||
|
|
e362fd5931 | ||
|
|
74169f3761 | ||
|
|
7e4191baaf | ||
|
|
753f7be798 | ||
|
|
c74fae9f8e | ||
|
|
fc200da975 | ||
|
|
77f58a3793 | ||
|
|
308fb9bc94 | ||
|
|
4a96db8971 | ||
|
|
925ec7b325 | ||
|
|
7fec10e088 | ||
|
|
54fc8a4fc7 | ||
|
|
9c1cca32f0 | ||
|
|
f6be60a9a5 | ||
|
|
e81e761d43 | ||
|
|
fb84e6b11c | ||
|
|
ef784c17b1 | ||
|
|
7aeff0ef0d | ||
|
|
773b3cadd0 | ||
|
|
71542dd896 | ||
|
|
f825e4ef6e | ||
|
|
6e7509e2ef | ||
|
|
619e42a182 | ||
|
|
48e8000b6a | ||
|
|
79da5b2654 | ||
|
|
61f010ffad | ||
|
|
4539bb8fb3 | ||
|
|
7d40f592af | ||
|
|
1c61517164 | ||
|
|
061b326b37 | ||
|
|
166426718e | ||
|
|
b440603fa9 | ||
|
|
04fc8f9aba | ||
|
|
ebe8635043 | ||
|
|
334e820c4e | ||
|
|
0e9fa672f8 | ||
|
|
fdf1e53da5 | ||
|
|
470139cd86 | ||
|
|
e8cd357060 | ||
|
|
3606c294de | ||
|
|
06f903d8af | ||
|
|
1f704deb76 | ||
|
|
3ebf6361bf | ||
|
|
9b99c1f885 | ||
|
|
53cc8a53d9 | ||
|
|
2ee153d610 | ||
|
|
7019171737 | ||
|
|
044c3a67c4 | ||
|
|
48514768c2 | ||
|
|
68ad02c5c3 | ||
|
|
12bc2ea1da | ||
|
|
ade7fb95b1 | ||
|
|
9c55223869 | ||
|
|
495becf442 | ||
|
|
425ef39db2 | ||
|
|
bd2cb9d2de | ||
|
|
0263370bd1 | ||
|
|
4b3fbd1592 | ||
|
|
396a534a0a | ||
|
|
a45c3834f8 | ||
|
|
a5c3952380 | ||
|
|
60bda7322f | ||
|
|
05008e7a82 | ||
|
|
2889cb4739 | ||
|
|
61b21068ee | ||
|
|
15da7eb78a | ||
|
|
385a1eb350 | ||
|
|
8c915a5271 | ||
|
|
ee9f0e55b8 | ||
|
|
018adb2aef | ||
|
|
da47e6ee56 | ||
|
|
662274e617 | ||
|
|
4eeff535fa | ||
|
|
c3669836d3 | ||
|
|
eb38fe3d32 | ||
|
|
e7704e6cb3 | ||
|
|
e1e04cabd5 | ||
|
|
afc20ecff3 | ||
|
|
38510a8788 | ||
|
|
a34b06dd54 | ||
|
|
5d910fc9ea | ||
|
|
f31477407a | ||
|
|
0e907d4f38 | ||
|
|
cb08d6036b | ||
|
|
9d63fe6aeb | ||
|
|
0489b5deed | ||
|
|
cac2f9f439 | ||
|
|
115a25de79 | ||
|
|
a64b156682 | ||
|
|
a9fa8f44e5 | ||
|
|
d6590fa883 | ||
|
|
cabaf7b431 | ||
|
|
6e509db6ff | ||
|
|
7b7778d5ba | ||
|
|
f3e2d214df | ||
|
|
5ec1faefab | ||
|
|
6406d73c9a | ||
|
|
ff4cbe23c0 | ||
|
|
681ca2d43a | ||
|
|
adb2413f0d | ||
|
|
dda21b50bf | ||
|
|
537a5321aa | ||
|
|
99f6f36b69 | ||
|
|
3f82808bea | ||
|
|
7474edf13f | ||
|
|
25b0fb7583 | ||
|
|
a868ee4c11 | ||
|
|
49851436ff | ||
|
|
2f9a94e8c0 | ||
|
|
ab3bd3b17c | ||
|
|
3572ffde79 | ||
|
|
18c8b54793 | ||
|
|
1752de5b7c | ||
|
|
2f3225fc60 | ||
|
|
1022acad0b | ||
|
|
68c7fbbf9d | ||
|
|
da24f714e0 | ||
|
|
c1bbbaf3ef | ||
|
|
f7ebba7b9e | ||
|
|
6272f5e289 | ||
|
|
f43067c7a5 | ||
|
|
e6cba28997 | ||
|
|
f1b8832a13 | ||
|
|
d0c94a9b08 |
32
.github/ISSUE_TEMPLATE.md
vendored
Normal file
32
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<!--
|
||||
### Before Submitting
|
||||
|
||||
- You checked the [faq](https://github.com/junegunn/vim-plug/wiki/faq) for common problems.
|
||||
- Check your [requirements](https://github.com/junegunn/vim-plug/wiki/requirements) are satisfied.
|
||||
- You are not going to suggest vim-plug manage itself like Vundle, see #240, #364, #367 ...
|
||||
-->
|
||||
|
||||
Explain the problem here ...
|
||||
|
||||
------------------------------
|
||||
|
||||
<!-- Put the contents of `:version` below -->
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
<!-- Check all that apply. -->
|
||||
- Type:
|
||||
- [ ] Bug
|
||||
- [ ] Enhancement
|
||||
- [ ] Feature Request
|
||||
- [ ] Question
|
||||
- OS:
|
||||
- [ ] All/Other
|
||||
- [ ] Linux
|
||||
- [ ] OS X
|
||||
- [ ] Windows
|
||||
- Vim:
|
||||
- [ ] Terminal Vim
|
||||
- [ ] GVim
|
||||
- [ ] Neovim
|
||||
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<!-- ## Before Submitting
|
||||
|
||||
- You made sure the existing tests/travis build works.
|
||||
- You made sure any new features were tested where appropriate.
|
||||
- You checked a similar feature wasn't already turned down by searching issues & PRs.
|
||||
-->
|
||||
|
||||
Describe the details of your PR ...
|
||||
56
.travis.yml
56
.travis.yml
@@ -1,15 +1,51 @@
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 2.0.0
|
||||
sudo: false
|
||||
env:
|
||||
global:
|
||||
- DEPS=$HOME/deps
|
||||
- PATH=$DEPS/bin:$PATH
|
||||
matrix:
|
||||
include:
|
||||
- env: ENV=nox
|
||||
rvm: 1.8.7
|
||||
addons: { apt: { packages: [vim-nox] } }
|
||||
- env: ENV=python
|
||||
rvm: 1.8.7
|
||||
addons: { apt: { packages: [python2.7-dev] } }
|
||||
- env: ENV=python3
|
||||
rvm: 1.8.7
|
||||
addons: { apt: { packages: [python3-dev] } }
|
||||
- env: ENV=ruby
|
||||
rvm: 1.8.7
|
||||
- env: ENV=ruby
|
||||
rvm: 2.0.0
|
||||
install: |
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
|
||||
before_script: |
|
||||
hg clone https://code.google.com/p/vim/
|
||||
if [ "$ENV" == "nox" ]; then
|
||||
mkdir -p ${DEPS}/bin
|
||||
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
|
||||
return
|
||||
fi
|
||||
|
||||
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui "
|
||||
case "$ENV" in
|
||||
python)
|
||||
C_OPTS+=--enable-pythoninterp
|
||||
;;
|
||||
python3)
|
||||
C_OPTS+=--enable-python3interp
|
||||
;;
|
||||
ruby)
|
||||
C_OPTS+=--enable-rubyinterp
|
||||
;;
|
||||
esac
|
||||
|
||||
git clone --depth 1 https://github.com/vim/vim
|
||||
cd vim
|
||||
./configure --with-features=huge --enable-rubyinterp
|
||||
./configure $C_OPTS
|
||||
make
|
||||
sudo make install
|
||||
make install
|
||||
cd -
|
||||
|
||||
script: |
|
||||
test/run !
|
||||
script: test/run !
|
||||
|
||||
170
README.md
170
README.md
@@ -1,59 +1,107 @@
|
||||

|
||||

|
||||
<img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="75" alt="vim-plug">[](https://travis-ci.org/junegunn/vim-plug)
|
||||
===
|
||||
|
||||
A minimalist Vim plugin manager.
|
||||
|
||||

|
||||
<img src="https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif" height="450">
|
||||
|
||||
### Pros.
|
||||
|
||||
- Easier to setup: Single file. No boilerplate code required.
|
||||
- Easier to use: Concise, intuitive syntax
|
||||
- [Super-fast](https://raw.github.com/junegunn/i/master/vim-plug/40-in-4.gif)
|
||||
parallel installation/update (requires
|
||||
[+ruby](https://github.com/junegunn/vim-plug/wiki/ruby))
|
||||
- On-demand loading to achieve
|
||||
[fast startup time](http://junegunn.kr/images/vim-startup-time.png)
|
||||
- [Super-fast][40/4] parallel installation/update
|
||||
(with any of `+python`, `+python3`, `+ruby`, or [Neovim][nv])
|
||||
- Creates shallow clones to minimize disk space usage and download time
|
||||
- On-demand loading for [faster startup time][startup-time]
|
||||
- Can review and rollback updates
|
||||
- Branch/tag/commit support
|
||||
- Post-update hooks
|
||||
- Can choose a specific branch or tag for each plugin
|
||||
- Support for externally managed plugins
|
||||
|
||||
[40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
|
||||
[nv]: http://neovim.org/
|
||||
[startup-time]: http://junegunn.kr/images/vim-startup-time.png
|
||||
|
||||
### Installation
|
||||
|
||||
[Download plug.vim](https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim)
|
||||
and put it in the "autoload" directory.
|
||||
|
||||
###### Unix
|
||||
|
||||
```sh
|
||||
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
```
|
||||
|
||||
###### Neovim
|
||||
|
||||
```sh
|
||||
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
```
|
||||
|
||||
###### Windows (PowerShell)
|
||||
|
||||
```powershell
|
||||
md ~\vimfiles\autoload
|
||||
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
(New-Object Net.WebClient).DownloadFile($uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\autoload\plug.vim"))
|
||||
```
|
||||
|
||||
### Getting Help
|
||||
|
||||
- See the [requirements] page for debugging information & tested configurations.
|
||||
- See the [FAQ] for common problems and questions.
|
||||
- Create an [issue](https://github.com/junegunn/vim-plug/issues/new).
|
||||
|
||||
[FAQ]: https://github.com/junegunn/vim-plug/wiki/faq
|
||||
[requirements]: https://github.com/junegunn/vim-plug/wiki/requirements
|
||||
|
||||
### Usage
|
||||
|
||||
[Download plug.vim](https://raw.github.com/junegunn/vim-plug/master/plug.vim)
|
||||
and put it in ~/.vim/autoload
|
||||
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neovim):
|
||||
|
||||
```sh
|
||||
mkdir -p ~/.vim/autoload
|
||||
curl -fLo ~/.vim/autoload/plug.vim \
|
||||
https://raw.github.com/junegunn/vim-plug/master/plug.vim
|
||||
```
|
||||
1. Begin the section with `call plug#begin()`
|
||||
1. List the plugins with `Plug` commands
|
||||
1. `call plug#end()` to update `&runtimepath` and initialize plugin system
|
||||
|
||||
Edit your .vimrc
|
||||
#### Example
|
||||
|
||||
```vim
|
||||
call plug#begin('~/.vim/plugged')
|
||||
|
||||
" Make sure you use single quotes
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
|
||||
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
|
||||
" Any valid git URL is allowed
|
||||
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
|
||||
|
||||
" Group dependencies, vim-snippets depends on ultisnips
|
||||
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
|
||||
|
||||
" On-demand loading
|
||||
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
|
||||
|
||||
" Using git URL
|
||||
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
|
||||
" Using a non-master 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': 'go.weekly.2012-03-13', 'rtp': 'vim' }
|
||||
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
|
||||
|
||||
" Plugin outside ~/.vim/plugged with post-update hook
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||
|
||||
" Unmanaged plugin (manually installed and updated)
|
||||
Plug '~/my-prototype-plugin'
|
||||
|
||||
" Add plugins to &runtimepath
|
||||
call plug#end()
|
||||
```
|
||||
|
||||
@@ -68,34 +116,46 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
||||
| `PlugClean[!]` | Remove unused directories (bang version will clean without prompt) |
|
||||
| `PlugUpgrade` | Upgrade vim-plug itself |
|
||||
| `PlugStatus` | Check the status of plugins |
|
||||
| `PlugDiff` | See the updated changes from the previous PlugUpdate |
|
||||
| `PlugDiff` | Examine changes from the previous update and the pending changes |
|
||||
| `PlugSnapshot[!] [output path]` | Generate script for restoring the current snapshot of the plugins |
|
||||
|
||||
### `Plug` options
|
||||
|
||||
| Option | Description |
|
||||
| -------------- | -------------------------------------------------------------------- |
|
||||
| `branch`/`tag` | Branch or tag of the repository to use |
|
||||
| `rtp` | Subdirectory that contains Vim plugin |
|
||||
| `dir` | Custom directory 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 install/update plugin unless explicitly given as the argument |
|
||||
| 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 |
|
||||
|
||||
### Options for parallel installer
|
||||
### Global options
|
||||
|
||||
| Flag | Default | Description |
|
||||
| ------------------- | --------------------------------- | ------------------------------------------------------ |
|
||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||
| `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_shallow` | 1 | Use shallow clone |
|
||||
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
|
||||
| `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) |
|
||||
|
||||
| Flag | Default | Description |
|
||||
| ---------------- | ------- | ------------------------------------ |
|
||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||
| `g:plug_timeout` | 60 | Time limit of each task in seconds |
|
||||
| `g:plug_retries` | 2 | Number of retries in case of timeout |
|
||||
|
||||
### Keybindings
|
||||
|
||||
- `D` - `PlugDiff`
|
||||
- `S` - `PlugStatus`
|
||||
- `R` - Retry failed update or installation tasks
|
||||
- `U` - Update plugins in the selected range
|
||||
- `q` - Close the window
|
||||
- `:PlugStatus`
|
||||
- `L` - Load plugin
|
||||
- `:PlugDiff`
|
||||
- `X` - Revert the update
|
||||
|
||||
### Example: A small [sensible](https://github.com/tpope/vim-sensible) Vim configuration
|
||||
|
||||
@@ -117,17 +177,35 @@ Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
|
||||
" Loaded when clojure file is opened
|
||||
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
|
||||
|
||||
" Multiple file types
|
||||
Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
|
||||
|
||||
" On-demand loading on both conditions
|
||||
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
|
||||
|
||||
" Code to execute when the plugin is lazily loaded on demand
|
||||
Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
|
||||
autocmd! User goyo.vim echom 'Goyo is now loaded!'
|
||||
```
|
||||
|
||||
`for` option is generally not needed as most plugins for specific file types
|
||||
usually don't have too much code in `plugin` directory. You might want to
|
||||
examine the output of `vim --startuptime` before applying the option.
|
||||
|
||||
### Post-update hooks
|
||||
|
||||
There are some plugins that require extra steps after installation or update.
|
||||
In that case, use `do` option to describe the task to be performed.
|
||||
|
||||
```vim
|
||||
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' }
|
||||
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
|
||||
Plug 'Valloric/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
|
||||
@@ -140,7 +218,7 @@ function! BuildYCM(info)
|
||||
" - status: 'installed', 'updated', or 'unchanged'
|
||||
" - force: set on PlugInstall! or PlugUpdate!
|
||||
if a:info.status == 'installed' || a:info.force
|
||||
!./install.sh
|
||||
!./install.py
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -168,9 +246,17 @@ let g:fzf_install = 'yes | ./install'
|
||||
Plug 'junegunn/fzf', { 'do': g:fzf_install }
|
||||
```
|
||||
|
||||
### FAQ/Troubleshooting
|
||||
### `PlugInstall!` and `PlugUpdate!`
|
||||
|
||||
See [FAQ/Troubleshooting](https://github.com/junegunn/vim-plug/wiki/faq).
|
||||
The installer takes the following steps when installing/updating a plugin:
|
||||
|
||||
1. `git clone` or `git fetch` from its origin
|
||||
2. Check out branch, tag, or commit and optionally `git merge` remote branch
|
||||
3. If the plugin was updated (or installed for the first time)
|
||||
1. Update submodules
|
||||
2. Execute post-update hooks
|
||||
|
||||
The commands with `!` suffix ensure that all steps are run unconditionally.
|
||||
|
||||
### Articles
|
||||
|
||||
|
||||
BIN
plug.png
BIN
plug.png
Binary file not shown.
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 23 KiB |
332
test/regressions.vader
Normal file
332
test/regressions.vader
Normal file
@@ -0,0 +1,332 @@
|
||||
**********************************************************************
|
||||
Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
||||
call plug#begin('$PLUG_FIXTURES')
|
||||
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
|
||||
call plug#end()
|
||||
|
||||
redir => out
|
||||
tabnew a.c
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin-c') >= 0
|
||||
|
||||
* The same applies to plug#load())
|
||||
redir => out
|
||||
call plug#load('ftplugin-msg')
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin-c') >= 0
|
||||
q
|
||||
|
||||
|
||||
**********************************************************************
|
||||
Execute (#114 Should not contain empty path in &rtp):
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
|
||||
Log &rtp
|
||||
Assert &rtp !~ ',,', 'Commas'
|
||||
Assert &rtp !~ '^,', 'Comma prefix'
|
||||
Assert &rtp !~ ',$', 'Comma suffix'
|
||||
|
||||
**********************************************************************
|
||||
Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||
augroup PlugLOD
|
||||
autocmd!
|
||||
augroup END
|
||||
|
||||
" Cleared on command
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
|
||||
Assert exists(':EmojiCommand'), 'EmojiCommand not defined'
|
||||
Assert exists(':EmojiCommand2'), 'EmojiCommand2 not defined'
|
||||
Assert !empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) not defined'
|
||||
|
||||
silent! EmojiCommand
|
||||
|
||||
Assert !exists(':EmojiCommand'), 'EmojiCommand defined'
|
||||
Assert !exists(':EmojiCommand2'), 'EmojiCommand2 defined'
|
||||
Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
|
||||
|
||||
" Cleared on FileType
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
|
||||
call plug#end()
|
||||
|
||||
Assert exists(':EmojiCommandExtra'), 'EmojiCommandExtra not defined'
|
||||
Assert !empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) not defined'
|
||||
|
||||
setf emoji
|
||||
|
||||
Assert !exists(':EmojiCommandExtra'), 'EmojiCommandExtra defined'
|
||||
Assert empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) defined'
|
||||
|
||||
**********************************************************************
|
||||
Execute (#131 Syntax error):
|
||||
call plug#begin('/proc/no-permission')
|
||||
Plug 'junegunn/vim-emoji'
|
||||
call plug#end()
|
||||
|
||||
redir => out
|
||||
silent PlugInstall
|
||||
redir END
|
||||
Assert out =~ 'Invalid plug directory: /proc/no-permission', out
|
||||
|
||||
**********************************************************************
|
||||
Execute (#139-1 Using new remote branch):
|
||||
" Make sure to remove the clone
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Install master branch
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
|
||||
unlet! g:foo g:bar g:baz
|
||||
call plug#load('new-branch')
|
||||
Assert exists('g:foo'), 'g:foo should be found'
|
||||
Assert !exists('g:bar'), 'g:bar should not be found'
|
||||
Assert !exists('g:baz'), 'g:baz should not be found'
|
||||
|
||||
" Create a new branch on origin
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout -b new &&'
|
||||
\. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
|
||||
\. 'git commit -m second')
|
||||
|
||||
" We're setting up two plugins so that parallel installer is used
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
Log @"
|
||||
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
|
||||
|
||||
unlet! g:foo g:bar g:baz
|
||||
call plug#load('new-branch')
|
||||
Assert exists('g:foo'), 'g:foo should be found'
|
||||
Assert exists('g:bar'), 'g:bar should be found'
|
||||
Assert !exists('g:baz'), 'g:baz should not be found'
|
||||
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
- new-branch: OK
|
||||
- seoul256.vim: OK
|
||||
Finished. 0 error(s).
|
||||
[==]
|
||||
|
||||
Execute (#139-2 Using yet another new remote branch):
|
||||
" Create another branch on origin
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
|
||||
\. 'git checkout -b brand-new &&'
|
||||
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
|
||||
\. 'git commit -m third')
|
||||
|
||||
" Test Vim installer here
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'brand-new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
Log @"
|
||||
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
|
||||
|
||||
unlet! g:foo g:bar g:baz
|
||||
call plug#load('new-branch')
|
||||
Assert exists('g:foo'), 'g:foo should be found'
|
||||
Assert !exists('g:bar'), 'g:bar should not be found'
|
||||
Assert exists('g:baz'), 'g:baz should be found'
|
||||
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
- new-branch: OK
|
||||
Finished. 0 error(s).
|
||||
[=]
|
||||
|
||||
Execute (#139-3 Should fail when not possible to fast-forward):
|
||||
" Commit on cloned repo
|
||||
call system('cd /tmp/vim-plug-test/plugged/new-branch && git checkout master &&'
|
||||
\. 'touch foobar && git add foobar && git commit -m foobar')
|
||||
|
||||
" Different commit on remote
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
|
||||
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
|
||||
|
||||
for multi in [0, 1]
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
if multi
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
endif
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
Assert @" =~ 'Not possible to fast-forward', @"
|
||||
endfor
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (#145: Merging on-demand loading triggers - cmd):
|
||||
unlet! g:xxx g:yyy
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'on': ['XXX', 'YYY'] }
|
||||
call plug#end()
|
||||
|
||||
silent! XXX
|
||||
|
||||
Assert exists('g:xxx'), 'xxx is not loaded'
|
||||
Assert exists('g:yyy'), 'yyy is not loaded'
|
||||
Assert !exists(':YYY')
|
||||
|
||||
Execute (#145: Merging on-demand loading triggers - map):
|
||||
unlet! g:xxx g:yyy
|
||||
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
|
||||
call plug#end()
|
||||
|
||||
Assert !empty(mapcheck("<Plug>(xxx)"))
|
||||
Assert !empty(mapcheck("<Plug>(yyy)"))
|
||||
|
||||
# FIXME feedkeys() cannot be tested with Vader
|
||||
call plug#load('xxx', 'yyy')
|
||||
Assert empty(mapcheck("<Plug>(xxx)"))
|
||||
Assert empty(mapcheck("<Plug>(yyy)"))
|
||||
|
||||
**********************************************************************
|
||||
Execute (#159: shell=/bin/tcsh):
|
||||
let org = &shell
|
||||
try
|
||||
set shell=/bin/tcsh
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
|
||||
PlugStatus
|
||||
Log getline(1, '$')
|
||||
q
|
||||
AssertEqual '/bin/tcsh', &shell
|
||||
finally
|
||||
let &shell = org
|
||||
endtry
|
||||
|
||||
**********************************************************************
|
||||
Execute (#154: Spaces in &rtp should not be escaped):
|
||||
call plug#begin('/tmp/vim-plug-test/plug it')
|
||||
Plug 'seoul256 vim'
|
||||
call plug#end()
|
||||
Log &rtp
|
||||
Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
|
||||
|
||||
**********************************************************************
|
||||
Execute (#184: Duplicate entries in &rtp):
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'plugin1'
|
||||
\| Plug 'plugin0'
|
||||
|
||||
Plug 'plugin2'
|
||||
\| Plug 'plugin0'
|
||||
\| Plug 'plugin1'
|
||||
call plug#end()
|
||||
|
||||
Log &rtp
|
||||
AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0'))
|
||||
|
||||
**********************************************************************
|
||||
Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
||||
unlet! g:loaded_easy_align_plugin
|
||||
silent! delc EasyAlign
|
||||
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
|
||||
Assert &rtp !~ '/vim-easy-align', 'Plugin should not be in &rtp'
|
||||
%EasyAlign=
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
|
||||
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
|
||||
|
||||
**********************************************************************
|
||||
Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Shallow clone. We should have at least 2 plugins to enable parallel installer.
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
|
||||
|
||||
" Now unshallowed
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.0' }
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (#474: Load ftdetect files in filetypedetect augroup):
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/rust.vim', { 'for': 'rust', 'commit': '115d321d383eb96d438466c56cc871fcc1bd0faa' }
|
||||
call plug#end()
|
||||
PlugInstall!
|
||||
q
|
||||
|
||||
tabnew /tmp/vim-plug-test/any.rs
|
||||
AssertEqual 'rust', &filetype
|
||||
Log &filetype
|
||||
filetype detect
|
||||
AssertEqual 'rust', &filetype
|
||||
Log &filetype
|
||||
bd
|
||||
|
||||
**********************************************************************
|
||||
Execute (#489 On-demand loading with 'on' option should trigger BufRead autocmd):
|
||||
call plug#begin('$PLUG_FIXTURES')
|
||||
Plug 'ftplugin-msg', { 'on': 'XXX' }
|
||||
call plug#end()
|
||||
|
||||
tabnew a.java
|
||||
redir => out
|
||||
silent! XXX
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin-java') >= 0
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (Cursor moved to another window during post-update hook):
|
||||
function! DoSplit(...)
|
||||
new
|
||||
call setline(1, 'empty')
|
||||
endfunction
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/rust.vim', { 'do': function('DoSplit') }
|
||||
call plug#end()
|
||||
PlugInstall!
|
||||
AssertEqual 1, line('$')
|
||||
AssertEqual 'empty', getline(1)
|
||||
q!
|
||||
q
|
||||
145
test/run
145
test/run
@@ -1,46 +1,121 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname $BASH_SOURCE)
|
||||
cd ..
|
||||
PLUG_SRC=$(pwd)/plug.vim
|
||||
cd - > /dev/null
|
||||
cd $(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
if [ ! -d vader.vim ]; then
|
||||
git clone https://github.com/junegunn/vader.vim.git
|
||||
fi
|
||||
export BASE="$PWD"
|
||||
export PLUG_SRC="$PWD/../plug.vim"
|
||||
export PLUG_FIXTURES="$PWD/fixtures"
|
||||
mkdir -p "$PLUG_FIXTURES"
|
||||
export TEMP=/tmp/vim-plug-test
|
||||
rm -rf "$TEMP"
|
||||
mkdir -p "$TEMP"
|
||||
|
||||
rm -rf fzf
|
||||
if [ ! -d fzf-staged ]; then
|
||||
git clone https://github.com/junegunn/fzf.git fzf-staged
|
||||
fi
|
||||
|
||||
make_dirs() {
|
||||
mkdir -p "$1"
|
||||
cd "$1"
|
||||
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
||||
for d in *; do
|
||||
cat > $d/xxx.vim << EOF
|
||||
" echom expand('<sfile>')
|
||||
let g:xxx = get(g:, 'xxx', [])
|
||||
call add(g:xxx, '${1:4}/$d')
|
||||
EOF
|
||||
done
|
||||
cd - > /dev/null
|
||||
}
|
||||
|
||||
make_dirs xxx/
|
||||
make_dirs xxx/after
|
||||
|
||||
cat > /tmp/mini-vimrc << VIMRC
|
||||
set rtp+=vader.vim
|
||||
cat > $TEMP/mini-vimrc << VIMRC
|
||||
set rtp+=$TEMP/junegunn/vader.vim
|
||||
set shell=/bin/bash
|
||||
source $PLUG_SRC
|
||||
VIMRC
|
||||
|
||||
clone() {
|
||||
if [ ! -d $2 ]; then
|
||||
git clone $1 $2
|
||||
fi
|
||||
}
|
||||
|
||||
clone_repos() (
|
||||
cd $TEMP
|
||||
mkdir -p junegunn vim-scripts jg
|
||||
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
|
||||
vim-oblique vim-pseudocl vim-redis vim-emoji; do
|
||||
clone https://github.com/junegunn/${repo}.git junegunn/$repo &
|
||||
done
|
||||
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
|
||||
clone https://github.com/junegunn/fzf.git fzf &
|
||||
clone https://github.com/yous/subsubmodule.git yous/subsubmodule && \
|
||||
(cd yous/subsubmodule && git submodule update --init --recursive &) &
|
||||
wait
|
||||
|
||||
clone junegunn/vim-emoji jg/vim-emoji
|
||||
cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master
|
||||
)
|
||||
|
||||
make_dirs() (
|
||||
rm -rf "$PLUG_FIXTURES/$1"
|
||||
mkdir -p "$PLUG_FIXTURES/$1"
|
||||
cd "$PLUG_FIXTURES/$1"
|
||||
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
||||
for d in *; do
|
||||
[ -d $d ] || continue
|
||||
cat > $d/xxx.vim << EOF
|
||||
" echom expand('<sfile>')
|
||||
let g:total_order = get(g:, 'total_order', [])
|
||||
let g:$2 = get(g:, '$2', [])
|
||||
let s:name = join(filter(['$2', '${1:4}', '$d'], '!empty(v:val)'), '/')
|
||||
call add(g:$2, s:name)
|
||||
call add(g:total_order, s:name)
|
||||
EOF
|
||||
done
|
||||
)
|
||||
|
||||
gitinit() (
|
||||
cd "$PLUG_FIXTURES/$1"
|
||||
git init
|
||||
git commit -m 'commit' --allow-empty
|
||||
)
|
||||
|
||||
prepare() {
|
||||
make_dirs xxx/ xxx
|
||||
make_dirs xxx/after xxx
|
||||
mkdir -p "$PLUG_FIXTURES/xxx/doc"
|
||||
cat > "$PLUG_FIXTURES/xxx/doc/xxx.txt" << DOC
|
||||
hello *xxx*
|
||||
DOC
|
||||
gitinit xxx
|
||||
|
||||
make_dirs yyy/ yyy
|
||||
make_dirs yyy/after yyy
|
||||
gitinit yyy
|
||||
|
||||
make_dirs z1/ z1
|
||||
make_dirs z2/ z2
|
||||
|
||||
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
||||
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
|
||||
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
|
||||
|
||||
rm -rf $TEMP/new-branch
|
||||
cd $TEMP
|
||||
git init new-branch
|
||||
cd new-branch
|
||||
mkdir plugin
|
||||
echo 'let g:foo = 1' > plugin/foo.vim
|
||||
git add plugin/foo.vim
|
||||
git commit -m initial
|
||||
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
select_vim() {
|
||||
local vim=/usr/bin/vim
|
||||
if [ -n "$DEPS" ] && [ -e "${DEPS}/bin/vim" ]; then
|
||||
vim="${DEPS}/bin/vim"
|
||||
elif [ -e "/usr/local/bin/vim" ]; then
|
||||
vim=/usr/local/bin/vim
|
||||
fi
|
||||
echo $vim
|
||||
}
|
||||
|
||||
clone_repos
|
||||
prepare
|
||||
|
||||
git --version
|
||||
VIM=$(select_vim)
|
||||
echo "Selected Vim: $VIM"
|
||||
if [ "$1" = '!' ]; then
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null &&
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! workflow.vader' > /dev/null
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
prepare &&
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
else
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'Vader test.vader'
|
||||
fi
|
||||
|
||||
|
||||
99
test/test.vader
Normal file
99
test/test.vader
Normal file
@@ -0,0 +1,99 @@
|
||||
Execute (Initialize test environment):
|
||||
Save &rtp, g:plugs, g:plug_home, g:plug_window
|
||||
unlet! g:plugs g:plug_home g:plug_window
|
||||
|
||||
let g:plug_url_format = 'file:///tmp/vim-plug-test/%s'
|
||||
let g:base_rtp = &rtp
|
||||
let g:first_rtp = split(&rtp, ',')[0]
|
||||
let g:last_rtp = split(&rtp, ',')[-1]
|
||||
let g:temp_plugged = tempname()
|
||||
if !exists('$PLUG_SRC')
|
||||
let $PLUG_SRC = globpath(&rtp, 'autoload/plug.vim')
|
||||
endif
|
||||
let $PLUG_TMP = fnamemodify(tempname(), ':h').'/plug.vim'
|
||||
|
||||
" Temporarily patch plug.vim
|
||||
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
|
||||
call writefile(extend(readfile($PLUG_TMP),
|
||||
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_TMP)
|
||||
|
||||
set t_Co=256
|
||||
colo default
|
||||
pclose
|
||||
|
||||
function! PlugStatusSorted()
|
||||
PlugStatus
|
||||
%y
|
||||
q
|
||||
normal! P
|
||||
%sort
|
||||
g/^$/d
|
||||
endfunction
|
||||
|
||||
function! AssertExpect(bang, pat, cnt)
|
||||
let op = a:bang ? '==#' : '=~#'
|
||||
AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
|
||||
endfunction
|
||||
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
|
||||
|
||||
function! EnsureLoaded()
|
||||
if has('vim_starting')
|
||||
runtime! plugin/**/*.vim
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! RmRf(file)
|
||||
call system(printf('rm -rf "%s"', a:file))
|
||||
endfunction
|
||||
|
||||
function! ReloadPlug()
|
||||
call ResetPlug()
|
||||
source $PLUG_TMP
|
||||
let &rtp = g:base_rtp
|
||||
endfunction
|
||||
|
||||
function! GitBranch(repo)
|
||||
return system(printf('cd %s && git rev-parse --abbrev-ref HEAD', g:plugs[a:repo].dir))[:-2]
|
||||
endfunction
|
||||
|
||||
function! GitTag(repo)
|
||||
return system(printf('cd %s && git describe --tags', g:plugs[a:repo].dir))[:-2]
|
||||
endfunction
|
||||
|
||||
function! GitCommit(repo)
|
||||
return system(printf('cd %s && git rev-parse HEAD', g:plugs[a:repo].dir))[:-2]
|
||||
endfunction
|
||||
|
||||
source $PLUG_TMP
|
||||
|
||||
Execute (Print Interpreter Version):
|
||||
redir => out
|
||||
if has('ruby')
|
||||
silent ruby puts 'Ruby: ' + RUBY_VERSION
|
||||
elseif has('python')
|
||||
silent python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2])
|
||||
elseif has('python3')
|
||||
silent python3 import sys; svi = sys.version_info; print('Python: {}.{}.{}'.format(svi[0], svi[1], svi[2]))
|
||||
endif
|
||||
redir END
|
||||
Log substitute(out, '\n', '', 'g')
|
||||
|
||||
Include: workflow.vader
|
||||
Include: regressions.vader
|
||||
|
||||
Execute (Cleanup):
|
||||
silent! call RmRf(g:temp_plugged)
|
||||
silent! unlet g:plugs g:plug_home g:plug_url_format
|
||||
silent! unlet g:temp_plugged g:first_rtp g:last_rtp g:base_rtp out
|
||||
silent! delf PlugStatusSorted
|
||||
silent! delf AssertExpect
|
||||
silent! delf PlugUpdated
|
||||
silent! delf EnsureLoaded
|
||||
silent! delf ReloadPlug
|
||||
silent! delc AssertExpect
|
||||
silent! unmap /
|
||||
silent! unmap ?
|
||||
call delete($PLUG_TMP)
|
||||
|
||||
Restore
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user