Compare commits
436 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d80f495fab | ||
|
d863d07832 | ||
|
b98b66242b | ||
|
db37a8a29a | ||
|
7095372c4b | ||
|
3f1daea5bd | ||
|
9b4ecd1bb5 | ||
|
c0992146e2 | ||
|
47ca942ea4 | ||
|
d977fa3786 | ||
|
24d7ac280f | ||
|
2cd7bf673b | ||
|
d54f8d5bbd | ||
|
61b6df67b4 | ||
|
94b7aa99a9 | ||
|
03a9bb6d84 | ||
|
854b081934 | ||
|
3049761d47 | ||
|
ed19478ce2 | ||
|
e2974a3367 | ||
|
2f8f04cf79 | ||
|
3264b81e7a | ||
|
64b9f9e3c3 | ||
|
6154433e22 | ||
|
eee20c7e79 | ||
|
ade078e362 | ||
|
6dd068e8d8 | ||
|
e07c18608f | ||
|
ca0ae0a8b1 | ||
|
034e844590 | ||
|
ddce935b16 | ||
|
e531dbec2a | ||
|
b6739f358b | ||
|
f308ef394e | ||
|
d94d234548 | ||
|
d6cb65753f | ||
|
87a160a1c3 | ||
|
8fdabfba0b | ||
|
be55ec46b5 | ||
|
93ab590978 | ||
|
e300178a0e | ||
|
f085751ca1 | ||
|
68488fd7a3 | ||
|
93a115718f | ||
|
c9971346bb | ||
|
66e038d443 | ||
|
fc2813ef44 | ||
|
cffcfe150b | ||
|
8b45742540 | ||
|
5430b6213a | ||
|
2f4e28161e | ||
|
ab940f624a | ||
|
c44422460e | ||
|
d16273e072 | ||
|
b17f477585 | ||
|
4a3e85e878 | ||
|
a9bf5bd722 | ||
|
e8892a9bef | ||
|
49be3a8ca9 | ||
|
95ef5e8d5f | ||
|
6fa6475fee | ||
|
588467903b | ||
|
5706f70f8f | ||
|
4a3c5e7ac2 | ||
|
d53d5a976f | ||
|
13ea184015 | ||
|
457bebcd30 | ||
|
b2133cf2ec | ||
|
c319036396 | ||
|
3aa3b5a4e8 | ||
|
01aab60ade | ||
|
6583b99032 | ||
|
71c41fccf5 | ||
|
8846bc6af1 | ||
|
0862a76fdd | ||
|
54d837fa54 | ||
|
e718868e85 | ||
|
668bc0fd2a | ||
|
c3b6b7c297 | ||
|
2f5f74e5e6 | ||
|
b2aa5724c0 | ||
|
359ce90b9b | ||
|
e6ed2e5658 | ||
|
897ce5e2fa | ||
|
d2f8ca2dbc | ||
|
93b702512d | ||
|
68fef9c2fd | ||
|
eee50c55bf | ||
|
96046c01c3 | ||
|
fcfd5b7e1f | ||
|
849b76be90 | ||
|
ff97806e50 | ||
|
68b31a4a66 | ||
|
46f843aafe | ||
|
ebd534c88b | ||
|
3b29e1e6e2 | ||
|
307b0f244d | ||
|
8a44109329 | ||
|
0b32d2d23e | ||
|
226d6abeb2 | ||
|
fddbcb8f1a | ||
|
f1ad2d864a | ||
|
08e78d8a5e | ||
|
518a3566c3 | ||
|
d1c19a6fa9 | ||
|
734d9a11b5 | ||
|
b6050d6f03 | ||
|
7f8fdd0444 | ||
|
8ed2617ba0 | ||
|
0a255ee62d | ||
|
e0ca037a4f | ||
|
f80eed7379 | ||
|
fef4e434ba | ||
|
e6a775e0df | ||
|
96375cb7d3 | ||
|
2f4dc4d482 | ||
|
9813d5ead5 | ||
|
ddc67fc136 | ||
|
cd44b03db2 | ||
|
4f95bce2f4 | ||
|
7f96c98b0a | ||
|
05c8983d1a | ||
|
b93975f794 | ||
|
88cc9d7868 | ||
|
cd39fa6133 | ||
|
449b4f1ed6 | ||
|
802b100415 | ||
|
06992bcfb9 | ||
|
f7e6a86807 | ||
|
61ffb61615 | ||
|
9dcab48628 | ||
|
1d3c88292b | ||
|
580f0a559c | ||
|
46ae29985d | ||
|
7f4e6cb843 | ||
|
769192d3d0 | ||
|
e3252aae2c | ||
|
f551a71688 | ||
|
e80a93d5d0 | ||
|
d1ac3cdd1f | ||
|
359a65230e | ||
|
5e6bd469ac | ||
|
8c1aff151d | ||
|
d6bda025f1 | ||
|
5fc9eab788 | ||
|
93ffcb36de | ||
|
d5e9f91c7b | ||
|
0b1343b582 | ||
|
f916aabfbe | ||
|
b50f9bb16b | ||
|
8180692f81 | ||
|
a4aac4cf56 | ||
|
5bccd9bc98 | ||
|
1540764563 | ||
|
b9022d9046 | ||
|
c53ecd3acd | ||
|
ca0b726f46 | ||
|
942f994844 | ||
|
6ad18f5fb8 | ||
|
46ddb4af2d | ||
|
54683aa2c7 | ||
|
8f38888fad | ||
|
abbbe914f0 | ||
|
1f4e3eb063 | ||
|
2fa2761b99 | ||
|
078f32142d | ||
|
49c6b781e0 | ||
|
f4427b97f1 | ||
|
6287ba88d5 | ||
|
1bbb7a55e3 | ||
|
d1022e948e | ||
|
b94607b172 | ||
|
6bff19c2a9 | ||
|
759103d074 | ||
|
b32169ff30 | ||
|
3f7344d2cc | ||
|
7928057108 | ||
|
c66e264d41 | ||
|
01e4e9170a | ||
|
0662b5f4cc | ||
|
a2f1ea481d | ||
|
7bad3e7802 | ||
|
6575bd65b1 | ||
|
5d8c4bfc1f | ||
|
c0a83826f9 | ||
|
6454158846 | ||
|
1f206db965 | ||
|
f4381fb748 | ||
|
561518fd8c | ||
|
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 |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
github: junegunn
|
37
.github/ISSUE_TEMPLATE.md
vendored
Normal file
37
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<!--
|
||||||
|
### 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 ...
|
||||||
|
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
<!-- Paste your Plug block (from `call plug#begin()` to `call plug#end()`) -->
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- Paste the contents of `:version` below -->
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- Check all that apply. -->
|
||||||
|
- Type:
|
||||||
|
- [ ] Bug
|
||||||
|
- [ ] Enhancement
|
||||||
|
- [ ] Feature Request
|
||||||
|
- [ ] Question
|
||||||
|
- OS:
|
||||||
|
- [ ] All/Other
|
||||||
|
- [ ] Linux
|
||||||
|
- [ ] macOS
|
||||||
|
- [ ] 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 ...
|
52
.github/workflows/test.yml
vendored
Normal file
52
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
---
|
||||||
|
name: Test vim-plug
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master, devel]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
vim:
|
||||||
|
- vim
|
||||||
|
# FIXME: (core dumped) https://github.com/junegunn/vim-plug/runs/4422576984?check_suite_focus=true#step:3:238
|
||||||
|
# - neovim-stable
|
||||||
|
# - neovim-unstable
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install packages and test
|
||||||
|
env:
|
||||||
|
ENV: ${{ matrix.vim }}
|
||||||
|
run: |
|
||||||
|
export DEPS=~/deps
|
||||||
|
export PATH=~/deps/bin:$PATH
|
||||||
|
|
||||||
|
git config --global user.email "you@example.com"
|
||||||
|
git config --global user.name "Your Name"
|
||||||
|
|
||||||
|
case "$ENV" in
|
||||||
|
vim)
|
||||||
|
sudo apt-get install vim
|
||||||
|
;;
|
||||||
|
neovim-*)
|
||||||
|
sudo add-apt-repository ppa:neovim-ppa/${ENV/neovim-/}
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install neovim
|
||||||
|
|
||||||
|
mkdir -p $DEPS/bin
|
||||||
|
echo 'nvim "$@"' > $DEPS/bin/vim
|
||||||
|
chmod +x $DEPS/bin/vim
|
||||||
|
export VADER_OUTPUT_FILE=/dev/stderr
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
test/run !
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
doc/tags
|
78
.travis.yml
78
.travis.yml
|
@ -1,15 +1,71 @@
|
||||||
language: ruby
|
language: minimal
|
||||||
rvm:
|
env:
|
||||||
- 1.8.7
|
global:
|
||||||
- 2.0.0
|
- DEPS=$HOME/deps
|
||||||
|
- PATH=$DEPS/bin:$PATH
|
||||||
|
jobs:
|
||||||
|
include:
|
||||||
|
- env: ENV=vim80-bionic
|
||||||
|
dist: bionic
|
||||||
|
stage: vim8
|
||||||
|
- env: ENV=vim-nightly
|
||||||
|
dist: trusty
|
||||||
|
stage: vim8
|
||||||
|
- env: ENV=neovim-stable
|
||||||
|
dist: bionic
|
||||||
|
addons: {apt: {packages: [neovim], sources: [{sourceline: 'ppa:neovim-ppa/stable'}]}}
|
||||||
|
stage: neovim
|
||||||
|
- env: ENV=neovim-nightly
|
||||||
|
dist: bionic
|
||||||
|
addons: {apt: {packages: [neovim], sources: [{sourceline: 'ppa:neovim-ppa/unstable'}]}}
|
||||||
|
stage: neovim
|
||||||
|
- env: ENV=vim74-trusty-python
|
||||||
|
dist: trusty
|
||||||
|
stage: vim74
|
||||||
|
- env: ENV=vim74-xenial-python3
|
||||||
|
dist: xenial
|
||||||
|
stage: vim74
|
||||||
|
- env: ENV=vim74-trusty-ruby
|
||||||
|
dist: trusty
|
||||||
|
addons: {apt: {packages: [vim-nox]}}
|
||||||
|
stage: vim74
|
||||||
|
- env: ENV=vim74-xenial-ruby
|
||||||
|
dist: xenial
|
||||||
|
addons: {apt: {packages: [vim-nox]}}
|
||||||
|
stage: vim74
|
||||||
|
- env: ENV=osx-highsierra
|
||||||
|
os: osx
|
||||||
|
osx_image: xcode9.4
|
||||||
|
stage: vim8
|
||||||
|
install: |
|
||||||
|
git config --global user.email "you@example.com"
|
||||||
|
git config --global user.name "Your Name"
|
||||||
|
|
||||||
before_script: |
|
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui "
|
||||||
hg clone https://code.google.com/p/vim/
|
case "$ENV" in
|
||||||
|
vim-*)
|
||||||
|
;;
|
||||||
|
neovim-*)
|
||||||
|
mkdir -p ${DEPS}/bin
|
||||||
|
ln -s /usr/bin/nvim ${DEPS}/bin/vim
|
||||||
|
export VADER_OUTPUT_FILE=/dev/stderr
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
vim74-* | vim80-*)
|
||||||
|
mkdir -p ${DEPS}/bin
|
||||||
|
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
git clone --depth 1 https://github.com/vim/vim
|
||||||
cd vim
|
cd vim
|
||||||
./configure --with-features=huge --enable-rubyinterp
|
export PATH=/usr/bin:$PATH
|
||||||
|
./configure $C_OPTS
|
||||||
make
|
make
|
||||||
sudo make install
|
make install
|
||||||
cd -
|
cd -
|
||||||
|
script: test/run !
|
||||||
script: |
|
|
||||||
test/run !
|
|
||||||
|
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 Junegunn Choi
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
502
README.md
502
README.md
|
@ -1,124 +1,403 @@
|
||||||

|
<div align="center">
|
||||||
[](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">
|
||||||
|
|
||||||
### Pros.
|
## Pros.
|
||||||
|
|
||||||
- Easier to setup: Single file. No boilerplate code required.
|
- Minimalist design
|
||||||
- Easier to use: Concise, intuitive syntax
|
- Just one file with no dependencies. Super easy to set up.
|
||||||
- [Super-fast](https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif)
|
- Concise, intuitive syntax that you can learn within minutes. No boilerplate code required.
|
||||||
parallel installation/update (requires
|
- No feature bloat
|
||||||
[+ruby](https://github.com/junegunn/vim-plug/wiki/ruby) or
|
- Extremely stable with flawless backward compatibility
|
||||||
[Neovim](http://neovim.org/))
|
- Works perfectly with all versions of Vim since 2006 and all versions of Neovim ever released
|
||||||
- On-demand loading to achieve
|
- [Super-fast][40/4] parallel installation/update
|
||||||
[fast startup time](http://junegunn.kr/images/vim-startup-time.png)
|
- 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
|
- Post-update hooks
|
||||||
- Can choose a specific branch or tag for each plugin
|
|
||||||
- Support for externally managed plugins
|
- Support for externally managed plugins
|
||||||
|
|
||||||
### Usage
|
[40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
|
||||||
|
[startup-time]: https://github.com/junegunn/vim-startuptime-benchmark#result
|
||||||
|
|
||||||
|
## 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 ~/.vim/autoload
|
and put it in the "autoload" directory.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Click to see the instructions</summary>
|
||||||
|
|
||||||
|
### Vim
|
||||||
|
|
||||||
|
#### Unix
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir -p ~/.vim/autoload
|
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||||
curl -fLo ~/.vim/autoload/plug.vim \
|
|
||||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
```
|
```
|
||||||
|
|
||||||
Edit your .vimrc
|
You can automate the process by putting the command in your Vim configuration
|
||||||
|
file as suggested [here][auto].
|
||||||
|
|
||||||
|
[auto]: https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
|
||||||
|
|
||||||
|
#### Windows (PowerShell)
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
|
||||||
|
ni $HOME/vimfiles/autoload/plug.vim -Force
|
||||||
|
```
|
||||||
|
|
||||||
|
### Neovim
|
||||||
|
|
||||||
|
#### Unix, Linux
|
||||||
|
|
||||||
|
```sh
|
||||||
|
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'
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Linux (Flatpak)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -fLo ~/.var/app/io.neovim.nvim/data/nvim/site/autoload/plug.vim --create-dirs \
|
||||||
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Windows (PowerShell)
|
||||||
|
|
||||||
|
```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
|
||||||
|
```
|
||||||
|
|
||||||
|
</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
|
```vim
|
||||||
call plug#begin('~/.vim/plugged')
|
call plug#begin()
|
||||||
|
|
||||||
" Make sure you use single quotes
|
" List your plugins here
|
||||||
Plug 'junegunn/seoul256.vim'
|
Plug 'tpope/vim-sensible'
|
||||||
Plug 'junegunn/vim-easy-align'
|
|
||||||
|
|
||||||
" 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'
|
|
||||||
|
|
||||||
" Plugin options
|
|
||||||
Plug 'nsf/gocode', { 'tag': 'go.weekly.2012-03-13', 'rtp': 'vim' }
|
|
||||||
|
|
||||||
" Plugin outside ~/.vim/plugged with post-update hook
|
|
||||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
|
|
||||||
|
|
||||||
" Unmanaged plugin (manually installed and updated)
|
|
||||||
Plug '~/my-prototype-plugin'
|
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
```
|
```
|
||||||
|
|
||||||
Reload .vimrc and `:PlugInstall` to install plugins.
|
Reload the file or restart Vim, then you can,
|
||||||
|
|
||||||
### Commands
|
* `: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
|
||||||
|
|
||||||
|
- See [tutorial] page to learn more about the basics of vim-plug
|
||||||
|
- See [tips] and [FAQ] pages for common problems and questions
|
||||||
|
|
||||||
|
[tutorial]: https://github.com/junegunn/vim-plug/wiki/tutorial
|
||||||
|
[tips]: https://github.com/junegunn/vim-plug/wiki/tips
|
||||||
|
[FAQ]: https://github.com/junegunn/vim-plug/wiki/faq
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
The following examples demonstrate the additional features of vim-plug.
|
||||||
|
|
||||||
|
### Vim script example
|
||||||
|
|
||||||
|
```vim
|
||||||
|
call plug#begin()
|
||||||
|
" The default plugin directory will be as follows:
|
||||||
|
" - Vim (Linux/macOS): '~/.vim/plugged'
|
||||||
|
" - Vim (Windows): '~/vimfiles/plugged'
|
||||||
|
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
|
||||||
|
" You can specify a custom plugin directory by passing it as the argument
|
||||||
|
" - e.g. `call plug#begin('~/.vim/plugged')`
|
||||||
|
" - Avoid using standard Vim directory names like 'plugin'
|
||||||
|
|
||||||
|
" Make sure you use single quotes
|
||||||
|
|
||||||
|
" 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': { -> 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)
|
||||||
|
Plug '~/my-prototype-plugin'
|
||||||
|
|
||||||
|
" Call plug#end to update &runtimepath and initialize the plugin system.
|
||||||
|
" - It automatically executes `filetype plugin indent on` and `syntax enable`
|
||||||
|
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
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
```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 unused directories (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` | 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 |
|
| `PlugSnapshot[!] [output path]` | Generate script for restoring the current snapshot of the plugins |
|
||||||
|
|
||||||
### `Plug` options
|
## `Plug` options
|
||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
| -------------- | ------------------------------------------------ |
|
| ----------------------- | ----------------------------------------------------------- |
|
||||||
| `branch`/`tag` | Branch or tag 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 |
|
||||||
| `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 update unless explicitly specified |
|
| `frozen` | Do not remove and do not update unless explicitly specified |
|
||||||
|
|
||||||
### Global options
|
## Global options
|
||||||
|
|
||||||
| Flag | Default | Description |
|
| Flag | Default | Description |
|
||||||
| ------------------- | --------------------------------- | ----------------------------------------------------------- |
|
| ------------------- | --------------------------------- | ------------------------------------------------------ |
|
||||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||||
| `g:plug_timeout` | 60 | Time limit of each task in seconds (*for Ruby installer*) |
|
| `g:plug_timeout` | 60 | Time limit of each task in seconds (*Ruby & Python*) |
|
||||||
| `g:plug_retries` | 2 | Number of retries in case of timeout (*for Ruby installer*) |
|
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
|
||||||
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
|
| `g:plug_shallow` | 1 | Use shallow clone |
|
||||||
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL |
|
| `g:plug_window` | `-tabnew` | Command to open plug window |
|
||||||
|
| `g:plug_pwindow` | `vertical rightbelow new` | 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) |
|
||||||
|
|
||||||
### 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` - Close the window
|
- `q` - Abort the running tasks or close the window
|
||||||
- `:PlugStatus`
|
- `:PlugStatus`
|
||||||
- `L` - Load plugin
|
- `L` - Load plugin
|
||||||
- `:PlugDiff`
|
- `:PlugDiff`
|
||||||
- `X` - Revert the update
|
- `X` - Revert the update
|
||||||
|
|
||||||
### Example: A small [sensible](https://github.com/tpope/vim-sensible) Vim configuration
|
## Post-update hooks
|
||||||
|
|
||||||
|
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
|
||||||
call plug#begin()
|
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
|
||||||
Plug 'tpope/vim-sensible'
|
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
|
||||||
call plug#end()
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### On-demand loading of plugins
|
If the value starts with `:`, it will be recognized as a Vim command.
|
||||||
|
|
||||||
|
```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 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||||
|
|
||||||
" Multiple commands
|
" Multiple commands
|
||||||
Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
|
Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
|
||||||
|
@ -131,71 +410,54 @@ Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
|
||||||
|
|
||||||
" On-demand loading on both conditions
|
" On-demand loading on both conditions
|
||||||
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
|
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
|
> [!NOTE]
|
||||||
usually don't have too much code in `plugin` directory. You might want to
|
> #### Should I set up on-demand loading?
|
||||||
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.
|
||||||
|
|
||||||
### Post-update hooks
|
> [!TIP]
|
||||||
|
> You can pass an empty list to `on` or `for` option to disable the loading
|
||||||
|
> of the plugin. You can manually load the plugin using `plug#load(NAMES...)`
|
||||||
|
> function.
|
||||||
|
>
|
||||||
|
> See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually
|
||||||
|
|
||||||
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
|
## Collaborators
|
||||||
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' }
|
|
||||||
```
|
|
||||||
|
|
||||||
If you need more control, you can pass a reference to a Vim function that
|
- [Jan Edmund Lazo](https://github.com/janlazo) - Windows support
|
||||||
takes a single argument.
|
- [Jeremy Pallats](https://github.com/starcraftman) - Python installer
|
||||||
|
|
||||||
```vim
|
## License
|
||||||
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.sh
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
|
|
||||||
```
|
|
||||||
|
|
||||||
Both forms of post-update hook are executed inside the directory of the plugin
|
|
||||||
and only run when the repository has changed, but you can force it to run
|
|
||||||
unconditionally with the bang-versions of the commands: `PlugInstall!` and
|
|
||||||
`PlugUpdate!`.
|
|
||||||
|
|
||||||
Make sure to escape BARs and double-quotes when you write `do` option inline
|
|
||||||
as they are mistakenly recognized as command separator or the start of the
|
|
||||||
trailing comment.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
|
|
||||||
```
|
|
||||||
|
|
||||||
But you can avoid the escaping if you extract the inline specification using a
|
|
||||||
variable (or any Vimscript expression) as follows:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:fzf_install = 'yes | ./install'
|
|
||||||
Plug 'junegunn/fzf', { 'do': g:fzf_install }
|
|
||||||
```
|
|
||||||
|
|
||||||
### FAQ/Troubleshooting
|
|
||||||
|
|
||||||
See [FAQ/Troubleshooting](https://github.com/junegunn/vim-plug/wiki/faq).
|
|
||||||
|
|
||||||
### Articles
|
|
||||||
|
|
||||||
- [Writing my own Vim plugin manager](http://junegunn.kr/2013/09/writing-my-own-vim-plugin-manager)
|
|
||||||
- [Vim plugins and startup time](http://junegunn.kr/2014/07/vim-plugins-and-startup-time)
|
|
||||||
- ~~[Thoughts on Vim plugin dependency](http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency)~~
|
|
||||||
- *Support for Plugfile has been removed since 0.5.0*
|
|
||||||
|
|
||||||
### License
|
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|
||||||
|
|
428
doc/plug.txt
Normal file
428
doc/plug.txt
Normal file
|
@ -0,0 +1,428 @@
|
||||||
|
plug.txt plug Last change: Jun 1 2024
|
||||||
|
PLUG - TABLE OF CONTENTS *plug* *plug-toc*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
vim-plug |vim-plug|
|
||||||
|
Pros. |plug-pros|
|
||||||
|
Installation |plug-installation|
|
||||||
|
Usage |plug-usage|
|
||||||
|
Getting Help |plug-getting-help|
|
||||||
|
Examples |plug-examples|
|
||||||
|
Vim script example |plug-vim-script-example|
|
||||||
|
Lua example for Neovim |plug-lua-example-for-neovim|
|
||||||
|
Commands |plug-commands|
|
||||||
|
Plug options |plug-options|
|
||||||
|
Global options |plug-global-options|
|
||||||
|
Keybindings |plug-keybindings|
|
||||||
|
Post-update hooks |plug-post-update-hooks|
|
||||||
|
PlugInstall! and PlugUpdate! |pluginstall-and-plugupdate|
|
||||||
|
On-demand loading of plugins |plug-on-demand-loading-of-plugins|
|
||||||
|
Collaborators |plug-collaborators|
|
||||||
|
License |plug-license|
|
||||||
|
|
||||||
|
VIM-PLUG *vim-plug*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
A minimalist Vim plugin manager.
|
||||||
|
|
||||||
|
|
||||||
|
PROS. *plug-pros*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
- Minimalist design
|
||||||
|
- Just one file with no dependencies. Super easy to set up.
|
||||||
|
- 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}{1} parallel installation/update
|
||||||
|
- Creates shallow clones to minimize disk space usage and download time
|
||||||
|
- On-demand loading for {faster startup time}{2}
|
||||||
|
- Can review and rollback updates
|
||||||
|
- Branch/tag/commit support
|
||||||
|
- Post-update hooks
|
||||||
|
- Support for externally managed plugins
|
||||||
|
|
||||||
|
{1} https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
|
||||||
|
{2} https://github.com/junegunn/vim-startuptime-benchmark#result
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLATION *plug-installation*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
{Download plug.vim}{3} and put it in the "autoload" directory.
|
||||||
|
|
||||||
|
{3} https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
|
||||||
|
|
||||||
|
USAGE *plug-usage*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
Add a vim-plug section to your `~/.vimrc` (or `init.vim` for Neovim)
|
||||||
|
|
||||||
|
*plug#begin* *plug#end*
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
" List your plugins here
|
||||||
|
Plug 'tpope/vim-sensible'
|
||||||
|
|
||||||
|
call plug#end()
|
||||||
|
<
|
||||||
|
Reload the file or restart Vim, then you can,
|
||||||
|
|
||||||
|
*:PlugInstall* *:PlugUpdate* *:PlugDiff*
|
||||||
|
|
||||||
|
- `:PlugInstall` to install the plugins
|
||||||
|
- `:PlugUpdate` to install or update the plugins
|
||||||
|
- `:PlugDiff` to review the changes from the last update
|
||||||
|
|
||||||
|
[!NOTE] That's basically all you need to know to get started. The rest of the
|
||||||
|
document is for advanced users who want to know more about the features and
|
||||||
|
options.
|
||||||
|
|
||||||
|
|
||||||
|
< Getting Help >______________________________________________________________~
|
||||||
|
*plug-getting-help*
|
||||||
|
|
||||||
|
- See {tutorial}{4} page to learn more about the basics of vim-plug
|
||||||
|
- See {tips}{5} and {FAQ}{6} pages for common problems and questions
|
||||||
|
|
||||||
|
{4} https://github.com/junegunn/vim-plug/wiki/tutorial
|
||||||
|
{5} https://github.com/junegunn/vim-plug/wiki/tips
|
||||||
|
{6} https://github.com/junegunn/vim-plug/wiki/faq
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLES *plug-examples*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
The following examples demonstrate the additional features of vim-plug.
|
||||||
|
|
||||||
|
|
||||||
|
< Vim script example >________________________________________________________~
|
||||||
|
*plug-vim-script-example*
|
||||||
|
>
|
||||||
|
call plug#begin()
|
||||||
|
" The default plugin directory will be as follows:
|
||||||
|
" - Vim (Linux/macOS): '~/.vim/plugged'
|
||||||
|
" - Vim (Windows): '~/vimfiles/plugged'
|
||||||
|
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
|
||||||
|
" You can specify a custom plugin directory by passing it as the argument
|
||||||
|
" - e.g. `call plug#begin('~/.vim/plugged')`
|
||||||
|
" - Avoid using standard Vim directory names like 'plugin'
|
||||||
|
|
||||||
|
" Make sure you use single quotes
|
||||||
|
|
||||||
|
" 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': { -> 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)
|
||||||
|
Plug '~/my-prototype-plugin'
|
||||||
|
|
||||||
|
" Call plug#end to update &runtimepath and initialize the plugin system.
|
||||||
|
" - It automatically executes `filetype plugin indent on` and `syntax enable`
|
||||||
|
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 >____________________________________________________~
|
||||||
|
*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')
|
||||||
|
|
||||||
|
-- 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 *plug-commands*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
-------------------------------------+------------------------------------------------------------------
|
||||||
|
Command | Description ~
|
||||||
|
-------------------------------------+------------------------------------------------------------------
|
||||||
|
`PlugInstall [name ...] [#threads]` | Install plugins
|
||||||
|
`PlugUpdate [name ...] [#threads]` | Install or update plugins
|
||||||
|
`PlugClean[!]` | Remove unlisted plugins (bang version will clean without prompt)
|
||||||
|
`PlugUpgrade` | Upgrade vim-plug itself
|
||||||
|
`PlugStatus` | Check the status of plugins
|
||||||
|
`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 *plug-options*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
*<Plug>-mappings*
|
||||||
|
|
||||||
|
------------------------+------------------------------------------------------------
|
||||||
|
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 remove and do not update unless explicitly specified
|
||||||
|
------------------------+------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
GLOBAL OPTIONS *plug-global-options*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
*g:plug_threads* *g:plug_timeout* *g:plug_retries* *g:plug_shallow* *g:plug_window*
|
||||||
|
*g:plug_pwindow* *g:plug_url_format*
|
||||||
|
|
||||||
|
--------------------+-----------------------------------+-----------------------------------------------------------------------------------
|
||||||
|
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` | `-tabnew` | Command to open plug window
|
||||||
|
`g:plug_pwindow` | `vertical rightbelow new` | 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)
|
||||||
|
--------------------+-----------------------------------+-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
KEYBINDINGS *plug-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
|
||||||
|
|
||||||
|
|
||||||
|
POST-UPDATE HOOKS *plug-post-update-hooks*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
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' }
|
||||||
|
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
|
||||||
|
<
|
||||||
|
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! >______________________________________________~
|
||||||
|
*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 *plug-on-demand-loading-of-plugins*
|
||||||
|
==============================================================================
|
||||||
|
>
|
||||||
|
" NERD tree will be loaded on the first invocation of NERDTreeToggle command
|
||||||
|
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||||
|
|
||||||
|
" Multiple commands
|
||||||
|
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!'
|
||||||
|
<
|
||||||
|
[!NOTE] #### Should I set up on-demand loading?
|
||||||
|
|
||||||
|
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`.
|
||||||
|
>
|
||||||
|
vim --startuptime /tmp/log
|
||||||
|
<
|
||||||
|
On-demand loading should only be used as a last resort. It is basically a
|
||||||
|
hacky workaround and is not always guaranteed to work.
|
||||||
|
|
||||||
|
*plug#load*
|
||||||
|
|
||||||
|
[!TIP] You can pass an empty list to `on` or `for` option to disable the
|
||||||
|
loading of the plugin. You can manually load the plugin using
|
||||||
|
`plug#load(NAMES...)` function.
|
||||||
|
|
||||||
|
See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually
|
||||||
|
|
||||||
|
|
||||||
|
COLLABORATORS *plug-collaborators*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
- {Jan Edmund Lazo}{7} - Windows support
|
||||||
|
- {Jeremy Pallats}{8} - Python installer
|
||||||
|
|
||||||
|
{7} https://github.com/janlazo
|
||||||
|
{8} https://github.com/starcraftman
|
||||||
|
|
||||||
|
|
||||||
|
LICENSE *plug-license*
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
MIT
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:
|
BIN
plug-dark.png
Normal file
BIN
plug-dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
BIN
plug.png
BIN
plug.png
Binary file not shown.
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 23 KiB |
5
test/fixtures/.gitignore
vendored
5
test/fixtures/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
||||||
fzf*
|
|
||||||
xxx
|
|
||||||
yyy
|
|
||||||
z1
|
|
||||||
z2
|
|
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
|
@ -1 +0,0 @@
|
||||||
echomsg 'ftplugin'
|
|
41
test/functional.vader
Normal file
41
test/functional.vader
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
Execute (plug#shellescape() works without optional arguments):
|
||||||
|
if has('unix')
|
||||||
|
AssertEqual "''", plug#shellescape("")
|
||||||
|
AssertEqual "'foo'\\'''", plug#shellescape("foo'")
|
||||||
|
endif
|
||||||
|
|
||||||
|
Execute (plug#shellescape() ignores invalid optional argument):
|
||||||
|
if has('unix')
|
||||||
|
AssertEqual "''", plug#shellescape("", '')
|
||||||
|
AssertEqual "'foo'\\'''", plug#shellescape("foo'", [])
|
||||||
|
endif
|
||||||
|
|
||||||
|
Execute (plug#shellescape() depends on the shell):
|
||||||
|
AssertEqual "'foo'\\'''", plug#shellescape("foo'", {'shell': 'sh'})
|
||||||
|
AssertEqual '^"foo''^"', plug#shellescape("foo'", {'shell': 'cmd.exe'})
|
||||||
|
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'powershell'})
|
||||||
|
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'powershell.exe'})
|
||||||
|
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'pwsh'})
|
||||||
|
|
||||||
|
Execute (plug#shellescape() supports non-trivial cmd.exe escaping):
|
||||||
|
" batchfile
|
||||||
|
AssertEqual '^"^^%%PATH^^%%^"', plug#shellescape("^%PATH^%", {
|
||||||
|
\ 'shell': 'cmd.exe',
|
||||||
|
\ })
|
||||||
|
AssertEqual '^"^^%%PATH^^%%^"', plug#shellescape("^%PATH^%", {
|
||||||
|
\ 'shell': 'cmd.exe',
|
||||||
|
\ 'script': 1,
|
||||||
|
\ })
|
||||||
|
" command prompt
|
||||||
|
AssertEqual '^"^^^%PATH^^^%^"', plug#shellescape("^%PATH^%", {
|
||||||
|
\ 'shell': 'cmd.exe',
|
||||||
|
\ 'script': 0,
|
||||||
|
\ }),
|
||||||
|
|
||||||
|
Execute (plug#shellescape() supports non-trivial powershell.exe escaping):
|
||||||
|
AssertEqual '''\"Foo\\''''\\Bar\"''', plug#shellescape('"Foo\''\Bar"', {
|
||||||
|
\ 'shell': 'powershell',
|
||||||
|
\ }),
|
||||||
|
AssertEqual '''\"Foo\\''''\\Bar\"''', plug#shellescape('"Foo\''\Bar"', {
|
||||||
|
\ 'shell': 'powershell.exe',
|
||||||
|
\ }),
|
375
test/regressions.vader
Normal file
375
test/regressions.vader
Normal file
|
@ -0,0 +1,375 @@
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
||||||
|
call ResetPlug()
|
||||||
|
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, 'Unexpected output (1): '.out
|
||||||
|
|
||||||
|
* The same applies to plug#load())
|
||||||
|
call ResetPlug()
|
||||||
|
redir => out
|
||||||
|
call plug#load('ftplugin-msg')
|
||||||
|
redir END
|
||||||
|
Assert stridx(out, 'ftplugin-c') >= 0, 'Unexpected output (2): '.out
|
||||||
|
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
|
||||||
|
call mkdir(g:plugs['vim-emoji'].dir.'/after/plugin', 'p')
|
||||||
|
|
||||||
|
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 ResetPlug()
|
||||||
|
call plug#load('new-branch')
|
||||||
|
Assert exists('g:foo'), 'g:foo should be found (1)'
|
||||||
|
Assert !exists('g:bar'), 'g:bar should not be found (1)'
|
||||||
|
Assert !exists('g:baz'), 'g:baz should not be found (1)'
|
||||||
|
|
||||||
|
" 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 ResetPlug()
|
||||||
|
call plug#load('new-branch')
|
||||||
|
Assert exists('g:foo'), 'g:foo should be found (2)'
|
||||||
|
Assert exists('g:bar'), 'g:bar should be found (2)'
|
||||||
|
Assert !exists('g:baz'), 'g:baz should not be found (2)'
|
||||||
|
|
||||||
|
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 ResetPlug()
|
||||||
|
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 'foo/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 'foo/plugin1'
|
||||||
|
\| Plug 'foo/plugin0'
|
||||||
|
|
||||||
|
Plug 'foo/plugin2'
|
||||||
|
\| Plug 'foo/plugin0'
|
||||||
|
\| Plug 'foo/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/#587 On-demand loading with 'on' option should trigger BufRead autocmd w/o nomodeline):
|
||||||
|
call plug#begin('$PLUG_FIXTURES')
|
||||||
|
Plug 'foo/ftplugin-msg', { 'on': 'XXX' }
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
tabnew a.java
|
||||||
|
call setline(1, '// vim: set filetype=lava:')
|
||||||
|
redir => out
|
||||||
|
silent! XXX
|
||||||
|
redir END
|
||||||
|
Assert stridx(out, 'ftplugin-java') >= 0
|
||||||
|
AssertEqual 'lava', &filetype
|
||||||
|
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
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#593 Add plugin to &rtp before running post-update hook with : prefix):
|
||||||
|
call ReloadPlug()
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/vim-pseudocl', { 'on': 'XXX', 'do': ':let g:bar = pseudocl#complete#extract_words(''a b'')' }
|
||||||
|
call plug#end()
|
||||||
|
PlugInstall!
|
||||||
|
AssertEqual ['a', 'b'], g:bar
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#602 Confusion with branch name and path name):
|
||||||
|
call plug#begin()
|
||||||
|
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'plugin' }
|
||||||
|
call plug#end()
|
||||||
|
PlugUpdate
|
||||||
|
call PlugStatusSorted()
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
- new-branch: OK
|
||||||
|
Finished. 0 error(s).
|
||||||
|
[=]
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (PlugStatus showed error with wildcard tag):
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/vim-easy-align', { 'tag': '*' }
|
||||||
|
call plug#end()
|
||||||
|
PlugUpdate
|
||||||
|
call PlugStatusSorted()
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
- vim-easy-align: OK
|
||||||
|
Finished. 0 error(s).
|
||||||
|
[=]
|
136
test/run
136
test/run
|
@ -1,28 +1,55 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cd $(dirname $BASH_SOURCE)
|
# Privileged mode, ignores $CDPATH etc.
|
||||||
cd ..
|
set -p
|
||||||
PLUG_SRC=$(pwd)/plug.vim
|
set -eu
|
||||||
cd - > /dev/null
|
|
||||||
|
|
||||||
export PLUG_FIXTURES=$(pwd)/fixtures
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
if [ ! -d vader.vim ]; then
|
export BASE="$PWD"
|
||||||
git clone https://github.com/junegunn/vader.vim.git
|
export PLUG_SRC="$PWD/../plug.vim"
|
||||||
fi
|
export PLUG_FIXTURES="$PWD/fixtures"
|
||||||
|
mkdir -p "$PLUG_FIXTURES"
|
||||||
|
export TEMP=/tmp/vim-plug-test
|
||||||
|
rm -rf "$TEMP"
|
||||||
|
mkdir -p "$TEMP"
|
||||||
|
|
||||||
rm -rf $PLUG_FIXTURES/fzf
|
cat > $TEMP/mini-vimrc << VIMRC
|
||||||
if [ ! -d fzf-staged ]; then
|
set rtp+=$TEMP/junegunn/vader.vim
|
||||||
git clone https://github.com/junegunn/fzf.git $PLUG_FIXTURES/fzf-staged
|
set shell=/bin/bash
|
||||||
fi
|
VIMRC
|
||||||
|
|
||||||
make_dirs() {
|
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"
|
mkdir -p "$PLUG_FIXTURES/$1"
|
||||||
cd "$PLUG_FIXTURES/$1"
|
cd "$PLUG_FIXTURES/$1"
|
||||||
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
||||||
for d in *; do
|
for d in *; do
|
||||||
[ -d $d ] || continue
|
[ -d "$d" ] || continue
|
||||||
cat > $d/xxx.vim << EOF
|
cat > "$d/xxx.vim" << EOF
|
||||||
" echom expand('<sfile>')
|
" echom expand('<sfile>')
|
||||||
let g:total_order = get(g:, 'total_order', [])
|
let g:total_order = get(g:, 'total_order', [])
|
||||||
let g:$2 = get(g:, '$2', [])
|
let g:$2 = get(g:, '$2', [])
|
||||||
|
@ -31,39 +58,80 @@ make_dirs() {
|
||||||
call add(g:total_order, s:name)
|
call add(g:total_order, s:name)
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
cd - > /dev/null
|
)
|
||||||
}
|
|
||||||
|
|
||||||
init() {
|
gitinit() (
|
||||||
rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2}
|
cd "$PLUG_FIXTURES/$1"
|
||||||
|
git init -b master
|
||||||
|
git commit -m 'commit' --allow-empty
|
||||||
|
)
|
||||||
|
|
||||||
|
prepare() {
|
||||||
make_dirs xxx/ xxx
|
make_dirs xxx/ xxx
|
||||||
make_dirs xxx/after xxx
|
make_dirs xxx/after xxx
|
||||||
mkdir -p $PLUG_FIXTURES/xxx/doc
|
mkdir -p "$PLUG_FIXTURES/xxx/doc"
|
||||||
cat > $PLUG_FIXTURES/xxx/doc/xxx.txt << DOC
|
cat > "$PLUG_FIXTURES/xxx/doc/xxx.txt" << DOC
|
||||||
hello *xxx*
|
hello *xxx*
|
||||||
DOC
|
DOC
|
||||||
|
gitinit xxx
|
||||||
|
|
||||||
make_dirs yyy/ yyy
|
make_dirs yyy/ yyy
|
||||||
make_dirs yyy/after yyy
|
make_dirs yyy/after yyy
|
||||||
|
mkdir -p "$PLUG_FIXTURES/yyy/rtp/doc"
|
||||||
|
cat > "$PLUG_FIXTURES/yyy/rtp/doc/yyy.txt" << DOC
|
||||||
|
hello *yyy*
|
||||||
|
DOC
|
||||||
|
gitinit yyy
|
||||||
|
|
||||||
make_dirs z1/ z1
|
make_dirs z1/ z1
|
||||||
make_dirs z2/ z2
|
make_dirs z2/ z2
|
||||||
|
|
||||||
|
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
||||||
|
mkdir -p "$PLUG_FIXTURES"/ftplugin-msg/{plugin,ftplugin}
|
||||||
|
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||||
|
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
|
||||||
|
|
||||||
|
chmod +w "$PLUG_FIXTURES/cant-delete/autoload" || rm -rf "$PLUG_FIXTURES/cant-delete"
|
||||||
|
mkdir -p "$PLUG_FIXTURES/cant-delete/autoload"
|
||||||
|
touch "$PLUG_FIXTURES/cant-delete/autoload/cant-delete.vim"
|
||||||
|
chmod -w "$PLUG_FIXTURES/cant-delete/autoload"
|
||||||
|
|
||||||
|
rm -rf $TEMP/new-branch
|
||||||
|
cd $TEMP
|
||||||
|
git init new-branch -b master
|
||||||
|
cd new-branch
|
||||||
|
mkdir plugin
|
||||||
|
echo 'let g:foo = 1' > plugin/foo.vim
|
||||||
|
git add plugin/foo.vim
|
||||||
|
git commit -m initial
|
||||||
|
git checkout -b plugin
|
||||||
|
git checkout master
|
||||||
|
|
||||||
|
cd "$BASE"
|
||||||
}
|
}
|
||||||
|
|
||||||
cat > /tmp/mini-vimrc << VIMRC
|
select_vim() {
|
||||||
set rtp+=vader.vim
|
local vim=/usr/bin/vim
|
||||||
set shell=/bin/bash
|
if [ -n "${DEPS:-}" ] && [ -e "${DEPS}/bin/vim" ]; then
|
||||||
source $PLUG_SRC
|
vim="${DEPS}/bin/vim"
|
||||||
VIMRC
|
elif [ -e "/usr/local/bin/vim" ]; then
|
||||||
|
vim=/usr/local/bin/vim
|
||||||
|
fi
|
||||||
|
echo $vim
|
||||||
|
}
|
||||||
|
|
||||||
[ -z "$TMPDIR" ] && export TMPDIR=/tmp/
|
clone_repos
|
||||||
init
|
prepare
|
||||||
if [ "$1" = '!' ]; then
|
|
||||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null &&
|
git --version
|
||||||
init &&
|
vim=$(select_vim)
|
||||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! workflow.vader' > /dev/null
|
echo "Selected Vim: $vim"
|
||||||
|
if [ "${1:-}" = '!' ]; then
|
||||||
|
FAIL=0
|
||||||
|
$vim -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null || FAIL=1
|
||||||
|
prepare
|
||||||
|
$vim -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null || FAIL=1
|
||||||
|
test $FAIL -eq 0
|
||||||
else
|
else
|
||||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
|
$vim -Nu $TEMP/mini-vimrc -c 'Vader test.vader'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
106
test/test.vader
Normal file
106
test/test.vader
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
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"')
|
||||||
|
let patch =
|
||||||
|
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction',
|
||||||
|
\ 'function! CompareURI(a, b)', 'return s:compare_git_uri(a:a, a:b)', 'endfunction']
|
||||||
|
|
||||||
|
call writefile(extend(readfile($PLUG_TMP), patch), $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 ? '==#' : '=~#'
|
||||||
|
let args = [a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))] + a:000
|
||||||
|
call call('vader#assert#equal', args)
|
||||||
|
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
|
||||||
|
endif
|
||||||
|
if has('python')
|
||||||
|
silent! python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2])
|
||||||
|
endif
|
||||||
|
if has('python3')
|
||||||
|
silent! python3 import sys; svi = sys.version_info; print('Python: {}.{}.{}'.format(svi[0], svi[1], svi[2]))
|
||||||
|
endif
|
||||||
|
redir END
|
||||||
|
Log split(out, '\n')
|
||||||
|
|
||||||
|
Include: workflow.vader
|
||||||
|
Include: regressions.vader
|
||||||
|
Include: functional.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
|
||||||
|
|
1042
test/workflow.vader
1042
test/workflow.vader
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user