130 Commits
0.7.2 ... 0.9.1

Author SHA1 Message Date
Junegunn Choi
b44ea685aa Merge pull request #508 from mhinz/silence-deletions
Silence :delete commands
2016-08-01 09:52:29 +09:00
Marco Hinz
9df0580eff Silence :delete commands
Add :silence to all :delete commands to avoid filling up the message history
with "1 line less" messages, in case 'report' is set to 0.
2016-07-31 22:50:50 +02:00
Junegunn Choi
e15598fe45 Add g:plug_pwindow for customizing preview window layout
Close #504
2016-07-23 18:36:30 +09:00
Junegunn Choi
326cb71a2a No period in echo message 2016-07-23 18:07:12 +09:00
Junegunn Choi
c9a7ca1e9e Define d operator for selectively removing invalid directories
Fix #503
2016-07-23 18:02:00 +09:00
Junegunn Choi
5695fb8474 Do not proceed if $GIT_DIR or $GIT_WORK_TREE is found
Close #506
2016-07-23 10:13:25 +09:00
Junegunn Choi
f68a4fddae Update example: youcompleteme#Enable is no longer needed
Close #501
2016-07-15 12:18:21 +09:00
Junegunn Choi
17996cedce Support { 'do': ':VimCommand' } notation
Close #450
2016-07-13 23:01:41 +09:00
Junegunn Choi
460fbe82e0 Ignore inconsistencies between g:plugs and g:plugs_order
https://github.com/junegunn/vim-plug/issues/469#issuecomment-226965736
2016-06-19 11:18:20 +09:00
Junegunn Choi
05a1620bb1 Put cursor inside the installer window after post-update hook
https://github.com/chrisbra/unicode.vim/issues/16
2016-06-16 22:17:21 +09:00
Junegunn Choi
cb5bed0e35 Always set register in map-based ODL 2016-05-31 15:27:27 +09:00
Junegunn Choi
44893a1901 Fix #491 - Lazy-loading with omaps 2016-05-31 12:44:48 +09:00
Junegunn Choi
765a2d21d3 Do not trigger BufRead if not necessary
Close #490
2016-05-23 22:22:43 +09:00
Junegunn Choi
eb25f320a0 Fix travis CI build 2016-05-23 13:15:57 +09:00
Junegunn Choi
7c7ef8cf2f Trigger BufRead when a plugin is loaded by on condition
Close #489
2016-05-23 13:11:06 +09:00
Junegunn Choi
a8b09617f9 Clarify that function call requires call
Close #487
2016-05-23 01:12:09 +09:00
Junegunn Choi
bf1e0fb8eb Do not use Ruby older than 1.8.7
Close #482
2016-05-13 02:06:00 +09:00
Junegunn Choi
656ccef8dc Switch &shell during submodule update
Fix #481
2016-04-29 13:39:17 +09:00
Junegunn Choi
41de3c713c Export Plug command as plug# function
https://github.com/junegunn/vim-plug/issues/477#issuecomment-212746298

One can directly use it to redefine Plug command:

    function! s:plug_with_default(...)
      call plug#(a:1, extend(get(g:, 'plug_opts', {}), get(a:000, 1, {})))
    endfunction
    command! -nargs=+ Plug call s:plug_with_default(<args>)
2016-04-22 02:50:04 +09:00
Junegunn Choi
0507fc897e Merge pull request #476 from junegunn/tag-wildcard
Support wildcards in tag option
2016-04-17 18:40:31 +09:00
Junegunn Choi
e6ea538558 Support wildcards in tag option
Close #427
2016-04-17 15:32:34 +09:00
Junegunn Choi
3de4567bc0 Fix error in test script 2016-04-17 01:45:51 +09:00
Junegunn Choi
0d9efb01c7 Fix #474 - Load ftdetect files in filetypedetect augroup 2016-04-17 01:13:13 +09:00
Junegunn Choi
92bcecddd6 Revert "Use python2 for YCM post-installation"
This reverts commit 367e61b6b0.
2016-04-14 00:43:10 +09:00
Junegunn Choi
d1752e7d14 Merge pull request #467 from hobarrera/ycm-py2
Use python2 for YCM post-installation
2016-04-13 02:00:40 +09:00
Hugo Osvaldo Barrera
367e61b6b0 Use python2 for YCM post-installation
YouCompleteMe's post-installation script only seems to work with python2
(this is actually mentioned in their docs).

It seems that the sample documentation uses the system default python
(which is no longer always python2), so let's better be explicit about
it.
2016-04-12 10:11:08 -03:00
Junegunn Choi
612ee1d461 Update README: PlugInstall! and PlugUpdate! 2016-04-10 21:27:35 +09:00
Junegunn Choi
c6ed41f47e Detect plugins that are diverged their origins
Close #462
2016-04-10 20:33:37 +09:00
Junegunn Choi
0f3bd51d44 Minor refactoring 2016-04-10 20:24:09 +09:00
Junegunn Choi
3595d5b52a Add comments to test file 2016-04-10 20:21:41 +09:00
Junegunn Choi
10008e5843 Do not patch plug.vim during test 2016-04-10 19:55:10 +09:00
Junegunn Choi
d1351201d9 Merge pull request #463 from yous/force-submodule
Make PlugInstall!, PlugUpdate! trigger post-fetch checkout and submodule update
2016-04-04 15:40:14 +09:00
Chayoung You
a61d097037 Make Plug{Install,Update}! trigger post-fetch checkout, submodule update
Now `:PlugInstall!` and `:PlugUpdate!` forces to update submodules.
`:PlugInstall!` now also checks out to new specified branch, tag, or
commit.

Also added tests for changing branch, tag, or commit.
2016-04-04 14:05:35 +09:00
Junegunn Choi
158fd28bc4 Fall back to Python installer if Ruby is broken
Close #460. Also remove unnecessary `return 0` statements.
2016-04-01 00:03:45 +09:00
Junegunn Choi
76e9076ef4 Clear message on retry
Close #459
2016-03-31 23:06:11 +09:00
Junegunn Choi
36973defbd Fix #455 - git config should read local .git/config instead of $GIT_CONFIG 2016-03-30 13:25:13 +09:00
Junegunn Choi
82ac9d9075 Use <nomodeline> on User autocmd if possible
http://ftp.vim.org/pub/vim/patches/7.3/7.3.442
2016-03-29 23:02:26 +09:00
Junegunn Choi
bdc5c8d3cc Merge pull request #451 from simonweil/reset-colors-for-show
Prevent escape sequences in the preview window from PlugDiff

Steps to reproduce:
1. `git config color.ui always`
2. `PlugDiff`
3. See the content of a commit with `o`
2016-03-26 02:46:06 +09:00
Simon Weil
c1f9d7cdb4 Reset colors for git show 2016-03-25 15:07:14 +03:00
Junegunn Choi
f666048052 Update submodules whenever the repo is updated
It's not enough to track the changes in .gitmodules only
2016-03-24 16:17:05 +09:00
Junegunn Choi
db223a4d84 Merge pull request #430 from junegunn/refactor-installer
Refactor duplicate logic in installers
2016-03-24 01:26:49 +09:00
Junegunn Choi
eb47183af2 Refactor duplicate logic in installers
This commit extracts duplicate logic out of three installers.

Pros.
- Better maintainability
- Easier to add/extend the features
- Fixes a bug when 'commit' option is used, submodules are updated
  before the designated commit is checked out

Cons.
- The whole process takes slightly longer due to lost parallelism after pull
- Especially, submodule updates are not parallelized
    - However, this shouldn't matter much in practice as there are few
      plugins that heavily rely on submodules
2016-03-24 01:06:46 +09:00
Junegunn Choi
e4ddb89c20 Fix regular expressions for hex digits 2016-03-22 12:53:05 +09:00
Junegunn Choi
a4e2c064f0 Update README.md
Related: #447
2016-03-17 16:15:45 +09:00
Junegunn Choi
820cc63569 Remove redundant checks of git --version in Neovim installer
Related: #445
2016-03-12 12:34:57 +09:00
Junegunn Choi
c463c9fe83 Clarify that the installation script for Windows requires PowerShell
https://github.com/junegunn/vim-plug/pull/309#issuecomment-155259326

I take back my words :(
I thought PowerShell means the default Windows shell.
2016-03-06 14:16:56 +09:00
Junegunn Choi
7218143147 Do not proceed if getcwd() returns an empty string
Close #439
2016-03-06 11:03:33 +09:00
Junegunn Choi
c3d57ac6b5 Avoid unnecessary runtime command (#434) 2016-03-03 13:03:47 +09:00
Junegunn Choi
16902f9003 Use runtime only when the file is not found in the plugin directory (#434)
There can be multiple files that matches the pattern (e.g.
syntax/foo.vim) in &runtimepath.
2016-03-03 10:53:34 +09:00
Junegunn Choi
b082ae3847 Fix #434 - Use runtime to load syntax file during ft-based ODL
A plugin may have 'after/syntax/foo.vim' without 'syntax/foo.vim'.

e.g. https://github.com/pbrisbin/vim-syntax-shakespeare
2016-03-03 10:43:41 +09:00
Junegunn Choi
6246ad284c Strip trailing whitespaces in PlugDiff output 2016-03-03 02:14:57 +09:00
Junegunn Choi
c06d222480 Merge pull request #428 from junegunn/diff-graph
PlugDiff to include graphical representation of commit history
2016-03-03 01:40:59 +09:00
Junegunn Choi
b0f714e812 PlugDiff to include graphical representation of commit history
Close #411
2016-02-27 13:02:58 +09:00
Jeremy Pallats/starcraft.man
31b26aa266 Merge pull request #420 from starcraftman/issue_template
Fix #416: Add an issue and PR template.
2016-02-24 19:29:12 -05:00
Jeremy Pallats/starcraft.man
d96e303692 Fix #416: Add an issue and PR template. 2016-02-24 19:11:18 -05:00
Junegunn Choi
a88753ef4e Merge pull request #419 from itspriddle/bugfix/syntax-with-cli-command
Avoid multiple `syntax enable` during Vim startup
2016-02-21 11:32:55 +09:00
Joshua Priddle
396c60f24c Avoid multiple syntax enable during Vim startup 2016-02-20 21:00:06 -05:00
Junegunn Choi
ffd54224a0 Fix #410 - Do not load irrelevant syntax files 2016-02-18 01:34:04 +09:00
Junegunn Choi
8d4c341a0a Rename script-local function to generate better error message
This commit renames s:add which is called on Plug command to s:Plug.

E116: Invalid arguments for function <SNR>2_Plug

Related: #407
2016-02-13 12:44:52 +09:00
Junegunn Choi
3e712f3936 Merge pull request #399 from starcraftman/doc_fix
Fix #397: clarify in docs that GitHub is the default plugin source
2016-02-03 03:57:26 +09:00
Jeremy Pallats/starcraft.man
88e2fa380c Fix #397: clarify in docs that GitHub is the default plugin source 2016-02-02 08:40:11 -05:00
Junegunn Choi
03590d8422 Merge pull request #395 from starcraftman/small_fixes
Fix #394: Avoid problem happening.
2016-01-30 05:46:33 +09:00
Jeremy Pallats/starcraft.man
d5a5697dc0 Fix #394: Avoid problem happening.
* Do not map during prepare when function can be async.
Delay to s:finish()
* Always create new buffer, due to mappings change.
* Don't show Pending updates when no appropriate plugs.
* No need for print brackets on python 2.
2016-01-29 15:20:22 -05:00
Junegunn Choi
799e20a682 Better error message when git executable is not found
Related: #392, #52
2016-01-28 13:35:50 +09:00
Junegunn Choi
c88ab60007 Merge pull request #387 from junegunn/as
Add 'as' option
2016-01-26 03:39:21 +09:00
Junegunn Choi
7d494b4a7b Add 'as' option (#371) 2016-01-26 03:01:20 +09:00
Junegunn Choi
676174c34d Merge pull request #386 from srstevenson/conditional-syntax-highlighting
Only highlight vim-plug buffers if syntax highlighting is enabled
2016-01-25 13:14:03 +09:00
Scott Stevenson
6f60192d71 Only highlight vim-plug buffers if syntax enabled
Previously, syntax highlighting was turned on unconditionally in the
buffers opened by commands such as `:PlugUpdate`. With this commit,
highlighting is not applied if the user has disabled syntax highlighting
by calling `syntax off` after `call plug#end()` in their `vimrc`.
2016-01-24 21:40:24 +00:00
Jeremy Pallats/starcraft.man
7e7dec9252 Merge pull request #381 from starcraftman/powershell_path
Fix powershell command.
2016-01-18 10:24:43 -05:00
Jeremy Pallats/starcraft.man
13234b4029 Fix powershell command. 2016-01-18 10:19:06 -05:00
Junegunn Choi
03504f26b1 Update README - description on plug#end()
plug#end() does more than just updating &runtimepath. Close #379.
2016-01-14 13:16:05 +09:00
Junegunn Choi
46dda37494 Merge pull request #376 from beatrupp/patch-3
Add hint for Neovim configuration path
2016-01-11 03:09:07 +09:00
Beat Rupp
fa2569dc84 Add hint for Neovim configuration path 2016-01-10 19:05:23 +01:00
Junegunn Choi
fe0ff38cd9 Update YCM instruction on README
Close #372
2016-01-04 02:06:50 +09:00
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
9 changed files with 1306 additions and 506 deletions

32
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,32 @@
<!--
### Before Submitting
- You checked the [faq](https://github.com/junegunn/vim-plug/wiki/faq) for common problems.
- Check your [requirements](https://github.com/junegunn/vim-plug/wiki/requirements) are satisfied.
- You are not going to suggest vim-plug manage itself like Vundle, see #240, #364, #367 ...
-->
Explain the problem here ...
------------------------------
<!-- Put the contents of `:version` below -->
```
```
<!-- Check all that apply. -->
- Type:
- [ ] Bug
- [ ] Enhancement
- [ ] Feature Request
- [ ] Question
- OS:
- [ ] All/Other
- [ ] Linux
- [ ] OS X
- [ ] Windows
- Vim:
- [ ] Terminal Vim
- [ ] GVim
- [ ] Neovim

8
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View 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 ...

View File

@@ -1,35 +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
- 2.1.0 # Test against python3 installer matrix:
include:
before_script: | - env: ENV=nox
sudo apt-get update -y rvm: 1.8.7
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.2 ]; then addons: { apt: { packages: [vim-nox] } }
sudo apt-get install -y vim-nox - env: ENV=python
sudo ln -s /usr/bin/vim /usr/local/bin/vim rvm: 1.8.7
else addons: { apt: { packages: [python2.7-dev] } }
git clone --depth 1 https://github.com/vim/vim - env: ENV=python3
cd vim rvm: 1.8.7
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.3 ]; then 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
elif [ $(ruby -e 'puts RUBY_VERSION') = 2.1.0 ]; then - env: ENV=ruby
sudo apt-get install -y python3-dev rvm: 2.0.0
./configure --with-features=huge --enable-python3interp install: |
else
./configure --with-features=huge --enable-rubyinterp
fi
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

@@ -14,7 +14,7 @@ A minimalist Vim plugin manager.
- Creates shallow clones to minimize disk space usage and download time - Creates shallow clones to minimize disk space usage and download time
- On-demand loading for [faster startup time][startup-time] - On-demand loading for [faster startup time][startup-time]
- Can review and rollback updates - Can review and rollback updates
- Branch/tag support - Branch/tag/commit support
- Post-update hooks - Post-update hooks
- Support for externally managed plugins - Support for externally managed plugins
@@ -22,25 +22,63 @@ A minimalist Vim plugin manager.
[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)
```powershell
md ~\vimfiles\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile($uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\autoload\plug.vim"))
```
### Getting Help
- See the [requirements] page for debugging information & tested configurations.
- See the [FAQ] for common problems and questions.
- Create an [issue](https://github.com/junegunn/vim-plug/issues/new).
[FAQ]: https://github.com/junegunn/vim-plug/wiki/faq
[requirements]: https://github.com/junegunn/vim-plug/wiki/requirements
### Usage
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. `call plug#end()` to update `&runtimepath` and initialize plugin system
#### Example
```vim ```vim
call plug#begin('~/.vim/plugged') call plug#begin('~/.vim/plugged')
" Make sure you use single quotes " Make sure you use single quotes
Plug 'junegunn/seoul256.vim'
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align' Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Group dependencies, vim-snippets depends on ultisnips " Group dependencies, vim-snippets depends on ultisnips
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
@@ -48,18 +86,22 @@ Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' } Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using git URL " Using a non-master branch
Plug 'https://github.com/junegunn/vim-github-dashboard.git' Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options " Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', '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()
``` ```
@@ -74,16 +116,17 @@ 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 |
| `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 |
@@ -98,7 +141,9 @@ Reload .vimrc and `:PlugInstall` to install plugins.
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) | | `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
| `g:plug_shallow` | 1 | Use shallow clone | | `g:plug_shallow` | 1 | Use shallow clone |
| `g:plug_window` | `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_pwindow` | `above 12new` | Command to open preview window in `PlugDiff` |
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands) |
### Keybindings ### Keybindings
@@ -138,9 +183,9 @@ 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 " Code to execute when the plugin is lazily loaded on demand
Plug 'Valloric/YouCompleteMe', { 'for': 'cpp' } Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
autocmd! User YouCompleteMe call youcompleteme#Enable() autocmd! User goyo.vim echom 'Goyo is now loaded!'
``` ```
`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
@@ -154,7 +199,13 @@ 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 the value starts with `:`, it will be recognized as a Vim command.
```vim
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
``` ```
If you need more control, you can pass a reference to a Vim function that If you need more control, you can pass a reference to a Vim function that
@@ -167,7 +218,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
@@ -195,9 +246,17 @@ let g:fzf_install = 'yes | ./install'
Plug 'junegunn/fzf', { 'do': g:fzf_install } Plug 'junegunn/fzf', { 'do': g:fzf_install }
``` ```
### FAQ/Troubleshooting ### `PlugInstall!` and `PlugUpdate!`
See [FAQ/Troubleshooting](https://github.com/junegunn/vim-plug/wiki/faq). The installer takes the following steps when installing/updating a plugin:
1. `git clone` or `git fetch` from its origin
2. Check out branch, tag, or commit and optionally `git merge` remote branch
3. If the plugin was updated (or installed for the first time)
1. Update submodules
2. Execute post-update hooks
The commands with `!` suffix ensure that all steps are run unconditionally.
### Articles ### Articles

928
plug.vim

File diff suppressed because it is too large Load Diff

View File

@@ -7,19 +7,19 @@ Execute (#112 On-demand loading should not suppress messages from ftplugin):
redir => out redir => out
tabnew a.c tabnew a.c
redir END redir END
Assert stridx(out, 'ftplugin') >= 0 Assert stridx(out, 'ftplugin-c') >= 0
* The same applies to plug#load()) * The same applies to plug#load())
redir => out redir => out
call plug#load('ftplugin-msg') call plug#load('ftplugin-msg')
redir END redir END
Assert stridx(out, 'ftplugin') >= 0 Assert stridx(out, 'ftplugin-c') >= 0
q q
********************************************************************** **********************************************************************
Execute (#114 Should not contain empty path in &rtp): Execute (#114 Should not contain empty path in &rtp):
call plug#begin('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
call plug#end() call plug#end()
Log &rtp Log &rtp
@@ -35,7 +35,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
" Cleared on command " Cleared on command
call ReloadPlug() call ReloadPlug()
call plug#begin('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/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
@@ -52,7 +52,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
" Cleared on FileType " Cleared on FileType
call ReloadPlug() call ReloadPlug()
call plug#begin('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/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()
@@ -78,13 +78,13 @@ Execute (#131 Syntax error):
********************************************************************** **********************************************************************
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('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
call plug#end() call plug#end()
PlugClean! PlugClean!
" Install master branch " Install master branch
call plug#begin('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
Plug expand('file:////tmp/new-branch') Plug expand('file:////tmp/vim-plug-test/new-branch')
call plug#end() call plug#end()
PlugUpdate PlugUpdate
@@ -95,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 /tmp/new-branch && git checkout -b new &&' 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 &&' \. '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('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
Plug expand('file:////tmp/new-branch'), { 'branch': 'new' } Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'new' }
call plug#end() call plug#end()
PlugUpdate PlugUpdate
silent %y silent %y
@@ -125,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 /tmp/new-branch && git checkout master &&' call system('cd /tmp/vim-plug-test/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('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
Plug expand('file:////tmp/new-branch'), { 'branch': 'brand-new' } Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'brand-new' }
call plug#end() call plug#end()
PlugUpdate PlugUpdate
silent %y silent %y
@@ -154,19 +154,19 @@ 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 /tmp/plugged/new-branch && git checkout master &&' call system('cd /tmp/vim-plug-test/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 /tmp/new-branch && git checkout master &&' call system('cd /tmp/vim-plug-test/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('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
if multi if multi
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
endif endif
Plug expand('file:////tmp/new-branch') Plug expand('file:////tmp/vim-plug-test/new-branch')
call plug#end() call plug#end()
PlugUpdate PlugUpdate
silent %y silent %y
@@ -210,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('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
call plug#end() call plug#end()
@@ -224,7 +224,7 @@ 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('/tmp/plug it') call plug#begin('/tmp/vim-plug-test/plug it')
Plug 'seoul256 vim' Plug 'seoul256 vim'
call plug#end() call plug#end()
Log &rtp Log &rtp
@@ -232,7 +232,7 @@ Execute (#154: Spaces in &rtp should not be escaped):
********************************************************************** **********************************************************************
Execute (#184: Duplicate entries in &rtp): Execute (#184: Duplicate entries in &rtp):
call plug#begin('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'plugin1' Plug 'plugin1'
\| Plug 'plugin0' \| Plug 'plugin0'
@@ -250,7 +250,7 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
silent! delc EasyAlign silent! delc EasyAlign
call ReloadPlug() call ReloadPlug()
call plug#begin('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' } Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
call plug#end() call plug#end()
PlugInstall | q PlugInstall | q
@@ -259,7 +259,74 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
%EasyAlign= %EasyAlign=
Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp' Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
call plug#begin('/tmp/plugged') call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' } Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
call plug#end() call plug#end()
Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp' Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
**********************************************************************
Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
call plug#begin('/tmp/vim-plug-test/plugged')
call plug#end()
PlugClean!
" Shallow clone. We should have at least 2 plugins to enable parallel installer.
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/seoul256.vim'
call plug#end()
PlugUpdate
Assert filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
" Now unshallowed
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.0' }
Plug 'junegunn/seoul256.vim'
call plug#end()
PlugUpdate
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
q
**********************************************************************
Execute (#474: Load ftdetect files in filetypedetect augroup):
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/rust.vim', { 'for': 'rust', 'commit': '115d321d383eb96d438466c56cc871fcc1bd0faa' }
call plug#end()
PlugInstall!
q
tabnew /tmp/vim-plug-test/any.rs
AssertEqual 'rust', &filetype
Log &filetype
filetype detect
AssertEqual 'rust', &filetype
Log &filetype
bd
**********************************************************************
Execute (#489 On-demand loading with 'on' option should trigger BufRead autocmd):
call plug#begin('$PLUG_FIXTURES')
Plug 'ftplugin-msg', { 'on': 'XXX' }
call plug#end()
tabnew a.java
redir => out
silent! XXX
redir END
Assert stridx(out, 'ftplugin-java') >= 0
q
**********************************************************************
Execute (Cursor moved to another window during post-update hook):
function! DoSplit(...)
new
call setline(1, 'empty')
endfunction
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/rust.vim', { 'do': function('DoSplit') }
call plug#end()
PlugInstall!
AssertEqual 1, line('$')
AssertEqual 'empty', getline(1)
q!
q

View File

@@ -6,9 +6,12 @@ export BASE="$PWD"
export PLUG_SRC="$PWD/../plug.vim" export PLUG_SRC="$PWD/../plug.vim"
export PLUG_FIXTURES="$PWD/fixtures" export PLUG_FIXTURES="$PWD/fixtures"
mkdir -p "$PLUG_FIXTURES" mkdir -p "$PLUG_FIXTURES"
export TEMP=/tmp/vim-plug-test
rm -rf "$TEMP"
mkdir -p "$TEMP"
cat > /tmp/mini-vimrc << VIMRC cat > $TEMP/mini-vimrc << VIMRC
set rtp+=/tmp/junegunn/vader.vim set rtp+=$TEMP/junegunn/vader.vim
set shell=/bin/bash set shell=/bin/bash
VIMRC VIMRC
@@ -18,8 +21,8 @@ clone() {
fi fi
} }
clone_repos() { clone_repos() (
cd /tmp cd $TEMP
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
@@ -27,15 +30,15 @@ clone_repos() {
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 & 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 wait
clone junegunn/vim-emoji jg/vim-emoji clone junegunn/vim-emoji jg/vim-emoji
cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master
)
cd "$BASE" make_dirs() (
}
make_dirs() {
rm -rf "$PLUG_FIXTURES/$1" rm -rf "$PLUG_FIXTURES/$1"
mkdir -p "$PLUG_FIXTURES/$1" mkdir -p "$PLUG_FIXTURES/$1"
cd "$PLUG_FIXTURES/$1" cd "$PLUG_FIXTURES/$1"
@@ -51,9 +54,13 @@ make_dirs() {
call add(g:total_order, s:name) call add(g:total_order, s:name)
EOF EOF
done done
)
cd "$BASE" gitinit() (
} cd "$PLUG_FIXTURES/$1"
git init
git commit -m 'commit' --allow-empty
)
prepare() { prepare() {
make_dirs xxx/ xxx make_dirs xxx/ xxx
@@ -62,19 +69,22 @@ prepare() {
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" rm -rf "$PLUG_FIXTURES/ftplugin-msg"
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin" mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
echo "echomsg 'ftplugin'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim" echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
rm -rf /tmp/new-branch rm -rf $TEMP/new-branch
cd /tmp cd $TEMP
git init new-branch git init new-branch
cd new-branch cd new-branch
mkdir plugin mkdir plugin
@@ -85,13 +95,27 @@ DOC
cd "$BASE" cd "$BASE"
} }
select_vim() {
local vim=/usr/bin/vim
if [ -n "$DEPS" ] && [ -e "${DEPS}/bin/vim" ]; then
vim="${DEPS}/bin/vim"
elif [ -e "/usr/local/bin/vim" ]; then
vim=/usr/local/bin/vim
fi
echo $vim
}
clone_repos clone_repos
prepare prepare
git --version
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 $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
prepare && prepare &&
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null $VIM -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
else else
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader test.vader' $VIM -Nu $TEMP/mini-vimrc -c 'Vader test.vader'
fi fi

View File

@@ -2,7 +2,7 @@ Execute (Initialize test environment):
Save &rtp, g:plugs, g:plug_home, g:plug_window Save &rtp, g:plugs, g:plug_home, g:plug_window
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/vim-plug-test/%s'
let g:base_rtp = &rtp let g:base_rtp = &rtp
let g:first_rtp = split(&rtp, ',')[0] let g:first_rtp = split(&rtp, ',')[0]
let g:last_rtp = split(&rtp, ',')[-1] let g:last_rtp = split(&rtp, ',')[-1]
@@ -10,11 +10,12 @@ Execute (Initialize test environment):
if !exists('$PLUG_SRC') if !exists('$PLUG_SRC')
let $PLUG_SRC = globpath(&rtp, 'autoload/plug.vim') let $PLUG_SRC = globpath(&rtp, 'autoload/plug.vim')
endif endif
let $PLUG_TMP = fnamemodify(tempname(), ':h').'/plug.vim'
" Temporarily patch plug.vim " Temporarily patch plug.vim
call system('cp $PLUG_SRC $PLUG_SRC.org') call system('cp "$PLUG_SRC" "$PLUG_TMP"')
call writefile(extend(readfile($PLUG_SRC), call writefile(extend(readfile($PLUG_TMP),
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_SRC) \ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_TMP)
set t_Co=256 set t_Co=256
colo default colo default
@@ -47,11 +48,23 @@ Execute (Initialize test environment):
function! ReloadPlug() function! ReloadPlug()
call ResetPlug() call ResetPlug()
source $PLUG_SRC source $PLUG_TMP
let &rtp = g:base_rtp let &rtp = g:base_rtp
endfunction endfunction
source $PLUG_SRC 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): Execute (Print Interpreter Version):
redir => out redir => out
@@ -80,7 +93,7 @@ Execute (Cleanup):
silent! delc AssertExpect silent! delc AssertExpect
silent! unmap / silent! unmap /
silent! unmap ? silent! unmap ?
call system('mv $PLUG_SRC.org $PLUG_SRC') call delete($PLUG_TMP)
Restore Restore

View File

@@ -34,7 +34,7 @@ Execute (Subsequent plug#begin() calls will reuse 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/vim-plug-test/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
@@ -43,7 +43,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/vim-plug-test/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
AssertEqual '1.5.2', g:plugs['goyo.vim'].tag AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
@@ -51,14 +51,14 @@ Execute (Test Plug command):
AssertEqual '1.5.3', g:plugs['goyo.vim'].tag AssertEqual '1.5.3', g:plugs['goyo.vim'].tag
" Git URI " Git URI
Plug 'file:///tmp/jg/vim-emoji' Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri AssertEqual 'file:///tmp/vim-plug-test/jg/vim-emoji', g:plugs['vim-emoji'].uri
AssertEqual 'master', g:plugs['vim-emoji'].branch AssertEqual 'master', g:plugs['vim-emoji'].branch
AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
" vim-scripts/ " vim-scripts/
Plug 'beauty256' Plug 'beauty256'
AssertEqual 'file:///tmp/vim-scripts/beauty256', g:plugs.beauty256.uri AssertEqual 'file:///tmp/vim-plug-test/vim-scripts/beauty256', g:plugs.beauty256.uri
AssertEqual 'master', g:plugs.beauty256.branch AssertEqual 'master', g:plugs.beauty256.branch
AssertEqual 4, len(g:plugs) AssertEqual 4, len(g:plugs)
@@ -83,6 +83,10 @@ Execute (PlugClean before installation):
q q
Execute (plug#end() updates &rtp): Execute (plug#end() updates &rtp):
" Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
" Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
" Plug 'beauty256'
" Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
call plug#end() call plug#end()
Assert len(&rtp) > len(g:base_rtp) Assert len(&rtp) > len(g:base_rtp)
AssertEqual g:first_rtp, split(&rtp, ',')[0] AssertEqual g:first_rtp, split(&rtp, ',')[0]
@@ -155,7 +159,7 @@ Expect:
Execute (Change branch of seoul256.vim): Execute (Change branch of seoul256.vim):
call plug#begin() call plug#begin()
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
Plug 'file:///tmp/jg/vim-emoji' Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
call plug#end() call plug#end()
Execute (PlugStatus): Execute (PlugStatus):
@@ -193,21 +197,39 @@ Expect:
Execute (Change URI of seoul256.vim): Execute (Change URI of seoul256.vim):
call plug#begin() call plug#begin()
Plug 'junegunn.choi/seoul256.vim' Plug 'junegunn.choi/seoul256.vim'
Plug 'file:///tmp/jg/vim-emoji' Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
call plug#end() call plug#end()
Execute (PlugStatus): Execute (PlugStatus):
call PlugStatusSorted() call PlugStatusSorted()
Expect: Expect:
Expected: file:///tmp/junegunn.choi/seoul256.vim Expected: file:///tmp/vim-plug-test/junegunn.choi/seoul256.vim
Invalid URI: file:///tmp/junegunn/seoul256.vim Invalid URI: file:///tmp/vim-plug-test/junegunn/seoul256.vim
PlugClean required. PlugClean required.
- vim-emoji: OK - vim-emoji: OK
Finished. 1 error(s). Finished. 1 error(s).
[==] [==]
x seoul256.vim: x seoul256.vim:
Execute (Corrected the URI but diverged from master):
call plug#begin()
Plug 'junegunn/seoul256.vim'
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
call plug#end()
for _ in range(3)
call system(printf('cd "%s" && git commit --allow-empty -m "dummy"', g:plugs['seoul256.vim'].dir))
endfor
call PlugStatusSorted()
Expect:
Diverged from origin/master by 3 commit(s).
Reinstall after PlugClean.
- vim-emoji: OK
Finished. 1 error(s).
[==]
x seoul256.vim:
# TODO: does not work due to inputsave() # TODO: does not work due to inputsave()
# Do (PlugClean): # Do (PlugClean):
# :PlugClean\<Enter>y\<Enter> # :PlugClean\<Enter>y\<Enter>
@@ -218,8 +240,9 @@ Expect:
Execute (PlugClean! to remove seoul256.vim): Execute (PlugClean! to remove seoul256.vim):
PlugClean! PlugClean!
" Three removed, emoji left " Three removed, emoji left
AssertExpect '^- ', 3 AssertEqual 'Removed 3 directories.', getline(4)
AssertExpect 'Removed', 1 AssertExpect '^\~ ', 3
AssertExpect 'Diverged', 1
Assert empty(globpath(&rtp, 'colors/seoul256.vim')) Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert !empty(globpath(&rtp, 'autoload/emoji.vim')) Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
q q
@@ -234,8 +257,8 @@ Execute (PlugStatus):
call PlugStatusSorted() call PlugStatusSorted()
Expect: Expect:
Expected: file:///tmp/junegunn/vim-emoji Expected: file:///tmp/vim-plug-test/junegunn/vim-emoji
Invalid URI: file:///tmp/jg/vim-emoji Invalid URI: file:///tmp/vim-plug-test/jg/vim-emoji
Not found. Try PlugInstall. Not found. Try PlugInstall.
PlugClean required. PlugClean required.
Finished. 2 error(s). Finished. 2 error(s).
@@ -245,8 +268,8 @@ Expect:
Execute (PlugClean! to remove vim-emoji): Execute (PlugClean! to remove vim-emoji):
PlugClean! PlugClean!
AssertExpect '^- ', 1 AssertExpect '^\~ ', 1
AssertExpect 'Removed', 1 AssertEqual 'Removed 1 directories.', getline(4)
Assert empty(globpath(&rtp, 'colors/seoul256.vim')) Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert empty(globpath(&rtp, 'autoload/emoji.vim')) Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
q q
@@ -262,18 +285,22 @@ 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 (New commits on remote, 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']
for _ in range(2) for _ in range(2)
call system(printf('cd /tmp/junegunn/%s && git commit --allow-empty -m "update"', repo)) call system(printf('cd /tmp/vim-plug-test/junegunn/%s && git commit --allow-empty -m "update"', repo))
endfor endfor
endfor endfor
unlet repo unlet repo
@@ -281,7 +308,7 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
" 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
@@ -338,6 +365,22 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
AssertEqual 1, &previewwindow AssertEqual 1, &previewwindow
pclose pclose
Execute (Test g:plug_pwindow):
let g:plug_pwindow = 'below 5new'
PlugDiff
AssertExpect '^- ', 1
execute "normal ]]jo"
AssertEqual 0, &previewwindow
AssertEqual 1, winnr()
wincmd P
AssertEqual 1, &previewwindow
AssertEqual 2, winnr()
AssertEqual 5, winheight('.')
wincmd p
normal q
unlet g:plug_pwindow
Execute (Reuse Plug window in another tab): Execute (Reuse Plug window in another tab):
let tabnr = tabpagenr() let tabnr = tabpagenr()
PlugDiff PlugDiff
@@ -352,6 +395,75 @@ Execute (Reuse Plug window in another tab):
q q
unlet tabnr 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 ~
********************************************************************** **********************************************************************
@@ -500,7 +612,7 @@ 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 RmRf(fzf) call RmRf(fzf)
Log system(printf('cp -r "/tmp/fzf" "%s"', fzf)) Log system(printf('cp -r "/tmp/vim-plug-test/fzf" "%s"', fzf))
Execute (PlugUpdate still should not care): Execute (PlugUpdate still should not care):
PlugUpdate PlugUpdate
@@ -648,6 +760,9 @@ Execute (On install):
call plug#begin() call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed' } Plug 'junegunn/vim-easy-align', { 'do': 'touch installed' }
Plug 'junegunn/vim-pseudocl' Plug 'junegunn/vim-pseudocl'
Plug 'junegunn/seoul256.vim'
Plug 'junegunn/goyo.vim'
Plug 'yous/subsubmodule'
call plug#end() call plug#end()
silent PlugInstall silent PlugInstall
@@ -657,15 +772,20 @@ Execute (On install):
\ 'vim-easy-align/installed should exist' \ 'vim-easy-align/installed should exist'
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed'), Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed'),
\ 'vim-pseudocl/installed should not exist' \ 'vim-pseudocl/installed should not exist'
AssertEqual ' ', system('cd '.g:plugs['subsubmodule'].dir.' && git submodule status')[0],
\ 'subsubmodule/subsubmodule should be initialized'
Execute (On update): Execute (On update):
call plug#begin() call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated' } Plug 'junegunn/vim-easy-align', { 'do': 'touch updated' }
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' } Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' }
Plug 'junegunn/seoul256.vim'
Plug 'junegunn/goyo.vim'
Plug 'yous/subsubmodule'
call plug#end() call plug#end()
" New commits on remote " New commits on remote
call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"') call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
silent PlugUpdate silent PlugUpdate
Log getline(1, '$') Log getline(1, '$')
@@ -679,44 +799,73 @@ Execute (On update):
Execute (When already installed): Execute (When already installed):
call plug#begin() call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed2' } Plug 'junegunn/vim-easy-align', { 'do': 'touch installed2' }
Plug 'junegunn/vim-pseudocl', { 'do': 'touch installed2' } Plug 'junegunn/vim-pseudocl', { 'commit': '7f8cd78' }
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' }
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
Plug 'yous/subsubmodule'
call plug#end() call plug#end()
PlugInstall PlugInstall
q q
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/installed2'), Assert !filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
\ 'vim-easy-align/installed2 should not exist' \ 'vim-easy-align/installed2 should not exist'
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed2'), AssertNotEqual '7f8cd78cb1fe52185b98b16a3749811f0cc508af', GitCommit('vim-pseudocl')
\ 'vim-pseudocl/installed2 should not exist' AssertNotEqual 'no-t_co', GitBranch('seoul256.vim')
AssertNotEqual '1.5.3', GitTag('goyo.vim')
Execute (PlugInstall!): Execute (PlugInstall!):
silent PlugInstall! silent PlugInstall!
q q
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed2'), Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
\ 'vim-easy-align/installed2 should exist' \ 'vim-easy-align/installed2 should exist'
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/installed2'), AssertEqual '7f8cd78cb1fe52185b98b16a3749811f0cc508af', GitCommit('vim-pseudocl')
\ 'vim-pseudocl/installed2 should exist' AssertEqual 'no-t_co', GitBranch('seoul256.vim')
AssertEqual '1.5.3', GitTag('goyo.vim')
Execute (When submodules are not initialized):
call system(printf('cd %s && git submodule deinit subsubmodule', g:plugs['subsubmodule'].dir))
silent PlugInstall!
q
AssertEqual ' ', system(printf('cd %s && git submodule status', g:plugs['subsubmodule'].dir))[0],
\ 'subsubmodule/subsubmodule should be initialized'
Execute (When already updated): Execute (When already updated):
call plug#begin() call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated2' } Plug 'junegunn/vim-easy-align', { 'do': 'touch updated2' }
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated2' } Plug 'junegunn/vim-pseudocl', { 'commit': 'dd507ca' }
Plug 'junegunn/seoul256.vim', { 'branch': 'master' }
Plug 'junegunn/goyo.vim', { 'tag': '1.6.0' }
Plug 'yous/subsubmodule'
call plug#end() call plug#end()
PlugUpdate PlugUpdate
q q
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated2'), Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
\ 'vim-easy-align/updated2 should not exist' \ 'vim-easy-align/updated2 should not exist'
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/updated2'), AssertEqual 'dd507ca0d5f3fdf0d522558cc5ecffdabf824469', GitCommit('vim-pseudocl')
\ 'vim-pseudocl/updated2 should not exist' AssertEqual 'master', GitBranch('seoul256.vim')
AssertEqual '1.6.0', GitTag('goyo.vim')
Execute (PlugUpdate!): Execute (PlugUpdate!):
silent PlugUpdate! silent PlugUpdate!
q q
Assert filereadable(g:plugs['vim-easy-align'].dir.'/updated2'), Assert filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
\ 'vim-easy-align/updated2 should exist' \ 'vim-easy-align/updated2 should exist'
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/updated2'),
\ 'vim-pseudocl/updated2 should exist' Execute (When submodules are not initialized):
call system(printf('cd %s && git submodule deinit subsubmodule', g:plugs['subsubmodule'].dir))
^ #481 submodule update should use standard shell
let sh = &shell
set sh=/bin/echo
silent PlugUpdate!
let &shell = sh
unlet sh
q
AssertEqual ' ', system(printf('cd %s && git submodule status', g:plugs['subsubmodule'].dir))[0],
\ 'subsubmodule/subsubmodule should be initialized'
Execute (Using Funcref): Execute (Using Funcref):
function! PlugUpdated(info) function! PlugUpdated(info)
@@ -728,7 +877,7 @@ 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 /tmp/vim-plug-test/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 RmRf(g:plugs['vim-pseudocl'].dir) call RmRf(g:plugs['vim-pseudocl'].dir)
@@ -756,18 +905,75 @@ 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/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
call system('cd /tmp/vim-plug-test/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'
Execute (Vim command with : prefix):
call plug#begin()
Plug 'junegunn/vim-pseudocl', { 'do': ':call setline(2, 12345)' }
call plug#end()
PlugInstall!
Log getline(1, '$')
AssertEqual '12345', getline(2)
q
********************************************************************** **********************************************************************
~ Overriding `dir` ~ Overriding `dir`
********************************************************************** **********************************************************************
Execute (Using custom dir): Execute (Using custom dir):
call plug#begin()
Plug 'junegunn/vim-easy-align'
call plug#end()
Assert isdirectory(g:plugs['vim-easy-align'].dir) Assert isdirectory(g:plugs['vim-easy-align'].dir)
call RmRf('/tmp/easy-align') call RmRf('/tmp/vim-plug-test/easy-align')
call plug#begin() call plug#begin()
Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/easy-align' } Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/vim-plug-test/easy-align' }
call plug#end() call plug#end()
AssertEqual '/tmp/easy-align/', g:plugs['vim-easy-align'].dir AssertEqual '/tmp/vim-plug-test/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)
@@ -818,12 +1024,17 @@ Execute (Filetype-based on-demand loading):
call ReloadPlug() call ReloadPlug()
call plug#begin() call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' } Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
Plug '$PLUG_FIXTURES/yyy', { 'for': 'yyy' }
call plug#end() call plug#end()
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'], g:xxx
" syntax/xxx.vim and after/syntax/xxx.vim should not be loaded (#410)
setf yyy
AssertEqual ['yyy/ftdetect', 'yyy/after/ftdetect', 'yyy/plugin', 'yyy/after/plugin'], g:yyy
Before: Before:
@@ -875,6 +1086,8 @@ Execute (PlugStatus should not contain (not loaded)):
q q
Execute (Load plugin from PlugStatus screen with L key in normal mode): Execute (Load plugin from PlugStatus screen with L key in normal mode):
call ResetPlug()
unlet! g:yyy
call plug#begin() call plug#begin()
Plug '$PLUG_FIXTURES/yyy', { 'on': [] } Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
call plug#end() call plug#end()
@@ -1076,11 +1289,11 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home
" Remove z1, z2 " Remove z1, z2
PlugClean! PlugClean!
AssertExpect '^- ', 2 AssertExpect '^\~ ', 2
AssertExpect 'Already clean', 0 AssertExpect 'Already clean', 0
PlugClean! PlugClean!
AssertExpect '^- ', 0 AssertExpect '^\~ ', 0
AssertExpect 'Already clean', 1 AssertExpect 'Already clean', 1
q q
@@ -1096,17 +1309,22 @@ 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
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 q
********************************************************************** **********************************************************************
@@ -1166,3 +1384,90 @@ Execute (#221 Shallow-clone disabled by tag):
Assert !filereadable('.git/shallow') Assert !filereadable('.git/shallow')
cd - cd -
Execute (Commit hash support):
" Get goyo back to master
call plug#begin(g:temp_plugged)
Plug 'junegunn/goyo.vim'
call plug#end()
PlugUpdate
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 goyo.vim: error: pathspec ''ffffffff'' did not match any file(s) known to git.', getline(5)
AssertEqual 0, stridx(getline(6), '- vim-emoji: HEAD is now at 9db7fcf...')
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
Execute (#371 - 'as' option):
call plug#begin()
Plug 'jg/goyo.vim'
Plug 'junegunn/goyo.vim', {'as': 'yogo'}
call plug#end()
AssertEqual ['goyo.vim', 'yogo'], sort(keys(g:plugs))
Log g:plugs
Assert g:plugs.yogo.dir =~# '/yogo/$'
call plug#begin()
Plug 'junegunn/goyo.vim', {'as': 'yogo', 'dir': '/tmp/vim-plug-test/gogo'}
call plug#end()
AssertEqual ['yogo'], sort(keys(g:plugs))
AssertEqual '/tmp/vim-plug-test/gogo/', g:plugs.yogo.dir
Execute (#427 - Tag option with wildcard (requires git 1.9.2 or above)):
if str2nr(split(split(system('git --version'))[-1], '\.')[0]) < 2
Log 'tag with wildcard requires git 1.9.2 or above'
else
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.*' }
call plug#end()
PlugInstall!
Log getline(1, '$')
AssertExpect! '- Latest tag for 2.9.* -> 2.9.7 (vim-easy-align)', 1
q
AssertEqual '2.9.7', GitTag('vim-easy-align')
endif