112 Commits
0.7.0 ... 0.8.0

Author SHA1 Message Date
Junegunn Choi
77413875da Amend comment section 2015-12-23 13:17:34 +09:00
Junegunn Choi
f695463daf Merge pull request #366 from junegunn/diff-origin
PlugDiff to show pending updates as well
2015-12-23 13:16:27 +09:00
Junegunn Choi
e6f40479ee PlugDiff to show pending updates as well
Related: #348
2015-12-23 13:12:06 +09:00
Junegunn Choi
6843e5aeec Merge pull request #361 from junegunn/snapshot-in-vimscript
PlugSnapshot output in Vim script format (#360)
2015-12-17 23:34:37 +09:00
Junegunn Choi
0cfa683cd0 PlugSnapshot output in Vim script format (#360)
- The output file is no longer executable but a source-able vim script
- PlugSnapshot FILENAME to prompt the user if the file already exists
- Add PlugSnapshot! FILENAME variant to force overwrite existing file
- Apply -complete=file option to PlugSnapshot command
2015-12-17 16:06:19 +09:00
Junegunn Choi
e929534199 Fix #362 - Do not show future changes in PlugDiff 2015-12-16 22:56:57 +09:00
Junegunn Choi
52d7da3925 Fix #355 - PlugSnapshot to create scripts that disable shallow-clone 2015-12-14 23:16:50 +09:00
Jeremy Pallats/starcraft.man
cd26cd562e Merge pull request #357 from starcraftman/win_cd
Fix #353: Not Working On Windows
2015-12-13 14:26:22 -05:00
Jeremy Pallats/starcraft.man
24a71f9a91 Fix #353: Not Working On Windows
* First fix was only partial, allow drive letter changes.
2015-12-13 14:11:42 -05:00
Jeremy Pallats/starcraft.man
b836656556 Merge pull request #354 from starcraftman/trail_slash
Fix #353: Not Working On Windows
2015-12-13 13:31:59 -05:00
Jeremy Pallats/starcraft.man
7f598e5b58 Fix #353: Not Working On Windows
* Trailing slash appears to break clone command.
2015-12-13 13:10:06 -05:00
Junegunn Choi
87b426e381 Fix #350 - Tagged plugin should be unshallowed on update
Ruby installer failed to do so due to invalid escaping
2015-12-11 23:11:21 +09:00
Junegunn Choi
ba97f4458e Merge pull request #342 from mattn/windows 2015-12-10 01:04:05 +09:00
Yasuhiro Matsumoto
060c0e6d6c Enable multi-thread on windows
Specify PIPE as stdin for subprocess.Pipe for gvim.exe.
Also fixes some ruby implementation.

* windows doesn't have pgrep.
* windows can't handle SIGTERM.
* windows can't handle /dev/null
* redraw always
2015-12-10 01:00:42 +09:00
Jeremy Pallats/starcraft.man
80e5b3eab5 Merge pull request #345 from starcraftman/fix_msys
Merging fix for msys2.
2015-12-06 12:06:32 -05:00
Jeremy Pallats/starcraft.man
aae282e4f0 Fix msys2: prepend cd to commands 2015-12-06 11:50:37 -05:00
Junegunn Choi
7cdd4036de Fix nvim output format (#340) 2015-12-06 01:15:28 +09:00
Jeremy Pallats/starcraft.man
173bfea4c5 Merge pull request #337 from starcraftman/power_readme
Ensure CWD isn't a factor for powershell command.
2015-11-29 15:59:58 -05:00
Jeremy Pallats/starcraft.man
c233234bd9 Ensure CWD isn't a factor for powershell command. 2015-11-29 15:56:13 -05:00
Junegunn Choi
84faabe4cc Bind q to :bd
Close #336. Also remove unnecessary echo.
2015-11-29 22:12:55 +09:00
Junegunn Choi
6173ecc210 Merge pull request #334 from starcraftman/update_travis
Migrate travis to use new docker system.
2015-11-29 03:44:24 +09:00
Jeremy Pallats/starcraft.man
dbd045e995 Migrate travis to use new docker system.
* Travis now installs built vim into $DEPS.
* test/run now detects best vim to use.
* python: Fix small display issue with error messages.
2015-11-28 13:39:22 -05:00
Junegunn Choi
0611369d0d Update installation instruction (#329) 2015-11-28 14:00:19 +09:00
Jeremy Pallats/starcraft.man
d478351363 Merge pull request #329 from starcraftman/xanderdunn-patch-1
Add install directions for using neovim
2015-11-26 09:58:28 -05:00
Xander Dunn
8381041ac1 Add install directions for using neovim
Neovim's autoload directory path is now considerably different from vim's.
2015-11-26 09:50:35 -05:00
Jeremy Pallats/starcraft.man
93d9e434a2 Merge pull request #324 from starcraftman/fix_freeze
Fix #318: Freezes on PlugInstall
2015-11-24 18:47:56 -05:00
Jeremy Pallats/starcraft.man
c3bcd95459 Fix #318: Freezes on PlugInstall 2015-11-24 16:06:42 -05:00
Jeremy Pallats/starcraft.man
f820fb9f0d Merge pull request #319 from starcraftman/timjk-patch-1
Add windows install instructions
2015-11-20 21:17:31 -05:00
Tim Jackson-Kiely
072d28e86e Add windows install instructions 2015-11-20 21:03:34 -05:00
Junegunn Choi
8fb0efe4e5 Merge pull request #316 from junegunn/commit-hash
Add support for commit hashes
2015-11-20 15:54:36 +09:00
Junegunn Choi
e11e045577 Add support for commit hashes
Close #315
2015-11-20 03:38:58 +09:00
Junegunn Choi
e00be1b493 Enhance post-update hook output 2015-11-19 01:23:35 +09:00
Junegunn Choi
38e1e6335c Case-sensitive validation of on arguments (#314) 2015-11-15 22:43:25 +09:00
Junegunn Choi
0c710f75f4 Prepend [vim-plug] to error messages 2015-11-15 22:41:30 +09:00
Junegunn Choi
8292b3f31a Update usage examples 2015-11-08 22:41:37 +09:00
Junegunn Choi
26e4a77317 Merge pull request #307 from agauniyal/patch-1
Add a non-master branch example
2015-10-29 01:39:48 +09:00
Abhinav Gauniyal
dd28fc7368 Add a non-master branch example 2015-10-28 22:00:15 +05:30
Junegunn Choi
fb8a5f9246 Post-update hook should not run in case of an error 2015-10-22 13:23:35 +09:00
Jeremy Pallats/starcraft.man
eb29cc9b47 Merge pull request #285 from starcraftman/thrd_join
Join a thread instead of sleeping
2015-09-21 15:52:03 -04:00
Jeremy Pallats/starcraft.man
a93bdfc175 Merge pull request #286 from zackhsi/master
Update YouCompleteMe install script
2015-09-18 15:57:20 -04:00
Zack Hsi
ded1ab7562 Update YouCompleteMe install script
The install script has been changed from `install.sh` to `install.py`.

1b40d683be
2015-09-18 10:51:40 -07:00
Jeremy Pallats/starcraft.man
91fe6ad3e9 Join a thread instead of sleeping.
* Instead of having a fixed sleep duration, start a thread
that monitors the subprocess.
* Started thread is joined, if process finishes thread returns
before timeout.
* Should increase speed and reduce overhead on CPU.
2015-09-18 07:13:06 -04:00
Jeremy Pallats/starcraft.man
86e75e5d08 Merge pull request #283 from starcraftman/refactor_command
Refactor Python Command & .travis.yml
2015-09-12 14:12:21 -04:00
Jeremy Pallats/starcraft.man
7e1dc1bcc8 Refactor Python code & .travis.yml
* Refactor Command class for easier reading.
* Some other minor clean ups & method renames.
* Change travis to use `env` and `matrix` to select builds.
* Use case instead of ifs to select behaviour.
2015-09-12 14:04:34 -04:00
Jeremy Pallats/starcraft.man
58d39115f9 Merge pull request #281 from starcraftman/fix_travis_build
Fix #280: Travis Build - Vim Fails To Compile
2015-09-09 09:23:17 -04:00
Jeremy Pallats/starcraft.man
675b09dbfc Fix #280: Travis Build - Vim Fails To Compile
* Build broken by some gui_gtk link problem.
2015-09-09 09:17:15 -04:00
Jeremy Pallats/starcraft.man
a190f4e843 Merge pull request #273 from starcraftman/fix_after_syntax
Fix #272 PlugUpdate and delayed loading
2015-08-26 09:26:09 -04:00
Jeremy Pallats/starcraft.man
27289deb5c Fix #272 PlugUpdate and delayed loading
* Force syntax files sourcing on lod_ft.
2015-08-26 08:45:34 -04:00
Junegunn Choi
a6f3a020e3 Merge pull request #264 from starcraftman/fix_codec
Close #262 UnicodeDecodeError
2015-07-31 03:26:17 +09:00
Jeremy Pallats/starcraft.man
4e5b5b978e Close #262 UnicodeDecodeError
* Problem was default decoder being ascii.
2015-07-30 14:08:34 -04:00
Junegunn Choi
2653f4bdfd Make it clear that &runtimepath is updated on plug#end()
Close #260
2015-07-22 17:52:56 +09:00
Junegunn Choi
69d6c9d545 Need to set modifiable for reloading commit content (#255) 2015-07-09 01:25:35 +09:00
Junegunn Choi
51cf219213 Merge pull request #255 from sodapopcan/plug-diff-mappings
Make commit preview unmodifiable + map q for quit
2015-07-09 00:30:10 +09:00
Andrew Haust
6286337e5b Make commit preview unmodifiable + map q for quit 2015-07-07 14:53:38 -04:00
Junegunn Choi
23b508e5fd Merge pull request #242 from starcraftman/rem_glog
Remove GLog.
2015-06-11 01:51:56 +09:00
Jeremy Pallats/starcraft.man
c34b35d50e Remove GLog. 2015-06-09 20:40:05 -04:00
Junegunn Choi
240dc9cbb6 Fix Travis CI build 2015-05-29 01:07:31 +09:00
Junegunn Choi
f85d4d774b Test refactoring 2015-05-28 19:03:49 +09:00
Junegunn Choi
50cd5e5819 Remove unused test code 2015-05-28 14:52:07 +09:00
Junegunn Choi
099057da65 Merge branch 'hori-ryota-feature/fixed-bug-of-on-demand-loading'
Close #236
2015-05-28 14:45:59 +09:00
Junegunn Choi
8e0fcf88c0 Merge branch 'feature/fixed-bug-of-on-demand-loading' 2015-05-28 14:45:30 +09:00
Junegunn Choi
025f314144 Add failing test case for #236 2015-05-28 14:45:14 +09:00
Hori Ryota
48fba1454b Bugfix of on-demand loading 2015-05-28 14:18:35 +09:00
Junegunn Choi
2ed1f27aa2 Explicitly reset s:-variables during test 2015-05-28 12:34:43 +09:00
Junegunn Choi
7760f1c22b Merge pull request #235 from starcraftman/simple_depends
Update examples: inline declaration
2015-05-24 11:41:22 +09:00
Jeremy Pallats/starcraft.man
0bd23f5b47 Inline dependency example. 2015-05-23 19:50:38 -04:00
Junegunn Choi
0227c78910 Merge pull request #233 from itspriddle/fix-diff-display
Specify a format when `git show` displays a commit
2015-05-20 09:48:12 +09:00
Joshua Priddle
8a72305371 Specify a format when git show displays a commit 2015-05-19 14:00:31 -04:00
Junegunn Choi
018b48e071 Merge pull request #232 from junegunn/user-autocmd
Trigger User autocmd when plugin is loaded on demand (#231)
2015-05-20 02:10:01 +09:00
Junegunn Choi
7ace0c42db Trigger User autocmd when plugin is loaded on demand (#231) 2015-05-20 01:38:05 +09:00
Junegunn Choi
179fa7bb82 Check if autocmd defined before doautocmd
This removes `No matching autocommands` message
2015-05-20 00:33:02 +09:00
Junegunn Choi
76bce26ab8 Temporarily change shellredir (#159) 2015-05-15 22:18:07 +09:00
Junegunn Choi
36e4364b81 silent! redraw is simpler 2015-05-11 12:36:55 +09:00
Junegunn Choi
76ec644114 Force evaluation of &statusline before running installer
Close #228
2015-05-11 12:35:48 +09:00
Junegunn Choi
9e0a082a3d Merge pull request #227 from starcraftman/starting
Use Python installer on Neovim during `vim_starting` (#104)
2015-05-07 01:33:14 +09:00
Jeremy Pallats/starcraft.man
9bee42ca0a Neovim Python Support
* Buffer updates now managed by __main__ loop with buf_q.
* Synchronous neovim install temporarily provided by python installer.
* Known issues:
*   No ctrl-c/interrupt support on nvim.
*   Graphical bug: https://github.com/neovim/python-client/issues/103
2015-05-06 12:00:26 -04:00
Junegunn Choi
18313fa43e Update README 2015-05-03 22:10:32 +09:00
Junegunn Choi
32eb4f5cbe Update README 2015-05-02 23:55:55 +09:00
Junegunn Choi
96824ccd14 Merge pull request #219 from starcraftman/py3
Support Python 2.6+ & 3.0+
2015-05-02 23:47:36 +09:00
Jeremy Pallats/starcraft.man
ef4549d2d1 Support Python 2.6+ & 3.0+
* Seamless support of both version with same code.
* Added test version for py3 on RVM = 2.1.0.
2015-05-02 10:21:02 -04:00
Junegunn Choi
d738da2ddb Merge pull request #221 from junegunn/shallow-clone
Shallow clone by default (#122 #217)
2015-04-30 14:01:30 +09:00
Junegunn Choi
d17d10dccb Add test case where shallow-clone is disabled by tag 2015-04-30 13:51:52 +09:00
Junegunn Choi
6677e8bffd Add test case for g:plug_shallow 2015-04-29 13:27:37 +09:00
Junegunn Choi
80ca4ebf54 Shallow clone by default (#122 #217) 2015-04-28 22:54:35 +09:00
Junegunn Choi
8f1df15cc3 Revert "Shallow clone by default (#122 #217)"
This reverts commit c632c1fd6a.
2015-04-28 13:47:14 +09:00
Junegunn Choi
2218b8fe20 Merge pull request #218 from junegunn/shallow-clone
Shallow clone by default #122 #217
2015-04-28 13:42:25 +09:00
Junegunn Choi
c632c1fd6a Shallow clone by default (#122 #217) 2015-04-27 10:50:55 +09:00
Junegunn Choi
42300e0c4d Merge pull request #211 from mhinz/accept-lowercase-plug
Ignore case for "<Plug>"
2015-04-12 21:08:19 +09:00
Marco Hinz
13de76383d Ignore case for "<Plug>" 2015-04-12 13:45:27 +02:00
Junegunn Choi
481a400ba4 Merge pull request #208 from starcraftman/travis_changes
Download Vim source from GitHub
2015-04-08 20:56:44 +09:00
Jeremy Pallats/starcraft.man
02710070a1 Testing changes. 2015-04-08 07:22:46 -04:00
Junegunn Choi
e04f93b162 Improve check of Neovim Job API
Checking for the existence of `jobwait()` function seems like a more
robust way to check if the current Neovim process meets the requirement
of the parallel installer. This condition precludes a very old version
of Neovim built even before the initial Job API was implemented.
2015-04-07 22:28:13 +09:00
Junegunn Choi
923f3fb3d5 Print warning message on old Neovim (#206)
Suggested by @starcraftman.
2015-04-07 22:20:34 +09:00
Junegunn Choi
6a7efea26b Fix local plugin judgement on Windows (#205) 2015-04-07 04:06:59 +09:00
Junegunn Choi
0e3e1cab75 Merge pull request #201 from junegunn/git-upgrade
PlugUpgrade using git (close #200)
2015-04-03 01:26:24 +09:00
Junegunn Choi
27354c826e PlugUpgrade using git 2015-04-03 00:47:18 +09:00
Junegunn Choi
650927980d Merge pull request #198 from starcraftman/new_job_api
New Neovim Job API
2015-03-30 11:40:21 +09:00
Jeremy Pallats/starcraft.man
047fbba4cd New dict format. 2015-03-27 13:03:46 -04:00
Jeremy Pallats/starcraft.man
fa5ece81f7 New neovim jobs API. 2015-03-26 10:41:43 -04:00
Junegunn Choi
e1b7f1ae85 Update usage and license in plug.vim 2015-03-24 00:00:35 +09:00
Junegunn Choi
cf1f644aa8 Merge pull request #194 from starcraftman/master
Fix for #193 Missing status when PlugUpdate
2015-03-23 09:15:59 +09:00
Jeremy Pallats/starcraft.man
8da3942484 Fix for #193 Missing status when PlugUpdate 2015-03-22 15:49:53 -04:00
Junegunn Choi
cbaf4f3088 Allow using Ruby/Python for PlugUpgrade on Windows (#192) 2015-03-15 13:04:47 +09:00
Junegunn Choi
a06687b4ed Slim 2015-03-15 03:13:24 +09:00
Junegunn Choi
9abd50facd Change the default number of threads on Windows to 1 (#191) 2015-03-14 14:32:24 +09:00
Junegunn Choi
b3226fbbf6 Merge pull request #189 from starcraftman/master
Disable Python on Cygwin
2015-03-12 23:06:56 +09:00
Jeremy Pallats/starcraft.man
d0120cfb45 Disable on cygwin for now. 2015-03-12 09:57:12 -04:00
Junegunn Choi
d9b70554e3 Merge pull request #187 from junegunn/python-2.6
Python 2.6 compatibility
2015-03-08 02:40:28 +09:00
Junegunn Choi
3c6ac68947 Python 2.6 compatibility
Tested on
- Vim 7.2.330
- Python 2.6.5
- Ubuntu 10.04
- https://gist.github.com/junegunn/863dcbd78eadece788cd
2015-03-08 02:00:06 +09:00
Junegunn Choi
51dc024b2e Update README (markdown table) 2015-02-27 18:56:30 +09:00
Junegunn Choi
30a2c5cc14 Remove uniq() function from test code 2015-02-25 22:44:18 +09:00
Junegunn Choi
a34b745a21 Fix #184 - Avoid duplicate entries in g:plugs_order 2015-02-25 22:31:39 +09:00
10 changed files with 1070 additions and 559 deletions

View File

@@ -1,32 +1,51 @@
language: ruby language: ruby
rvm: sudo: false
- 1.8.7 env:
- 1.9.2 # Test with vim-nox package on ubuntu global:
- 1.9.3 # Test against python installer - DEPS=$HOME/deps
- 2.0.0 - PATH=$DEPS/bin:$PATH
matrix:
before_script: | include:
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.2 ]; then - env: ENV=nox
sudo apt-get update -y rvm: 1.8.7
sudo apt-get install -y vim-nox addons: { apt: { packages: [vim-nox] } }
sudo ln -s /usr/bin/vim /usr/local/bin/vim - env: ENV=python
else rvm: 1.8.7
hg clone https://code.google.com/p/vim/ addons: { apt: { packages: [python2.7-dev] } }
cd vim - env: ENV=python3
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.3 ]; then rvm: 1.8.7
sudo apt-get update -y addons: { apt: { packages: [python3-dev] } }
sudo apt-get install -y python2.7-dev - env: ENV=ruby
./configure --with-features=huge --enable-pythoninterp rvm: 1.8.7
else - env: ENV=ruby
./configure --with-features=huge --enable-rubyinterp rvm: 2.0.0
fi install: |
make
sudo make install
cd -
fi
git config --global user.email "you@example.com" git config --global user.email "you@example.com"
git config --global user.name "Your Name" git config --global user.name "Your Name"
script: | if [ "$ENV" == "nox" ]; then
test/run ! 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 $C_OPTS
make
make install
cd -
script: test/run !

View File

@@ -1,5 +1,5 @@
<img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="56" alt="vim-plug"> <img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="75" alt="vim-plug">[![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)](https://travis-ci.org/junegunn/vim-plug)
[![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)](https://travis-ci.org/junegunn/vim-plug) ===
A minimalist Vim plugin manager. A minimalist Vim plugin manager.
@@ -10,30 +10,55 @@ A minimalist Vim plugin manager.
- Easier to setup: Single file. No boilerplate code required. - Easier to setup: Single file. No boilerplate code required.
- Easier to use: Concise, intuitive syntax - Easier to use: Concise, intuitive syntax
- [Super-fast][40/4] parallel installation/update - [Super-fast][40/4] parallel installation/update
(with [+python][py] or [+ruby][rb] or [Neovim][nv]) (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] - On-demand loading for [faster startup time][startup-time]
- Can review and rollback updates - Can review and rollback updates
- Branch/tag support - Branch/tag/commit support
- Post-update hooks - Post-update hooks
- Support for externally managed plugins - Support for externally managed plugins
[40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif [40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
[py]: https://github.com/junegunn/vim-plug/wiki/python
[rb]: https://github.com/junegunn/vim-plug/wiki/ruby
[nv]: http://neovim.org/ [nv]: http://neovim.org/
[startup-time]: http://junegunn.kr/images/vim-startup-time.png [startup-time]: http://junegunn.kr/images/vim-startup-time.png
### Usage ### 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.
###### Unix
```sh ```sh
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
``` ```
Edit your .vimrc ###### Neovim
```sh
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
```
###### Windows
```powershell
md ~\vimfiles\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile($uri, (Resolve-Path ~\vimfiles\autoload\plug.vim))
```
### Usage
Add a vim-plug section to your .vimrc:
1. Begin the section with `plug#begin()`
1. List the plugins with `Plug` commands
1. `plug#end()` to add the plugins to `&runtimepath`
#### Example
```vim ```vim
call plug#begin('~/.vim/plugged') call plug#begin('~/.vim/plugged')
@@ -42,6 +67,9 @@ call plug#begin('~/.vim/plugged')
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
Plug 'junegunn/vim-easy-align' Plug 'junegunn/vim-easy-align'
" Group dependencies, vim-snippets depends on ultisnips
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading " On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' } Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
@@ -49,15 +77,19 @@ Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using git URL " Using git URL
Plug 'https://github.com/junegunn/vim-github-dashboard.git' Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Plugin options " 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 " 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) " Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin' Plug '~/my-prototype-plugin'
" Add plugins to &runtimepath
call plug#end() call plug#end()
``` ```
@@ -72,14 +104,14 @@ Reload .vimrc and `:PlugInstall` to install plugins.
| `PlugClean[!]` | Remove unused directories (bang version will clean without prompt) | | `PlugClean[!]` | Remove unused directories (bang version will clean without prompt) |
| `PlugUpgrade` | Upgrade vim-plug itself | | `PlugUpgrade` | Upgrade vim-plug itself |
| `PlugStatus` | Check the status of plugins | | `PlugStatus` | Check the status of plugins |
| `PlugDiff` | 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 |
| `do` | Post-update hook (string or funcref) | | `do` | Post-update hook (string or funcref) |
@@ -90,10 +122,11 @@ Reload .vimrc and `:PlugInstall` to install plugins.
### 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 (*Ruby & Python*) | | `g:plug_timeout` | 60 | Time limit of each task in seconds (*Ruby & Python*) |
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) | | `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
| `g:plug_shallow` | 1 | Use shallow clone |
| `g:plug_window` | `vertical topleft new` | Command to open plug window | | `g:plug_window` | `vertical topleft new` | Command to open plug window |
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL | | `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL |
@@ -134,6 +167,10 @@ 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 loaded on demand
Plug 'Valloric/YouCompleteMe', { 'for': 'cpp' }
autocmd! User YouCompleteMe call youcompleteme#Enable()
``` ```
`for` option is generally not needed as most plugins for specific file types `for` option is generally not needed as most plugins for specific file types
@@ -147,7 +184,7 @@ In that case, use `do` option to describe the task to be performed.
```vim ```vim
Plug 'Shougo/vimproc.vim', { 'do': 'make' } Plug 'Shougo/vimproc.vim', { 'do': 'make' }
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' } Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
``` ```
If you need more control, you can pass a reference to a Vim function that If you need more control, you can pass a reference to a Vim function that
@@ -160,7 +197,7 @@ function! BuildYCM(info)
" - status: 'installed', 'updated', or 'unchanged' " - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate! " - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force if a:info.status == 'installed' || a:info.force
!./install.sh !./install.py
endif endif
endfunction endfunction

BIN
plug.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 23 KiB

776
plug.vim

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +0,0 @@
fzf*
xxx
yyy
z1
z2

View File

@@ -1 +0,0 @@
echomsg 'ftplugin'

View File

@@ -19,7 +19,7 @@ Execute (#112 On-demand loading should not suppress messages from ftplugin):
********************************************************************** **********************************************************************
Execute (#114 Should not contain empty path in &rtp): Execute (#114 Should not contain empty path in &rtp):
call plug#begin('$TMPDIR/plugged') call plug#begin('/tmp/plugged')
call plug#end() call plug#end()
Log &rtp Log &rtp
@@ -34,7 +34,8 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
augroup END augroup END
" Cleared on command " Cleared on command
call plug#begin('$TMPDIR/plugged') call ReloadPlug()
call plug#begin('/tmp/plugged')
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] } Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
call plug#end() call plug#end()
PlugInstall | q PlugInstall | q
@@ -50,7 +51,8 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined' Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
" Cleared on FileType " Cleared on FileType
call plug#begin('$TMPDIR/plugged') call ReloadPlug()
call plug#begin('/tmp/plugged')
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] } Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
call plug#end() call plug#end()
@@ -64,25 +66,25 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
********************************************************************** **********************************************************************
Execute (#131 Syntax error): Execute (#131 Syntax error):
call plug#begin('/no-permission') call plug#begin('/proc/no-permission')
Plug 'junegunn/vim-emoji' Plug 'junegunn/vim-emoji'
call plug#end() call plug#end()
redir => out redir => out
silent PlugInstall silent PlugInstall
redir END redir END
Assert out =~ 'Invalid plug directory: /no-permission' Assert out =~ 'Invalid plug directory: /proc/no-permission', out
********************************************************************** **********************************************************************
Execute (#139-1 Using new remote branch): Execute (#139-1 Using new remote branch):
" Make sure to remove the clone " Make sure to remove the clone
call plug#begin('$TMPDIR/plugged') call plug#begin('/tmp/plugged')
call plug#end() call plug#end()
PlugClean! PlugClean!
" Install master branch " Install master branch
call plug#begin('$TMPDIR/plugged') call plug#begin('/tmp/plugged')
Plug expand('file:///$TMPDIR/new-branch') Plug expand('file:////tmp/new-branch')
call plug#end() call plug#end()
PlugUpdate PlugUpdate
@@ -93,14 +95,14 @@ Execute (#139-1 Using new remote branch):
Assert !exists('g:baz'), 'g:baz should not be found' Assert !exists('g:baz'), 'g:baz should not be found'
" Create a new branch on origin " Create a new branch on origin
call system('cd $TMPDIR/new-branch && git checkout -b new &&' call system('cd /tmp/new-branch && git checkout -b new &&'
\. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&' \. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
\. 'git commit -m second') \. 'git commit -m second')
" We're setting up two plugins so that parallel installer is used " We're setting up two plugins so that parallel installer is used
call plug#begin('$TMPDIR/plugged') call plug#begin('/tmp/plugged')
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'new' } Plug expand('file:////tmp/new-branch'), { 'branch': 'new' }
call plug#end() call plug#end()
PlugUpdate PlugUpdate
silent %y silent %y
@@ -123,14 +125,14 @@ Expect:
Execute (#139-2 Using yet another new remote branch): Execute (#139-2 Using yet another new remote branch):
" Create another branch on origin " Create another branch on origin
call system('cd $TMPDIR/new-branch && git checkout master &&' call system('cd /tmp/new-branch && git checkout master &&'
\. 'git checkout -b brand-new &&' \. 'git checkout -b brand-new &&'
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&' \. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
\. 'git commit -m third') \. 'git commit -m third')
" Test Vim installer here " Test Vim installer here
call plug#begin('$TMPDIR/plugged') call plug#begin('/tmp/plugged')
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'brand-new' } Plug expand('file:////tmp/new-branch'), { 'branch': 'brand-new' }
call plug#end() call plug#end()
PlugUpdate PlugUpdate
silent %y silent %y
@@ -152,24 +154,25 @@ Expect:
Execute (#139-3 Should fail when not possible to fast-forward): Execute (#139-3 Should fail when not possible to fast-forward):
" Commit on cloned repo " Commit on cloned repo
call system('cd $TMPDIR/plugged/new-branch && git checkout master &&' call system('cd /tmp/plugged/new-branch && git checkout master &&'
\. 'touch foobar && git add foobar && git commit -m foobar') \. 'touch foobar && git add foobar && git commit -m foobar')
" Different commit on remote " Different commit on remote
call system('cd $TMPDIR/new-branch && git checkout master &&' call system('cd /tmp/new-branch && git checkout master &&'
\. 'touch foobaz && git add foobaz && git commit -m foobaz') \. 'touch foobaz && git add foobaz && git commit -m foobaz')
for multi in [0, 1] for multi in [0, 1]
call plug#begin('$TMPDIR/plugged') call plug#begin('/tmp/plugged')
if multi if multi
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
endif endif
Plug expand('file:///$TMPDIR/new-branch') Plug expand('file:////tmp/new-branch')
call plug#end() call plug#end()
PlugUpdate PlugUpdate
silent %y silent %y
Assert @" =~ 'Not possible to fast-forward', @" Assert @" =~ 'Not possible to fast-forward', @"
endfor endfor
q
********************************************************************** **********************************************************************
Execute (#145: Merging on-demand loading triggers - cmd): Execute (#145: Merging on-demand loading triggers - cmd):
@@ -188,6 +191,7 @@ Execute (#145: Merging on-demand loading triggers - cmd):
Execute (#145: Merging on-demand loading triggers - map): Execute (#145: Merging on-demand loading triggers - map):
unlet! g:xxx g:yyy unlet! g:xxx g:yyy
call ReloadPlug()
call plug#begin() call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' } Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] } Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
@@ -206,7 +210,7 @@ Execute (#159: shell=/bin/tcsh):
let org = &shell let org = &shell
try try
set shell=/bin/tcsh set shell=/bin/tcsh
call plug#begin('$TMPDIR/plugged') call plug#begin('/tmp/plugged')
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
call plug#end() call plug#end()
@@ -220,9 +224,65 @@ Execute (#159: shell=/bin/tcsh):
********************************************************************** **********************************************************************
Execute (#154: Spaces in &rtp should not be escaped): Execute (#154: Spaces in &rtp should not be escaped):
call plug#begin('$TMPDIR/plug it') call plug#begin('/tmp/plug it')
Plug 'seoul256 vim' Plug 'seoul256 vim'
call plug#end() call plug#end()
Log &rtp Log &rtp
Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0 Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
**********************************************************************
Execute (#184: Duplicate entries in &rtp):
call plug#begin('/tmp/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/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/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/plugged')
call plug#end()
PlugClean!
" Shallow clone. We should have at least 2 plugins to enable parallel installer.
call plug#begin('/tmp/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/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

101
test/run
View File

@@ -1,11 +1,16 @@
#!/bin/bash #!/bin/bash
cd $(dirname $BASH_SOURCE) cd $(dirname "${BASH_SOURCE[0]}")
cd ..
PLUG_SRC=$(pwd)/plug.vim
cd - > /dev/null
export PLUG_FIXTURES=$(pwd)/fixtures export BASE="$PWD"
export PLUG_SRC="$PWD/../plug.vim"
export PLUG_FIXTURES="$PWD/fixtures"
mkdir -p "$PLUG_FIXTURES"
cat > /tmp/mini-vimrc << VIMRC
set rtp+=/tmp/junegunn/vader.vim
set shell=/bin/bash
VIMRC
clone() { clone() {
if [ ! -d $2 ]; then if [ ! -d $2 ]; then
@@ -13,25 +18,23 @@ clone() {
fi fi
} }
# Clone clone_repos() (
cd /tmp cd /tmp
mkdir -p junegunn vim-scripts jg mkdir -p junegunn vim-scripts jg
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \ 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 vim-oblique vim-pseudocl vim-redis vim-emoji; do
clone https://github.com/junegunn/${repo}.git junegunn/$repo & clone https://github.com/junegunn/${repo}.git junegunn/$repo &
done done
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 & clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
clone https://github.com/junegunn/fzf.git fzf &
wait
rm -rf $PLUG_FIXTURES/fzf clone junegunn/vim-emoji jg/vim-emoji
clone https://github.com/junegunn/fzf.git $PLUG_FIXTURES/fzf-staged & cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master
wait )
(cd junegunn/seoul256.vim && make_dirs() (
git checkout no-t_co && git checkout master) > /dev/null 2>&1 rm -rf "$PLUG_FIXTURES/$1"
clone junegunn/vim-emoji jg/vim-emoji
cd - > /dev/null
make_dirs() {
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
@@ -46,50 +49,66 @@ 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"
rm -rf $TMPDIR/new-branch git init
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
gitinit yyy
make_dirs z1/ z1 make_dirs z1/ z1
make_dirs z2/ z2 make_dirs z2/ z2
( rm -rf "$PLUG_FIXTURES/ftplugin-msg"
cd $TMPDIR mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
echo "echomsg 'ftplugin'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
rm -rf /tmp/new-branch
cd /tmp
git init new-branch git init new-branch
cd new-branch cd new-branch
mkdir plugin mkdir plugin
echo 'let g:foo = 1' > plugin/foo.vim echo 'let g:foo = 1' > plugin/foo.vim
git add plugin/foo.vim git add plugin/foo.vim
git commit -m initial git commit -m initial
)
cd "$BASE"
} }
cat > /tmp/mini-vimrc << VIMRC select_vim() {
set rtp+=/tmp/junegunn/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
VIM=$(select_vim)
echo "Selected Vim: $VIM"
if [ "$1" = '!' ]; then if [ "$1" = '!' ]; then
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null && $VIM -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
init && prepare &&
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null $VIM -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
else else
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader test.vader' $VIM -Nu /tmp/mini-vimrc -c 'Vader test.vader'
fi fi

View File

@@ -1,18 +1,20 @@
Execute (Initialize test environment): Execute (Initialize test environment):
Save &rtp, g:plugs, g:plug_home, g:plug_window Save &rtp, g:plugs, g:plug_home, g:plug_window
let first_rtp = split(&rtp, ',')[0]
let last_rtp = split(&rtp, ',')[-1]
let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h')
let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h')
set rtp=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
execute 'set rtp^='.vader
execute 'set rtp^='.plug
let basertp = &rtp
unlet! g:plugs g:plug_home g:plug_window unlet! g:plugs g:plug_home g:plug_window
let g:plug_url_format = 'file:///tmp/%s' let g:plug_url_format = 'file:///tmp/%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
" Temporarily patch plug.vim
call system('cp $PLUG_SRC $PLUG_SRC.org')
call writefile(extend(readfile($PLUG_SRC),
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_SRC)
set t_Co=256 set t_Co=256
colo default colo default
@@ -39,12 +41,26 @@ Execute (Initialize test environment):
endif endif
endfunction endfunction
function! RmRf(file)
call system(printf('rm -rf "%s"', a:file))
endfunction
function! ReloadPlug()
call ResetPlug()
source $PLUG_SRC
let &rtp = g:base_rtp
endfunction
source $PLUG_SRC
Execute (Print Interpreter Version): Execute (Print Interpreter Version):
redir => out redir => out
if has('ruby') if has('ruby')
silent ruby puts 'Ruby: ' + RUBY_VERSION silent ruby puts 'Ruby: ' + RUBY_VERSION
elseif has('python') elseif has('python')
silent python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2]) 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 endif
redir END redir END
Log substitute(out, '\n', '', 'g') Log substitute(out, '\n', '', 'g')
@@ -53,20 +69,18 @@ Include: workflow.vader
Include: regressions.vader Include: regressions.vader
Execute (Cleanup): Execute (Cleanup):
silent! call system('rm -rf '.temp_plugged) silent! call RmRf(g:temp_plugged)
silent! call system('rm -rf '.temp_plugged) silent! unlet g:plugs g:plug_home g:plug_url_format
silent! call rename(fzf, expand('$PLUG_FIXTURES/fzf-staged')) silent! unlet g:temp_plugged g:first_rtp g:last_rtp g:base_rtp out
silent! unlet g:plugs
silent! unlet g:plug_home
silent! unlet g:plug_url_format
silent! unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out tabnr found len
silent! delf PlugStatusSorted silent! delf PlugStatusSorted
silent! delf AssertExpect silent! delf AssertExpect
silent! delf PlugUpdated silent! delf PlugUpdated
silent! delf EnsureLoaded silent! delf EnsureLoaded
silent! delf ReloadPlug
silent! delc AssertExpect silent! delc AssertExpect
silent! unmap / silent! unmap /
silent! unmap ? silent! unmap ?
call system('mv $PLUG_SRC.org $PLUG_SRC')
Restore Restore

View File

@@ -17,25 +17,25 @@ Execute (plug#begin() without path argument with empty &rtp):
redir END redir END
Assert stridx(out, 'Unable to determine plug home') >= 0 Assert stridx(out, 'Unable to determine plug home') >= 0
let &rtp = save_rtp let &rtp = save_rtp
unlet save_rtp
Execute (plug#begin(path)): Execute (plug#begin(path)):
let temp_plugged = tempname() call plug#begin(g:temp_plugged.'/')
call plug#begin(temp_plugged.'/')
Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home' Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home'
AssertEqual 0, len(g:plugs) AssertEqual 0, len(g:plugs)
AssertEqual temp_plugged, g:plug_home AssertEqual g:temp_plugged, g:plug_home
AssertEqual basertp, &rtp AssertEqual g:base_rtp, &rtp
Execute (Subsequent plug#begin() calls will reuse g:plug_home): Execute (Subsequent plug#begin() calls will reuse g:plug_home):
call plug#begin() call plug#begin()
AssertEqual temp_plugged, g:plug_home AssertEqual g:temp_plugged, g:plug_home
Execute (Test Plug command): Execute (Test Plug command):
^ Git repo with branch (DEPRECATED. USE BRANCH OPTION) ^ Git repo with branch (DEPRECATED. USE BRANCH OPTION)
Plug 'junegunn/seoul256.vim', { 'branch': 'yes-t_co' } Plug 'junegunn/seoul256.vim', { 'branch': 'yes-t_co' }
AssertEqual 'file:///tmp/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri AssertEqual 'file:///tmp/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
@@ -44,7 +44,7 @@ Execute (Test Plug command):
^ Git repo with tag (DEPRECATED. USE TAG OPTION) ^ Git repo with tag (DEPRECATED. USE TAG OPTION)
Plug 'junegunn/goyo.vim', '1.5.2' Plug 'junegunn/goyo.vim', '1.5.2'
AssertEqual 'file:///tmp/junegunn/goyo.vim', g:plugs['goyo.vim'].uri AssertEqual 'file:///tmp/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
AssertEqual '1.5.2', g:plugs['goyo.vim'].tag AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
@@ -54,7 +54,7 @@ Execute (Test Plug command):
Plug 'file:///tmp/jg/vim-emoji' Plug 'file:///tmp/jg/vim-emoji'
AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri
AssertEqual 'master', g:plugs['vim-emoji'].branch AssertEqual 'master', g:plugs['vim-emoji'].branch
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
" vim-scripts/ " vim-scripts/
Plug 'beauty256' Plug 'beauty256'
@@ -66,7 +66,7 @@ Execute (Test Plug command):
Execute (Plug command with dictionary option): Execute (Plug command with dictionary option):
Log string(g:plugs) Log string(g:plugs)
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' } Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual '././', g:plugs['seoul256.vim'].rtp AssertEqual '././', g:plugs['seoul256.vim'].rtp
Log string(g:plugs) Log string(g:plugs)
@@ -84,9 +84,9 @@ Execute (PlugClean before installation):
Execute (plug#end() updates &rtp): Execute (plug#end() updates &rtp):
call plug#end() call plug#end()
Assert len(&rtp) > len(basertp) Assert len(&rtp) > len(g:base_rtp)
AssertEqual first_rtp, split(&rtp, ',')[0] AssertEqual g:first_rtp, split(&rtp, ',')[0]
AssertEqual last_rtp, split(&rtp, ',')[-1] AssertEqual g:last_rtp, split(&rtp, ',')[-1]
Execute (Yet, plugins are not available): Execute (Yet, plugins are not available):
Assert empty(globpath(&rtp, 'autoload/emoji.vim')) Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
@@ -262,23 +262,30 @@ Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
PlugUpdate PlugUpdate
AssertExpect 'Already up-to-date', 2 AssertExpect 'Already up-to-date', 2
normal D normal D
AssertEqual 'No updates.', getline(1) AssertEqual '0 plugin(s) updated.', getline(1)
q q
Execute (PlugDiff - 'No updates.'): Execute (PlugDiff - 'No updates.'):
PlugDiff PlugDiff
AssertEqual 'No updates.', getline(1) Log getline(1, '$')
AssertEqual '0 plugin(s) updated.', getline(1)
Assert empty(mapcheck('o'))
Assert empty(mapcheck('X'))
Assert empty(mapcheck("\<cr>"))
q q
Execute (Rollback recent updates, PlugUpdate, then PlugDiff): Execute (New commits on remote, PlugUpdate, then PlugDiff):
for repo in ['seoul256.vim', 'vim-emoji'] for repo in ['seoul256.vim', 'vim-emoji']
call system(printf('cd %s/%s && git reset HEAD^^ --hard', g:plug_home, repo)) for _ in range(2)
call system(printf('cd /tmp/junegunn/%s && git commit --allow-empty -m "update"', repo))
endfor endfor
endfor
unlet repo
PlugUpdate PlugUpdate
" Now we have updates " Now we have updates
normal D normal D
AssertEqual 'Last update:', getline(1) AssertEqual '2 plugin(s) updated.', getline(1)
" Preview commit " Preview commit
silent! wincmd P silent! wincmd P
@@ -307,6 +314,7 @@ Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
" [[ motion " [[ motion
execute 'normal 0[[' execute 'normal 0[['
AssertEqual lnum, line('.') AssertEqual lnum, line('.')
unlet lnum
AssertEqual 3, col('.') AssertEqual 3, col('.')
" X key to revert the update " X key to revert the update
@@ -346,12 +354,83 @@ Execute (Reuse Plug window in another tab):
AssertEqual tabnr, tabpagenr() AssertEqual tabnr, tabpagenr()
normal! gt normal! gt
q q
unlet tabnr
Execute (contd. PlugDiff should not show inverted history):
" Additional PlugUpdate to clear diff
PlugUpdate
PlugDiff
Log getline(1, '$')
" Checking out older revisions
for repo in values(g:plugs)
call system(printf('cd %s && git reset HEAD^ --hard', shellescape(repo.dir)))
endfor
unlet repo
" PlugDiff should not report the changes i.e. git log --left-only
PlugDiff
Log getline(1, '$')
AssertEqual '0 plugin(s) updated.', getline(1)
q
**********************************************************************
~ PlugDiff to see the pending changes
**********************************************************************
Execute (PlugDiff):
call plug#begin()
call plug#end()
PlugClean!
call plug#begin()
Plug 'file://'.expand('$PLUG_FIXTURES').'/xxx'
Plug 'file://'.expand('$PLUG_FIXTURES').'/yyy'
call plug#end()
PlugInstall
Log getline(1, '$')
call system('cd "$PLUG_FIXTURES/xxx" && git commit --allow-empty -m update-xxx && git tag -f xxx')
call system('cd "$PLUG_FIXTURES/yyy" && git tag -f yyy && git commit --allow-empty -m update-yyy && git tag -f zzz')
let g:plugs.yyy.tag = 'yyy'
PlugUpdate
Log getline(1, '$')
PlugDiff
" 1 plugin(s) updated. 1 plugin(s) have pending updates.
" [==]
"
" Last update:
" ------------
"
" - xxx:
" 166cfff (tag: xxx) update-xxx (1 second ago)
"
" Pending updates:
" ----------------
"
" - yyy: (tag: yyy)
" c0a064b (tag: zzz) update-yyy (1 second ago)
"
Log getline(1, '$')
AssertEqual 15, line('$')
AssertEqual '1 plugin(s) updated. 1 plugin(s) have pending updates.', getline(1)
AssertEqual '[==]', getline(2)
AssertEqual '- yyy: (tag: yyy)', getline(13)
Assert getline(8) =~ '(tag: xxx)'
Assert getline(14) =~ '(tag: zzz)'
Assert !empty(mapcheck('o'))
Assert !empty(mapcheck('X'))
Assert !empty(mapcheck("\<cr>"))
q
********************************************************************** **********************************************************************
~ On-demand loading / Partial installation/update ~ ~ On-demand loading / Partial installation/update ~
********************************************************************** **********************************************************************
Execute (Trying to execute on-demand commands when plugin is not installed): Execute (Trying to execute on-demand commands when plugin is not installed):
call ReloadPlug()
call plug#begin() call plug#begin()
Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] } Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] }
call plug#end() call plug#end()
@@ -364,16 +443,22 @@ Execute (Trying to execute on-demand commands when plugin is not installed):
Assert !exists(':LiveEasyAlign') Assert !exists(':LiveEasyAlign')
Execute (New set of plugins): Execute (New set of plugins):
call ReloadPlug()
call plug#begin() call plug#begin()
Plug 'junegunn/vim-fnr' Plug 'junegunn/vim-fnr'
Plug 'junegunn/vim-pseudocl' Plug 'junegunn/vim-pseudocl'
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' } Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
Plug 'junegunn/vim-redis', { 'for': 'redis' } Plug 'junegunn/vim-redis', { 'for': 'redis' }
let user_autocmd = {}
autocmd! User vim-fnr let user_autocmd.fnr = 1
autocmd! User vim-easy-align let user_autocmd.easy_align = 1
autocmd! User vim-redis let user_autocmd.redis = 1
call plug#end() call plug#end()
Execute (Check commands): Execute (Check commands):
Assert !exists(':FNR'), 'FNR command should not be found' Assert !exists(':FNR'), 'FNR command should not be found'
Assert !exists(':RedisExecute'), 'RedisExecute command should not be found' Assert !exists(':RedisExecute'), 'RedisExecute command should not be found'
Assert empty(user_autocmd)
Execute (Partial PlugInstall): Execute (Partial PlugInstall):
PlugInstall vim-fnr vim-easy-align PlugInstall vim-fnr vim-easy-align
@@ -383,8 +468,8 @@ Execute (Partial PlugInstall):
PlugInstall vim-fnr vim-easy-align 1 PlugInstall vim-fnr vim-easy-align 1
AssertExpect 'vim-fnr', 1 AssertExpect 'vim-fnr', 1
AssertExpect 'vim-easy-align', 1 AssertExpect 'vim-easy-align', 1
AssertEqual first_rtp, split(&rtp, ',')[0] AssertEqual g:first_rtp, split(&rtp, ',')[0]
AssertEqual last_rtp, split(&rtp, ',')[-1] AssertEqual g:last_rtp, split(&rtp, ',')[-1]
q q
Given (Unaligned code): Given (Unaligned code):
@@ -403,6 +488,10 @@ Expect (Aligned code):
a = 1 a = 1
aa = 2 aa = 2
Then (autocmd executed):
Assert user_autocmd.easy_align
AssertEqual 1, len(user_autocmd)
Given: Given:
Execute (Partial PlugUpdate): Execute (Partial PlugUpdate):
PlugUpdate vim-redis PlugUpdate vim-redis
@@ -412,6 +501,11 @@ Execute (On-demand loading based on filetypes):
Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found' Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
set ft=redis set ft=redis
Assert exists(':RedisExecute'), 'RedisExecute command is now found' Assert exists(':RedisExecute'), 'RedisExecute command is now found'
Assert user_autocmd.redis
AssertEqual 2, len(user_autocmd)
autocmd! User
unlet user_autocmd
********************************************************************** **********************************************************************
~ Local (unmanaged) plugins ~ Local (unmanaged) plugins
@@ -419,6 +513,7 @@ Execute (On-demand loading based on filetypes):
Execute (Add unmanaged plugin): Execute (Add unmanaged plugin):
let fzf = expand('$PLUG_FIXTURES/fzf') let fzf = expand('$PLUG_FIXTURES/fzf')
call RmRf(fzf)
Log fzf Log fzf
call plug#begin() call plug#begin()
@@ -477,7 +572,8 @@ Execute (PlugStatus should point out that the plugin is missing):
Execute (Deploy unmanaged plugin): Execute (Deploy unmanaged plugin):
Assert !exists(':FZF'), ':FZF command should not exist' Assert !exists(':FZF'), ':FZF command should not exist'
call rename(expand('$PLUG_FIXTURES/fzf-staged'), fzf) call RmRf(fzf)
Log system(printf('cp -r "/tmp/fzf" "%s"', fzf))
Execute (PlugUpdate still should not care): Execute (PlugUpdate still should not care):
PlugUpdate PlugUpdate
@@ -497,8 +593,8 @@ Execute (Check &rtp after SomeCommand):
Assert &rtp !~ 'fzf' Assert &rtp !~ 'fzf'
silent! SomeCommand silent! SomeCommand
Assert &rtp =~ 'fzf' Assert &rtp =~ 'fzf'
AssertEqual first_rtp, split(&rtp, ',')[0] AssertEqual g:first_rtp, split(&rtp, ',')[0]
AssertEqual last_rtp, split(&rtp, ',')[-1] AssertEqual g:last_rtp, split(&rtp, ',')[-1]
Execute (Common parent): Execute (Common parent):
call plug#begin() call plug#begin()
@@ -512,6 +608,8 @@ Execute (Common parent):
AssertExpect! '[===]', 1 AssertExpect! '[===]', 1
q q
unlet fzf
********************************************************************** **********************************************************************
~ Frozen plugins ~ Frozen plugins
********************************************************************** **********************************************************************
@@ -639,8 +737,8 @@ Execute (On update):
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' } Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' }
call plug#end() call plug#end()
" Reset for updates " New commits on remote
call system('cd '.g:plugs['vim-pseudocl'].dir.' && git reset --hard HEAD^') call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
silent PlugUpdate silent PlugUpdate
Log getline(1, '$') Log getline(1, '$')
@@ -703,8 +801,9 @@ Execute (Using Funcref):
Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') } Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
call plug#end() call plug#end()
call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^') call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
call system('rm -rf '.g:plugs['vim-pseudocl'].dir) call RmRf(g:plugs['vim-pseudocl'].dir)
PlugUpdate PlugUpdate
Log getline(1, '$') Log getline(1, '$')
@@ -714,7 +813,7 @@ Execute (Using Funcref):
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled03'), Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled03'),
\ 'vim-pseudocl/vim-pseudoclinstalled03 should exist' \ 'vim-pseudocl/vim-pseudoclinstalled03 should exist'
call system('rm -rf '.g:plugs['vim-pseudocl'].dir) call RmRf(g:plugs['vim-pseudocl'].dir)
PlugInstall! PlugInstall!
q q
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignunchanged13'), Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignunchanged13'),
@@ -730,6 +829,50 @@ Execute (Using Funcref):
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclunchanged13'), Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclunchanged13'),
\ 'vim-pseudocl/vim-pseudoclunchanged13 should exist' \ 'vim-pseudocl/vim-pseudoclunchanged13 should exist'
Execute (Post-update hook output; success and failure):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'xxx-non-existent-command-xxx' }
Plug 'junegunn/vim-pseudocl', { 'do': 'true' }
call plug#end()
silent PlugInstall! 1
AssertEqual '- Post-update hook for vim-pseudocl ... OK', getline(5)
AssertEqual 'x Post-update hook for vim-easy-align ... Exit status: 127', getline(6)
q
Execute (Post-update hook output; invalid type or funcref):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 1 }
Plug 'junegunn/vim-pseudocl', { 'do': function('call') }
call plug#end()
silent PlugInstall! 1
AssertEqual 'x Post-update hook for vim-pseudocl ... Vim(call):E119: Not enough arguments for function: call', getline(5)
AssertEqual 'x Post-update hook for vim-easy-align ... Invalid hook type', getline(6)
q
Execute (Should not run when failed to update):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch failed' }
Plug 'junegunn/vim-pseudocl', { 'do': 'touch not-failed' }
call plug#end()
" Invalid remote URL
call system(printf('cd %s && git remote set-url origin xxx', g:plugs['vim-easy-align'].dir))
" New commits on remote
call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
silent PlugUpdate
Log getline(1, '$')
q
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/failed'),
\ 'vim-easy-align/failed should not exist'
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/not-failed'),
\ 'vim-pseudocl/not-failed should exist'
********************************************************************** **********************************************************************
~ Overriding `dir` ~ Overriding `dir`
********************************************************************** **********************************************************************
@@ -737,11 +880,11 @@ Execute (Using Funcref):
Execute (Using custom dir): Execute (Using custom dir):
Assert isdirectory(g:plugs['vim-easy-align'].dir) Assert isdirectory(g:plugs['vim-easy-align'].dir)
call system('rm -rf '.$TMPDIR.'easy-align') call RmRf('/tmp/easy-align')
call plug#begin() call plug#begin()
Plug 'junegunn/vim-easy-align', { 'dir': $TMPDIR.'easy-align' } Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/easy-align' }
call plug#end() call plug#end()
AssertEqual $TMPDIR.'easy-align/', g:plugs['vim-easy-align'].dir AssertEqual '/tmp/easy-align/', g:plugs['vim-easy-align'].dir
PlugClean! PlugClean!
Assert !isdirectory(g:plugs['vim-easy-align'].dir) Assert !isdirectory(g:plugs['vim-easy-align'].dir)
@@ -760,6 +903,7 @@ Before (Clear global vars):
set rtp-=$PLUG_FIXTURES/xxx/after set rtp-=$PLUG_FIXTURES/xxx/after
Execute (Immediate loading): Execute (Immediate loading):
call ReloadPlug()
call plug#begin() call plug#begin()
Plug '$PLUG_FIXTURES/xxx' Plug '$PLUG_FIXTURES/xxx'
call plug#end() call plug#end()
@@ -774,6 +918,7 @@ Execute (Immediate loading):
endif endif
Execute (Command-based on-demand loading): Execute (Command-based on-demand loading):
call ReloadPlug()
call plug#begin() call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' } Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
call plug#end() call plug#end()
@@ -787,6 +932,7 @@ Execute (Command-based on-demand loading):
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
Execute (Filetype-based on-demand loading): Execute (Filetype-based on-demand loading):
call ReloadPlug()
call plug#begin() call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' } Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
call plug#end() call plug#end()
@@ -794,7 +940,7 @@ Execute (Filetype-based on-demand loading):
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
setf xxx setf xxx
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/syntax', 'xxx/after/syntax', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
Before: Before:
@@ -901,7 +1047,7 @@ Execute (Open plug window in a new tab):
normal S normal S
AssertEqual tabnr, tabpagenr() AssertEqual tabnr, tabpagenr()
q q
unlet g:plug_window unlet g:plug_window tabnr
********************************************************************** **********************************************************************
~ g:plug_url_format ~ g:plug_url_format
@@ -947,7 +1093,7 @@ Execute (Update plugin with U key in normal mode):
q q
Execute (Update plugins with U key in visual mode): Execute (Update plugins with U key in visual mode):
silent! call system('rm -rf '.g:plugs['vim-easy-align'].dir) silent! call RmRf(g:plugs['vim-easy-align'].dir)
PlugStatus PlugStatus
normal VGU normal VGU
@@ -974,7 +1120,7 @@ Execute (plug#begin should expand env vars):
********************************************************************** **********************************************************************
Execute (Plug directory with comma): Execute (Plug directory with comma):
call plug#begin(temp_plugged . '/p,l,u,g,g,e,d') call plug#begin(g:temp_plugged . '/p,l,u,g,g,e,d')
Plug 'junegunn/vim-emoji' Plug 'junegunn/vim-emoji'
call plug#end() call plug#end()
Log &rtp Log &rtp
@@ -984,10 +1130,12 @@ Execute (Plug directory with comma):
let found = filter(split(globpath(&rtp, 'README.md'), '\n'), 'v:val =~ ","') let found = filter(split(globpath(&rtp, 'README.md'), '\n'), 'v:val =~ ","')
Log found Log found
AssertEqual 1, len(found) AssertEqual 1, len(found)
unlet found
********************************************************************** **********************************************************************
Execute (Strict load order): Execute (Strict load order):
let g:total_order = [] let g:total_order = []
call ReloadPlug()
call plug#begin() call plug#begin()
Plug '$PLUG_FIXTURES/xxx' Plug '$PLUG_FIXTURES/xxx'
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] } Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
@@ -1001,6 +1149,7 @@ Execute (Strict load order):
let len = len(split(&rtp, ',')) let len = len(split(&rtp, ','))
let g:total_order = [] let g:total_order = []
call ReloadPlug()
call plug#begin() call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] } Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
Plug '$PLUG_FIXTURES/yyy' Plug '$PLUG_FIXTURES/yyy'
@@ -1018,6 +1167,9 @@ Execute (Strict load order):
AssertEqual len + 2, len(split(&rtp, ',')) AssertEqual len + 2, len(split(&rtp, ','))
let g:total_order = [] let g:total_order = []
call ReloadPlug()
set rtp^=manually-prepended
set rtp+=manually-appended
call plug#begin() call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] } Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] } Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
@@ -1051,6 +1203,7 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home
********************************************************************** **********************************************************************
Execute (PlugSnapshot / #154 issues with paths containing spaces): Execute (PlugSnapshot / #154 issues with paths containing spaces):
let $TMPDIR = '/tmp'
call plug#begin('$TMPDIR/plug with spaces') call plug#begin('$TMPDIR/plug with spaces')
Plug 'junegunn/vim-easy-align' Plug 'junegunn/vim-easy-align'
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
@@ -1060,16 +1213,131 @@ Execute (PlugSnapshot / #154 issues with paths containing spaces):
PlugInstall PlugInstall
call plug#load('vim-easy-align') " Should properly handle paths with spaces call plug#load('vim-easy-align') " Should properly handle paths with spaces
PlugSnapshot PlugSnapshot
AssertEqual '#!/bin/sh', getline(1) AssertEqual '" Generated by vim-plug', getline(1)
AssertEqual '# Generated by vim-plug', getline(2) AssertEqual 0, stridx(getline(6), "silent! let g:plugs['seoul256.vim'].commit = '")
AssertEqual 'vim +PlugUpdate +qa', getline(5) AssertEqual 0, stridx(getline(7), "silent! let g:plugs['vim-easy-align'].commit = '")
AssertEqual 'PLUG_HOME=$TMPDIR/plug\ with\ spaces', getline(7) AssertEqual 'vim', &filetype
AssertEqual 0, stridx(getline(9), 'cd $PLUG_HOME/seoul256.vim/ && git reset --hard')
AssertEqual 0, stridx(getline(10), 'cd $PLUG_HOME/vim-easy-align/ && git reset --hard')
AssertEqual 'sh', &filetype
execute 'PlugSnapshot' g:plug_home.'/snapshot.sh' call delete(g:plug_home.'/snapshot.vim')
AssertEqual 'sh', &filetype execute 'PlugSnapshot' escape(g:plug_home.'/snapshot.vim', ' ')
AssertEqual 'snapshot.sh', fnamemodify(expand('%'), ':t') AssertEqual 'vim', &filetype
AssertEqual 'snapshot.vim', fnamemodify(expand('%'), ':t')
q q
Execute(PlugSnapshot! to overwrite existing file):
call writefile(['foobar'], g:plug_home.'/snapshot.vim')
AssertEqual 'foobar', readfile(g:plug_home.'/snapshot.vim')[0]
execute 'PlugSnapshot!' escape(g:plug_home.'/snapshot.vim', ' ')
AssertEqual '" Generated by vim-plug', readfile(g:plug_home.'/snapshot.vim')[0]
q
**********************************************************************
Execute (#221 Shallow-clone and tag option):
call plug#begin(g:temp_plugged)
Plug 'junegunn/goyo.vim'
call plug#end()
PlugInstall
execute 'cd' g:plugs['goyo.vim'].dir
Assert len(split(system('git log --oneline'), '\n')) == 1
Assert filereadable('.git/shallow')
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
PlugUpdate
q
Assert len(split(system('git log --oneline'), '\n')) > 1
Assert system('git describe --tag') =~ '^1.5.3'
Assert !filereadable('.git/shallow')
cd -
Execute (#221 Shallow-clone disabled by g:plug_shallow = 0):
call plug#begin(g:temp_plugged)
call plug#end()
PlugClean!
let g:plug_shallow = 0
call plug#begin(g:temp_plugged)
Plug 'junegunn/goyo.vim'
call plug#end()
PlugInstall
q
execute 'cd' g:plugs['goyo.vim'].dir
Assert len(split(system('git log --oneline'), '\n')) > 1, 'not shallow'
Assert !filereadable('.git/shallow'), 'not shallow'
cd -
unlet g:plug_shallow
Execute (#221 Shallow-clone disabled by tag):
call plug#begin(g:temp_plugged)
call plug#end()
PlugClean!
call plug#begin(g:temp_plugged)
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
call plug#end()
Assert !isdirectory(g:plugs['goyo.vim'].dir)
PlugInstall
Assert isdirectory(g:plugs['goyo.vim'].dir)
q
execute 'cd' g:plugs['goyo.vim'].dir
Assert system('git describe --tag') =~ '^1.5.3'
Assert len(split(system('git log --oneline'), '\n')) > 1
Assert !filereadable('.git/shallow')
cd -
Execute (Commit hash support):
call plug#begin(g:temp_plugged)
Plug 'junegunn/goyo.vim', { 'commit': 'ffffffff' }
Plug 'junegunn/vim-emoji', { 'commit': '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a' }
call plug#end()
PlugUpdate
Log getline(1, '$')
AssertEqual ['x Checking out fffffff of goyo.vim ... Error',
\' error: pathspec ''ffffffff'' did not match any file(s) known to git.',
\'- Checking out 9db7fcf of vim-emoji ... OK'], getline(5, 7)
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
" Validate error formatting
PlugStatus
Log getline(1, '$')
AssertEqual ['Finished. 1 error(s).',
\'[==]',
\'',
\'x goyo.vim:'], getline(1, 4)
Assert getline(5) =~ ' Invalid HEAD (expected: fffffff, actual: [0-9a-f]\{7})'
AssertEqual [' PlugUpdate required.',
\'- vim-emoji: OK'], getline(6, '$')
" PlugDiff should show pending updates for vim-emoji
PlugDiff
Log getline(1, '$')
AssertEqual '0 plugin(s) updated. 1 plugin(s) have pending updates.', getline(1)
Assert !empty(mapcheck('o'))
Assert empty(mapcheck('X'))
Assert !empty(mapcheck("\<cr>"))
" Nor in PlugSnapshot output
PlugSnapshot
Log getline(1, '$')
AssertEqual 8, line('$')
q
Execute (Commit hash support - cleared):
call plug#begin(g:temp_plugged)
Plug 'junegunn/goyo.vim'
Plug 'junegunn/vim-emoji'
call plug#end()
PlugInstall
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
PlugUpdate
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
AssertNotEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
q