139 Commits
0.2.0 ... 0.5.5

Author SHA1 Message Date
Junegunn Choi
da24f714e0 Use git:: prefix to avoid password prompt on git 1.7 (#56) 2014-08-14 10:04:44 +09:00
Junegunn Choi
c1bbbaf3ef Allow Plug command even when git executable is not found (#52)
- plug#begin() will return 1 even when git executable is not found
    - Commands that require git will not be available
- If you wish to ignore the error message prepend `silent!` to the call
2014-08-11 01:42:19 +09:00
Junegunn Choi
f7ebba7b9e Improve PlugDiff: 'X' key to revert the update 2014-08-10 16:52:26 +09:00
Junegunn Choi
6272f5e289 Improve PlugStatus
- Display load status
- Load plugin with 'L' key

(This commit also allows not loading a plugin with `'for': []`. It used
to load ftdetect files.)
2014-08-10 13:46:46 +09:00
Junegunn Choi
f43067c7a5 Merge pull request #51 from junegunn/public-api
Add plug#helptags and plug#load (#48)
2014-08-09 23:44:59 +09:00
Junegunn Choi
e6cba28997 Fix error messages 2014-08-09 13:11:41 +09:00
Junegunn Choi
f1b8832a13 Add plug#load() (#48) 2014-08-09 12:59:20 +09:00
Junegunn Choi
d0c94a9b08 Add plug#helptags() 2014-08-09 12:58:16 +09:00
Junegunn Choi
3a2e406cd0 Merge pull request #47 from junegunn/fix-upgrade
Do not require reloading of .vimrc after PlugUpgrade
2014-08-05 19:09:17 +09:00
Junegunn Choi
84cdf61730 Do not require reloading of .vimrc after PlugUpgrade 2014-08-05 18:52:19 +09:00
Junegunn Choi
0aeea1db08 Update README.md 2014-08-05 15:32:28 +09:00
Junegunn Choi
8289477d18 Revert "Make sure update/install after PlugUpgrade work"
This reverts commit 19b12e2216.

No luck. The user still have to reload .vimrc anyway. Let's just make it
clear that a restart can be required after PlugUpgrade.
2014-08-05 01:50:03 +09:00
Junegunn Choi
19b12e2216 Make sure update/install after PlugUpgrade work
By not assuming `frozen` property exists. I tried to fix it with
s:upgrade_specs, but it has no effect if the old version of vim-plug
doesn't know about it.
2014-08-05 01:43:42 +09:00
Junegunn Choi
4c9ebe9c31 Add -bar option to commands 2014-08-05 01:31:19 +09:00
Junegunn Choi
74dcd13575 s:upgrade_specs should be called after reloading the source 2014-08-05 01:25:34 +09:00
Junegunn Choi
518f20652f Merge pull request #46 from vheon/fix-multiple-create-directory
Do not try to create g:plug_home more than once
2014-08-05 00:56:26 +09:00
Andrea Cedraro
665ec057d7 Do not try to create g:plug_home more than once 2014-08-04 17:43:34 +02:00
Junegunn Choi
bc212dca77 Merge pull request #45 from junegunn/travis-ci-rubies
Test against multiple versions of Ruby
2014-08-04 16:40:11 +09:00
Junegunn Choi
8da7b50fb2 Test against multiple versions of Ruby
As discussed in junegunn/vim-plug#31
2014-08-04 16:31:05 +09:00
Junegunn Choi
4ae2e879e1 Note on escaping double quotes in inline expression 2014-08-02 14:04:03 +09:00
Junegunn Choi
93628b1c3d Forced run of post-update hooks using bang commands
PlugInstall! / PlugUpdate!
2014-08-02 12:13:52 +09:00
Junegunn Choi
01e126469b Remove duplicate expression and escape helptags directory 2014-08-02 02:52:56 +09:00
Junegunn Choi
a7477f04b7 Update README 2014-08-02 01:12:01 +09:00
Junegunn Choi
0fdb56ba72 Update README 2014-08-02 01:00:59 +09:00
Junegunn Choi
d89949f16c Update README.md 2014-08-01 23:46:50 +09:00
Junegunn Choi
19b8221c14 Update README 2014-08-01 23:37:19 +09:00
Junegunn Choi
336fadd236 Remove FAQ/Troubleshooting section and add link to wiki page 2014-08-01 23:33:26 +09:00
Junegunn Choi
a216e38a59 Merge pull request #44 from FriedSock/test_refactoring
Force use of bash for Vader tests.
2014-08-01 23:26:26 +09:00
Jack Bracewell
d930594686 Force use of bash for Vader tests.
If not using a bash compatible shell (like fish), then this will be
set as the default Vim shell. Leading to half the tests failing with
E484: CAN’T OPEN FILE
2014-08-01 15:16:21 +01:00
Junegunn Choi
f4261711ae Update README 2014-08-01 02:01:31 +09:00
Junegunn Choi
61b77bc8e8 Fix many subtle issues regarding on-demand loading etc.
- On-demand loading
    - Fix loading of unwanted files (e.g. colors/*.vim, syntax/*.vim, etc.)
- Filetyp-based on-demand loading
    - Load `after/ftdetect` as well
    - Make sure indent files are loaded by invoking
      `doautocmd filetypeindent FileType`
- Ensure plugin loaded when it was added after Vim started
- Do not reload $MYVIMRC after installtion/update
    - Instead simply call plug#end()
2014-07-31 16:34:41 +09:00
Junegunn Choi
fe7c7e7b40 Minor tweaks 2014-07-31 03:04:59 +09:00
Junegunn Choi
25afdf138c Refactoring
- Remove dead code
- Extract method
2014-07-31 01:01:59 +09:00
Junegunn Choi
b36fd34da0 Ensure files under after are loaded when first installed 2014-07-31 00:17:21 +09:00
Junegunn Choi
7e55690f19 Update examples 2014-07-30 20:00:21 +09:00
Junegunn Choi
30ef53d832 Remove support for experiemental dependency resolution (#43)
🎉
2014-07-30 19:52:19 +09:00
Junegunn Choi
f58d090bb2 Add dir option: managed plugins outside g:plug_home 2014-07-30 19:20:51 +09:00
Junegunn Choi
eeef77e9c8 Merge branch 'vheon-refactoring' into refactoring 2014-07-29 23:37:47 +09:00
Andrea Cedraro
6af2cd8946 Inline substitute inside s:dirpath() 2014-07-29 14:21:11 +02:00
Junegunn Choi
878cdd5309 Unmap / and ? from vim-oblique after test 2014-07-29 19:18:33 +09:00
Junegunn Choi
9bb2da53a0 Replace s:extract_name with a single fnamemodify call 2014-07-29 19:17:12 +09:00
Junegunn Choi
58c06ed77e Use single-quotes whenever possible for consistency 2014-07-29 19:07:09 +09:00
Junegunn Choi
2e691c6feb Define a separate version of s:is_local_plug for Windows 2014-07-29 10:09:05 +09:00
Junegunn Choi
a18087610a Use fnamemodify instead of split hackery
Simpler and faster
2014-07-29 02:42:53 +09:00
Junegunn Choi
276106d987 Performance tuning: reduce the number of s:parse_options calls 2014-07-29 02:11:59 +09:00
Junegunn Choi
d499fc311a Use dot operator instead of get()
The reason I used get() instead of concise dot operator when accessing
`frozen` and `local` properties of plugin spec was to avoid errors when
a user "PlugUpgrade" from an old version of vim-plug whose g:plugs does
not have those properties. Added the code to patch the old version of
g:plugs so that we can safely use dot operators.
2014-07-29 01:51:32 +09:00
Junegunn Choi
c4b4aa8f07 Code cleanup: reuse s:trim() when possible 2014-07-29 00:19:29 +09:00
Junegunn Choi
d690f8d576 Change error reporting method
As suggested by @vheon:
https://github.com/junegunn/vim-plug/pull/40#issuecomment-50278543
2014-07-28 19:56:59 +09:00
Junegunn Choi
8738341ad0 Performance tuning: reduce the number of globpath calls 2014-07-28 19:45:40 +09:00
Junegunn Choi
5ab2024fbb Performace tuning: inlining some function calls 2014-07-28 19:41:05 +09:00
Junegunn Choi
300176ba9f Avoid echoerr inside catch block 2014-07-28 01:27:30 +09:00
Andrea Cedraro
da7d6bd58b Refactor s:add function 2014-07-27 17:38:57 +02:00
Junegunn Choi
b651558c63 Update README 2014-07-27 12:00:36 +09:00
Junegunn Choi
2d815ad2f0 Escape angle brackets in README 2014-07-27 11:58:12 +09:00
Junegunn Choi
3af4079179 Fix typo 2014-07-27 11:55:06 +09:00
Junegunn Choi
e6a594f1ad Change post-hook function to take a dictionary for more control 2014-07-27 11:28:53 +09:00
Junegunn Choi
e741d02ad0 Fix elapsed time to include the time spent in post-update hook 2014-07-27 11:15:13 +09:00
Junegunn Choi
b2208640d4 Update documentation 2014-07-27 11:06:47 +09:00
Junegunn Choi
aa49c38586 Don't need <Plug> map (#38) 2014-07-27 03:16:44 +09:00
Junegunn Choi
b6b10ac17e Print progress of post-update hooks using :! (#38) 2014-07-27 03:07:37 +09:00
Junegunn Choi
706f7e00ea Merge pull request #39 from vheon/fix-type-parameter-clarity
Replace return value of type() with call to the function
2014-07-27 02:22:31 +09:00
Andrea Cedraro
6ff1031339 Replace return value of type() with named values 2014-07-26 19:14:46 +02:00
Junegunn Choi
0936877399 Don't check for the need for post-update hook when interrupted 2014-07-27 00:42:23 +09:00
Junegunn Choi
d956e16f15 Minor refactoring 2014-07-26 22:58:34 +09:00
Junegunn Choi
f98c8456fa Post-update hook (do option) 2014-07-26 22:49:18 +09:00
Junegunn Choi
5b2c03d3a8 R to retry interrupted tasks as well 2014-07-23 11:46:29 +09:00
Junegunn Choi
0b31be49cf Update README 2014-07-22 12:47:34 +09:00
Junegunn Choi
74fa6ab9df 'R' to retry failed update/installation tasks 2014-07-22 12:46:59 +09:00
Junegunn Choi
0d7e20c984 Merge pull request #37 from junegunn/retries
Retry in case of timeout
2014-07-21 23:13:43 +09:00
Junegunn Choi
e2714fb56e Retry in 3 seconds 2014-07-21 23:09:16 +09:00
Junegunn Choi
3b83a22ea4 Avoid InsertEnter/InsertLeave events in GUI MacVim workaround 2014-07-21 14:27:38 +09:00
Junegunn Choi
cd418369bc Use gui_macvim instead of mac (#36) 2014-07-21 11:42:27 +09:00
Junegunn Choi
279a334c8b Temporarily disable &imd on GUI MacVim (#36) 2014-07-21 11:35:48 +09:00
Junegunn Choi
9132e9d50d Workaround for screen freeze in MacVim GUI (#36) 2014-07-21 02:49:47 +09:00
Junegunn Choi
3323163e04 Retry in case of timeout (#35)
while gradually increasing the time limit
2014-07-20 02:14:15 +09:00
Junegunn Choi
e4671eaf9e Do not assume that frozen key exists
To avoid possible error after PlugUpgrade
2014-07-18 01:27:41 +09:00
Junegunn Choi
9afa356fb3 Exclude unmanaged plugins from PlugDiff output 2014-07-17 10:28:59 +09:00
Junegunn Choi
e04f696682 Ignore errors during :helptags
https://github.com/junegunn/vim-plug/issues/31#issuecomment-49058031
2014-07-17 02:20:00 +09:00
Junegunn Choi
4cb5fd04a6 Note on single quotes (#33) 2014-07-16 20:40:49 +09:00
Junegunn Choi
c16743e8fc License 2014-07-16 20:39:39 +09:00
Junegunn Choi
46a6e8441f Pin first and last path in &rtp (#34) 2014-07-16 20:26:42 +09:00
Junegunn Choi
466d1839b3 Add support for local plugins. Add frozen option (#32) 2014-07-16 19:52:58 +09:00
Junegunn Choi
c3cf35abb5 Ignore occasional error from Ruby 1.8.7
Related: https://bugs.ruby-lang.org/issues/1471
2014-07-13 22:02:11 +09:00
Junegunn Choi
344f80aedb Fix Ruby installer for Ruby 1.8.7 (#31) 2014-07-13 20:18:56 +09:00
Junegunn Choi
dae0540a11 Change gif 2014-07-13 17:39:19 +09:00
Junegunn Choi
af89938633 Real-time progress report
This commit is almost identical to the reverted
60b907c87f, but it tries to avoid high CPU load
by not printing every line.
2014-07-13 03:58:16 +09:00
Junegunn Choi
35c5f2830b Revert "Real-time progress report"
This reverts commit 60b907c87f.
2014-07-13 03:22:25 +09:00
Junegunn Choi
60b907c87f Real-time progress report 2014-07-13 03:05:54 +09:00
Junegunn Choi
9ceb9caa09 Minor refactoring 2014-07-10 00:44:09 +09:00
Junegunn Choi
42a42e7e71 Fix after directory and Plugfile on Windows 2014-07-10 00:13:32 +09:00
Junegunn Choi
8885b1086f Minor refactoring in ODL: no need to pass full dict 2014-07-09 01:14:03 +09:00
Junegunn Choi
90c07f269c Fix <Plug>-based ODL on visual range spanning multiple lines 2014-07-07 22:55:44 +09:00
Junegunn Choi
f1c5157e35 Fix <Plug>-based on-demand-loading on visual mode 2014-07-07 19:06:20 +09:00
Junegunn Choi
7f1ec7b12b Load ftplugins while avoiding extraneous FileType events (#24, #25) 2014-07-04 14:20:48 +09:00
Junegunn Choi
f90afc9081 Remove images from repo 2014-06-23 23:39:48 +09:00
Junegunn Choi
612b9b3afd Fix test cases for travis-ci 2014-06-23 13:16:14 +09:00
Junegunn Choi
58891e05be Travis-CI integration 2014-06-23 12:57:46 +09:00
Junegunn Choi
baf7b18f73 Update test runner script 2014-06-23 12:53:51 +09:00
Junegunn Choi
cc37ed48be Improve PlugStatus message
Invalid branch/tag: %s (expected: %s). Try PlugUpdate.
2014-06-23 12:22:25 +09:00
Junegunn Choi
afe7dc6f8f Use case-sensitive match 2014-06-23 04:04:03 +09:00
Junegunn Choi
8863a3a53c Fix #28: False alarm from PlugStatus when tag used 2014-06-23 04:02:49 +09:00
Junegunn Choi
ee04a646d3 Fix: dependent plugins not loaded after initial installaion 2014-06-22 21:49:51 +09:00
Junegunn Choi
6ddee62977 Ensure ftplugin files are loaded (#24) 2014-06-22 13:09:18 +09:00
Junegunn Choi
8cf5fca9ca Revert "Ensure ftplugin files are loaded (#24)"
This reverts commit a026eb39c4.

Conflicts:
	plug.vim
2014-06-22 12:49:22 +09:00
Junegunn Choi
347fccb030 Revert "Remove FileType autocmd after loaded"
This reverts commit db3f5ad5c3.

Conflicts:
	plug.vim
2014-06-22 12:45:21 +09:00
Junegunn Choi
a026eb39c4 Ensure ftplugin files are loaded (#24)
If `filetype plugin on` is called before `plug#end()`, filetype
plugin handler is invoked before ODL autocmd from vim-plug which
updates runtimepath and ftplugin files are not loaded.
2014-06-22 10:27:15 +09:00
Junegunn Choi
4d352e1849 Revert "Clear #filetypeplugin for filetype-based ODL (#24)"
This reverts commit 1d477a1a01.
2014-06-22 10:21:58 +09:00
Junegunn Choi
db3f5ad5c3 Remove FileType autocmd after loaded 2014-06-22 09:58:14 +09:00
Junegunn Choi
1d477a1a01 Clear #filetypeplugin for filetype-based ODL (#24) 2014-06-22 04:24:19 +09:00
Junegunn Choi
288a4f72ce Add pending test case on dependency resolution 2014-06-20 21:35:42 +09:00
Junegunn Choi
5168cd50db Allow updating subset of plugins
This commit extends `PlugInstall` and `PlugUpdate` command to allow
updating only a subset of plugins as follows:

    " With tab completion of plugin names
    :PlugInstall vim-easy-align seoul256
    :PlugUpdate vim-easy-align seoul256
2014-06-20 20:53:57 +09:00
Junegunn Choi
4d32762432 Allow -range in on-demand loading commands 2014-06-20 20:35:33 +09:00
Junegunn Choi
8dff1dae37 Allow trailing comment after Plug declaration (#23) 2014-06-20 09:58:50 +09:00
Junegunn Choi
b5b687ad9a On-demand loading on filetypes (#21) 2014-06-17 11:59:42 +09:00
Junegunn Choi
7e69a50890 Fix on-demand loading: load ftdetect and **/*.vim as well 2014-06-17 11:45:42 +09:00
Junegunn Choi
476a613746 Fix #19: install error 2014-06-06 00:16:57 +09:00
Junegunn Choi
12b5dcb903 git submodule update --init --recursive (#18) 2014-06-03 18:51:01 +09:00
Junegunn Choi
de81f95f69 Use black hole register when emptying buffer 2014-04-15 02:01:47 +09:00
Junegunn Choi
b7cf1ca65a Echo "Press 'D'" message only on PlugUpdate 2014-04-15 02:00:39 +09:00
Junegunn Choi
7fa22a6927 PlugDiff: Display commit info in preview window 2014-04-14 21:20:21 +09:00
Junegunn Choi
6f487f1579 Explicitly return 0 2014-04-14 20:27:23 +09:00
Junegunn Choi
f8fcc81783 Use s:esc function 2014-04-09 15:25:21 +09:00
Junegunn Choi
32dc4ca93f Change PlugDiff message (suggested by @beloglazov in #17) 2014-04-09 11:59:46 +09:00
Junegunn Choi
7047eda149 Change PlugDiff message (thanks to @beloglazov) 2014-04-09 11:22:20 +09:00
Junegunn Choi
5679540a2a Less LOC 2014-04-09 01:03:43 +09:00
Junegunn Choi
d2f6c09c7a Fix syntax highlighting (#17) 2014-04-09 00:53:37 +09:00
Junegunn Choi
acbba74fe2 Fix output format (#17) 2014-04-09 00:40:19 +09:00
Junegunn Choi
47a3bebb30 Fix test case for PlugStatus 2014-04-08 21:47:57 +09:00
Junegunn Choi
f00dacd7bd Add PlugDiff command (#17) 2014-04-08 21:43:49 +09:00
Junegunn Choi
8986f87b83 Change PlugStatus output to match those of other commands 2014-04-08 21:33:38 +09:00
Junegunn Choi
ae6f3254d8 Place cursor on the 2nd line during PlugClean 2014-04-08 21:32:29 +09:00
Junegunn Choi
0c1744a819 Merge pull request #16 from CD3/load-order
Respect plug load order (for dependencies)
2014-03-30 12:08:33 +09:00
C.D. Clark III
b763cae81a added plug load order (for dependencies)
plugin directories now appear in the runtime path in the same order they
are listed. this allows plugs that depend on other plugins to be loaded
after their dependencies.
2014-03-29 21:29:54 -05:00
Junegunn Choi
358363eefc Support paths with spaces (#15 [, #14]) 2014-03-27 01:07:09 +09:00
Junegunn Choi
c827d2fa05 Merge pull request #13 from junegunn/shellesc
Replace shellescape function to avoid error when &shellslash is set
2014-03-19 12:22:30 +09:00
Junegunn Choi
2ef9b8a492 Replace shellescape function to avoid error when &shellslash is set 2014-03-19 12:15:26 +09:00
Junegunn Choi
2a3a40dd42 Fix PlugStatus/PlugClean on Windows 2014-03-19 00:43:37 +09:00
Junegunn Choi
411bb2bef9 Update README (Related: #12) 2014-03-14 01:32:08 +09:00
Junegunn Choi
ff01c54720 Remove unnecessary code 2014-03-13 01:04:17 +09:00
14 changed files with 1753 additions and 530 deletions

15
.travis.yml Normal file
View File

@@ -0,0 +1,15 @@
language: ruby
rvm:
- 1.8.7
- 2.0.0
before_script: |
hg clone https://code.google.com/p/vim/
cd vim
./configure --with-features=huge --enable-rubyinterp
make
sudo make install
cd -
script: |
test/run !

232
README.md
View File

@@ -1,25 +1,22 @@
![vim-plug](https://raw.github.com/junegunn/vim-plug/master/plug.png)
![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)
A single-file Vim plugin manager.
A minimalist Vim plugin manager.
Somewhere between [Pathogen](https://github.com/tpope/vim-pathogen) and
[Vundle](https://github.com/gmarik/vundle), but with faster parallel installer.
![](https://raw.github.com/junegunn/vim-plug/master/gif/vim-plug.gif)
![](https://raw.github.com/junegunn/i/master/vim-plug/installer.gif)
### Pros.
- Easier to setup
- Parallel installation/update (requires
[+ruby](http://junegunn.kr/2013/09/installing-vim-with-ruby-support/))
- Smallest possible feature set
- Branch/tag support
- On-demand loading
- Dependency resolution using `Plugfile` (experimental)
### Cons.
- Everything else
- Easier to setup: Single file. No boilerplate code required.
- Easier to use: Concise, intuitive syntax
- [Super-fast](https://raw.github.com/junegunn/i/master/vim-plug/40-in-4.gif)
parallel installation/update (requires
[+ruby](https://github.com/junegunn/vim-plug/wiki/ruby))
- On-demand loading to achieve
[fast startup time](http://junegunn.kr/images/vim-startup-time.png)
- Post-update hooks
- Can choose a specific branch or tag for each plugin
- Support for externally managed plugins
### Usage
@@ -28,7 +25,8 @@ and put it in ~/.vim/autoload
```sh
mkdir -p ~/.vim/autoload
curl -fLo ~/.vim/autoload/plug.vim https://raw.github.com/junegunn/vim-plug/master/plug.vim
curl -fLo ~/.vim/autoload/plug.vim \
https://raw.github.com/junegunn/vim-plug/master/plug.vim
```
Edit your .vimrc
@@ -36,43 +34,72 @@ Edit your .vimrc
```vim
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
Plug 'junegunn/seoul256.vim'
Plug 'junegunn/vim-easy-align'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Plug 'user/repo1', 'branch_or_tag'
" Plug 'user/repo2', { 'rtp': 'vim/plugin/dir', 'branch': 'devel' }
" Plug 'git@github.com:junegunn/vim-github-dashboard.git'
" ...
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using git URL
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Plugin options
Plug 'nsf/gocode', { 'tag': 'go.weekly.2012-03-13', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'
call plug#end()
```
Reload .vimrc and `:PlugInstall` to install plugins.
### Plugin directory
If you omit the path argument to `plug#begin()`, plugins are installed in
`plugged` directory under the first path in `runtimepath` at the point when
`plug#begin()` is called. This is usually `~/.vim/plugged` (or
`$HOME/vimfiles/plugged` on Windows) given that you didn't touch runtimepath
before the call.
### Commands
| Command | Description |
| ---------------------- | ------------------------------------------------------------------ |
| PlugInstall [#threads] | Install plugins |
| PlugUpdate [#threads] | Install or update plugins |
| PlugClean[!] | Remove unused directories (bang version will clean without prompt) |
| PlugUpgrade | Upgrade vim-plug itself |
| PlugStatus | Check the status of plugins |
| Command | Description |
| ----------------------------------- | ------------------------------------------------------------------ |
| `PlugInstall [name ...] [#threads]` | Install plugins |
| `PlugUpdate [name ...] [#threads]` | Install or update plugins |
| `PlugClean[!]` | Remove unused directories (bang version will clean without prompt) |
| `PlugUpgrade` | Upgrade vim-plug itself |
| `PlugStatus` | Check the status of plugins |
| `PlugDiff` | See the updated changes from the previous PlugUpdate |
### `Plug` options
| Option | Description |
| -------------- | -------------------------------------------------------------------- |
| `branch`/`tag` | Branch or tag of the repository to use |
| `rtp` | Subdirectory that contains Vim plugin |
| `dir` | Custom directory for the plugin |
| `do` | Post-update hook (string or funcref) |
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
| `for` | On-demand loading: File types |
| `frozen` | Do not install/update plugin unless explicitly given as the argument |
### Options for parallel installer
| Flag | Default | Description |
| ---------------- | ------- | --------------------------------- |
| `g:plug_threads` | 16 | Default number of threads to use |
| `g:plug_timeout` | 60 | Time limit of each task in seconds |
| Flag | Default | Description |
| ---------------- | ------- | ------------------------------------ |
| `g:plug_threads` | 16 | Default number of threads to use |
| `g:plug_timeout` | 60 | Time limit of each task in seconds |
| `g:plug_retries` | 2 | Number of retries in case of timeout |
### Keybindings
- `D` - `PlugDiff`
- `S` - `PlugStatus`
- `R` - Retry failed update or installation tasks
- `q` - Close the window
- `:PlugStatus`
- `L` - Load plugin
- `:PlugDiff`
- `X` - Revert the update
### Example: A small [sensible](https://github.com/tpope/vim-sensible) Vim configuration
@@ -90,76 +117,73 @@ Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Multiple commands
Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
" Loaded when clojure file is opened
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" On-demand loading on both conditions
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
```
### Dependency resolution
### Post-update hooks
See [Dependency
Resolution](https://github.com/junegunn/vim-plug/wiki/Dependency-Resolution).
There are some plugins that require extra steps after installation or update.
In that case, use `do` option to describe the task to be performed.
```vim
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' }
```
If you need more control, you can pass a reference to a Vim function that
takes a single argument.
```vim
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force
!./install.sh
endif
endfunction
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
```
Both forms of post-update hook are executed inside the directory of the plugin
and only run when the repository has changed, but you can force it to run
unconditionally with the bang-versions of the commands: `PlugInstall!` and
`PlugUpdate!`.
Make sure to escape BARs and double-quotes when you write `do` option inline
as they are mistakenly recognized as command separator or the start of the
trailing comment.
```vim
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
```
But you can avoid the escaping if you extract the inline specification using a
variable (or any Vimscript expression) as follows:
```vim
let g:fzf_install = 'yes | ./install'
Plug 'junegunn/fzf', { 'do': g:fzf_install }
```
### FAQ/Troubleshooting
See [FAQ/Troubleshooting](https://github.com/junegunn/vim-plug/wiki/faq).
### Articles
- [Writing my own Vim plugin manager](http://junegunn.kr/2013/09/writing-my-own-vim-plugin-manager)
- [Thoughts on Vim plugin dependency](http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency)
- [Vim plugins and startup time](http://junegunn.kr/2014/07/vim-plugins-and-startup-time)
- ~~[Thoughts on Vim plugin dependency](http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency)~~
- *Support for Plugfile has been removed since 0.5.0*
### FAQ/Troubleshooting
### License
#### Plugins are not installed/updated in parallel
Your Vim does not support Ruby interface. `:echo has('ruby')` should print 1.
In order to setup Vim with Ruby support, you may refer to [this
article](http://junegunn.kr/2013/09/installing-vim-with-ruby-support).
#### *Vim: Caught deadly signal SEGV*
If your Vim crashes with the above message, first check if its Ruby interface is
working correctly with the following command:
```vim
:ruby puts RUBY_VERSION
```
If Vim crashes even with this command, it is likely that Ruby interface is
broken, and you have to rebuild Vim with a working version of Ruby.
(`brew remove vim && brew install vim` or `./configure && make ...`)
If you're on OS X, one possibility is that you had installed Vim with
[Homebrew](http://brew.sh/) while using a Ruby installed with
[RVM](http://rvm.io/) or [rbenv](https://github.com/sstephenson/rbenv) and later
removed that version of Ruby.
[Please let me know](https://github.com/junegunn/vim-plug/issues) if you can't
resolve the problem. In the meantime, you can set `g:plug_threads` to 1, so that
Ruby installer is not used at all.
#### Freezing plugin version with commit hash
vim-plug does not allow you to freeze the version of a plugin with its commit
hash. This is by design. I don't believe a user of a plugin should be looking
at its individual commits. Instead, one should be choosing the right version
using release tags or versioned branches (e.g. 1.2.3, stable, devel, etc.)
```vim
Plug 'junegunn/vim-easy-align', '2.9.2'
```
If the repository doesn't come with such tags or branches, you should think of
it as "unstable" or "in development", and always use its latest revision.
If you really must choose a certain untagged revision, consider forking the
repository.
### Regarding feature request
You may submit a request for a new feature by [creating an
issue](https://github.com/junegunn/vim-plug/issues). However, please be minded
that this is an opinionated software and I want to keep the feature set as small
as possible. So I may not agree with you on the necessity of the suggested
feature. If that happens, I suggest the following options.
1. Check out [Vundle](https://github.com/gmarik/vundle) or
[NeoBundle](https://github.com/Shougo/neobundle.vim).
They offer broader feature sets.
2. Create a fork of this project and let it be your own plugin manager.
There's no need for us to have a single canonical branch.
MIT

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

1205
plug.vim

File diff suppressed because it is too large Load Diff

View File

@@ -7,8 +7,10 @@ Test cases for vim-plug
### Run
```vim
:e workflow.vader | Vader
```
./run
./run !
```
### TODO
@@ -18,7 +20,6 @@ Test cases for the following features are currently missing:
- Output formatting
- Timeout or interrupt cleaning up git processes
- User prompt in PlugClean command
- Automatic dependency resolution using Plugfile
- Single-threaded installer
- Windows support

View File

@@ -5,15 +5,50 @@ cd ..
PLUG_SRC=$(pwd)/plug.vim
cd - > /dev/null
export VADER_RTP=$TMPDIR/vader-rtp
vim -e +Vader -c ':call writefile([fnamemodify(globpath(&rtp, "autoload/vader.vim"), ":h:h")], $VADER_RTP)' +q
if [ ! -d vader.vim ]; then
git clone https://github.com/junegunn/vader.vim.git
fi
MINI_VIMRC=$TMPDIR/mini-vimrc
cat > $MINI_VIMRC << EOF
let \$MYVIMRC = '$MINI_VIMRC'
set nocompatible
set rtp=$(cat $VADER_RTP)
source $PLUG_SRC
rm -rf fzf
if [ ! -d fzf-staged ]; then
git clone https://github.com/junegunn/fzf.git fzf-staged
fi
make_dirs() {
mkdir -p "$1"
cd "$1"
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
for d in *; do
cat > $d/xxx.vim << EOF
" echom expand('<sfile>')
let g:$2 = get(g:, '$2', [])
call add(g:$2, '${1:4}/$d')
EOF
done
cd - > /dev/null
}
make_dirs xxx/ xxx
make_dirs xxx/after xxx
mkdir xxx/doc
cat > xxx/doc/xxx.txt << DOC
hello *xxx*
DOC
make_dirs yyy/ yyy
make_dirs z1/ z1
make_dirs z2/ z2
cat > /tmp/mini-vimrc << VIMRC
set rtp+=vader.vim
set shell=/bin/bash
source $PLUG_SRC
VIMRC
if [ "$1" = '!' ]; then
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null &&
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! workflow.vader' > /dev/null
else
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
fi
vim -u $MINI_VIMRC +Vader*

View File

@@ -1,5 +1,8 @@
Execute (Initialize test environment):
Save &rtp, g:plug_home, $MYVIMRC
Save &rtp, g:plugs, g:plug_home
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')
@@ -13,19 +16,34 @@ Execute (Initialize test environment):
set t_Co=256
colo default
pclose
let g:vimrc_reloaded = 0
let vimrc = tempname()
call writefile(['let g:vimrc_reloaded += 1'], vimrc)
let $MYVIMRC = vimrc
function! PlugStatusSorted()
PlugStatus
%y
q
normal! P
%sort
g/^$/d
endfunction
function! AssertExpect(bang, pat, cnt)
let op = a:bang ? '==' : '=~'
AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
endfunction
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
Execute (Print Ruby version):
redir => out
silent ruby puts RUBY_VERSION
redir END
Log substitute(out, '\n', '', 'g')
Execute (plug#end() before plug#begin() should fail):
try
call plug#end()
Assert 0, 'should not reach here'
catch
Assert stridx(v:exception, 'Call plug#begin() first') >= 0
endtry
redir => out
AssertEqual 0, plug#end()
redir END
Assert stridx(out, 'Call plug#begin() first') >= 0
Execute (plug#begin() without path argument):
call plug#begin()
@@ -35,12 +53,10 @@ Execute (plug#begin() without path argument):
Execute (plug#begin() without path argument with empty &rtp):
let save_rtp = &rtp
set rtp=
try
call plug#begin()
Assert 0, 'should not reach here'
catch
Assert stridx(v:exception, 'Unable to determine plug home') >= 0, 'Got: '.v:exception
endtry
redir => out
AssertEqual 0, plug#begin()
redir END
Assert stridx(out, 'Unable to determine plug home') >= 0
let &rtp = save_rtp
Execute (plug#begin(path)):
@@ -58,51 +74,66 @@ Execute (Subsequent plug#begin() calls will reuse g:plug_home):
Execute (Test Plug command):
" Git repo with branch
Plug 'junegunn/seoul256.vim', 'no-t_co'
AssertEqual 'https://git:@github.com/junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
Plug 'junegunn/seoul256.vim', 'yes-t_co'
AssertEqual 'https://git::@github.com/junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
" Git repo with tag
Plug 'junegunn/goyo.vim', '1.5.2'
AssertEqual 'https://git::@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
AssertEqual '1.5.2', g:plugs['goyo.vim'].branch
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
AssertEqual '1.5.3', g:plugs['goyo.vim'].branch
" Git URI
Plug 'git@github.com:junegunn/vim-emoji.git'
AssertEqual 'git@github.com:junegunn/vim-emoji.git', g:plugs['vim-emoji'].uri
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
AssertEqual 'https://bitbucket.org/junegunn/vim-emoji.git', g:plugs['vim-emoji'].uri
AssertEqual 'master', g:plugs['vim-emoji'].branch
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
" vim-scripts/
Plug 'beauty256'
AssertEqual 'https://git:@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
AssertEqual 'https://git::@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
AssertEqual 'master', g:plugs.beauty256.branch
AssertEqual 3, len(g:plugs)
AssertEqual 4, len(g:plugs)
Execute (Plug command with dictionary option):
Log string(g:plugs)
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual '././', g:plugs['seoul256.vim'].rtp
AssertEqual 3, len(g:plugs)
Log string(g:plugs)
AssertEqual 4, len(g:plugs)
Execute (PlugStatus before installation):
PlugStatus
AssertEqual 3, len(filter(getline(1, line('$')), 'v:val =~ "Not found"'))
AssertExpect 'Not found', 4
q
Execute (PlugClean before installation):
PlugClean
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Already clean"'))
AssertExpect 'Already clean', 1
q
Execute (plug#end() updates &rtp):
call plug#end()
Assert len(&rtp) > len(basertp)
AssertEqual first_rtp, split(&rtp, ',')[0]
AssertEqual last_rtp, split(&rtp, ',')[-1]
Execute (Yet, plugins are not available):
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
Execute (PlugInstall):
PlugInstall
AssertEqual 1, g:vimrc_reloaded
q
Execute (Plugin available after installation):
@@ -110,54 +141,70 @@ Execute (Plugin available after installation):
Execute (PlugClean after installation):
PlugClean
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Already clean"'))
AssertExpect 'Already clean', 1
q
Execute (PlugStatus after installation):
PlugStatus
AssertEqual 3, len(filter(getline(1, line('$')), 'v:val =~ "OK"'))
Log getline(1, '$')
AssertExpect 'OK', 4
q
Execute (Change tag of goyo.vim):
call plug#begin()
Plug 'junegunn/goyo.vim'
call plug#end()
Execute (PlugStatus):
call PlugStatusSorted()
Expect:
Invalid branch/tag: 1.5.3 (expected: master). Try PlugUpdate.
Finished. 1 error(s).
[=]
x goyo.vim:
Execute (PlugUpdate to set the right branch):
PlugUpdate
call PlugStatusSorted()
Expect:
- goyo.vim: OK
Finished. 0 error(s).
[=]
Execute (Change branch of seoul256.vim):
call plug#begin()
Plug 'junegunn/seoul256.vim'
Plug 'git@github.com:junegunn/vim-emoji.git'
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
call plug#end()
Execute (PlugStatus):
PlugStatus
%y
q
normal! P
%sort
g/^$/d
call PlugStatusSorted()
Expect:
Invalid branch: no-t_co. Try PlugUpdate.
Invalid branch/tag: no-t_co (expected: master). Try PlugUpdate.
- vim-emoji: OK
Finished. 1 error(s).
[==]
x seoul256.vim:
Execute (Change URI of seoul256.vim):
call plug#begin()
Plug 'junegunn.choi/seoul256.vim'
Plug 'git@github.com:junegunn/vim-emoji.git'
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
call plug#end()
Execute (PlugStatus):
PlugStatus
%y
q
normal! P
%sort
g/^$/d
call PlugStatusSorted()
Expect:
Expected: https://git:@github.com/junegunn.choi/seoul256.vim.git
Invalid URI: https://git:@github.com/junegunn/seoul256.vim.git
Expected: https://git::@github.com/junegunn.choi/seoul256.vim.git
Invalid URI: https://git::@github.com/junegunn/seoul256.vim.git
PlugClean required.
- vim-emoji: OK
Finished. 1 error(s).
[==]
x seoul256.vim:
# TODO: does not work due to inputsave()
@@ -169,7 +216,9 @@ Expect:
Execute (PlugClean! to remove seoul256.vim):
PlugClean!
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"'))
" Three removed, emoji left
AssertExpect '^- ', 3
AssertExpect 'Removed', 1
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
q
@@ -181,50 +230,636 @@ Execute (Change GIT URI of vim-emoji):
call plug#end()
Execute (PlugStatus):
PlugStatus
%y
q
normal! P
%sort
g/^$/d
call PlugStatusSorted()
Expect:
Expected: https://git:@github.com/junegunn/vim-emoji.git
Invalid URI: git@github.com:junegunn/vim-emoji.git
Expected: https://git::@github.com/junegunn/vim-emoji.git
Invalid URI: https://bitbucket.org/junegunn/vim-emoji.git
Not found. Try PlugInstall.
PlugClean required.
Finished. 2 error(s).
[==]
x seoul256.vim:
x vim-emoji:
Execute (PlugClean! to remove vim-emoji):
PlugClean!
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"'))
AssertExpect '^- ', 1
AssertExpect 'Removed', 1
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
q
Execute (PlugUpdate to install both again):
PlugUpdate
AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "Cloning into"'))
AssertEqual 2, g:vimrc_reloaded
AssertExpect '^- [^:]*:', 2
Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found'
Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found'
q
Execute (PlugUpdate only to find out plugins are up-to-date):
Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
PlugUpdate
AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "Already up-to-date"'))
AssertEqual 3, g:vimrc_reloaded
AssertExpect 'Already up-to-date', 2
normal D
AssertEqual 'No updates.', getline(1)
q
Execute (PlugDiff - 'No updates.'):
PlugDiff
AssertEqual 'No updates.', getline(1)
q
Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
for repo in ['seoul256.vim', 'vim-emoji']
call system(printf('cd %s/%s && git reset HEAD^^ --hard', g:plug_home, repo))
endfor
PlugUpdate
" Now we have updates
normal D
AssertEqual 'Last update:', getline(1)
" Preview commit
silent! wincmd P
AssertEqual 0, &previewwindow
" ]] motion
execute 'normal ]]'
let lnum = line('.')
AssertEqual 3, col('.')
" Open commit preview
execute "normal j\<cr>"
wincmd P
AssertEqual 1, &previewwindow
AssertEqual 'git', &filetype
" Back to plug window
wincmd p
" ]] motion
execute 'normal $]]'
AssertEqual lnum + 4, line('.')
AssertEqual 3, col('.')
" [[ motion
execute 'normal 0[['
AssertEqual lnum, line('.')
AssertEqual 3, col('.')
" X key to revert the update
AssertExpect '^- ', 2
execute "normal Xn\<cr>"
AssertExpect '^- ', 2
execute "normal Xy\<cr>"
AssertExpect '^- ', 1
" q will close preview window as well
normal q
" We no longer have preview window
silent! wincmd P
AssertEqual 0, &previewwindow
" q should not close preview window if it's already open
pedit
PlugDiff
AssertExpect '^- ', 1
execute "normal ]]j\<cr>"
normal q
silent! wincmd P
AssertEqual 1, &previewwindow
pclose
Execute (Plug window in a new tab):
PlugDiff
tab new new-tab
set buftype=nofile
PlugUpdate
normal D
AssertExpect '^- ', 1
normal q
AssertEqual 'new-tab', expand('%')
q
q
**********************************************************************
~ On-demand loading / Partial installation/update ~
**********************************************************************
Execute (Trying to execute on-demand commands when plugin is not installed):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] }
call plug#end()
Assert exists(':EasyAlign')
Assert exists(':LiveEasyAlign')
AssertThrows EasyAlign
AssertThrows LiveEasyAlign
Assert !exists(':EasyAlign')
Assert !exists(':LiveEasyAlign')
Execute (New set of plugins):
call plug#begin()
Plug 'junegunn/vim-fnr'
Plug 'junegunn/vim-pseudocl'
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
Plug 'junegunn/vim-redis', { 'for': 'redis' }
call plug#end()
Execute (Check commands):
Assert !exists(':FNR'), 'FNR command should not be found'
Assert !exists(':RedisExecute'), 'RedisExecute command should not be found'
Execute (Partial PlugInstall):
PlugInstall vim-fnr vim-easy-align
AssertExpect 'vim-fnr', 1
q
PlugInstall vim-fnr vim-easy-align 1
AssertExpect 'vim-fnr', 1
AssertExpect 'vim-easy-align', 1
AssertEqual first_rtp, split(&rtp, ',')[0]
AssertEqual last_rtp, split(&rtp, ',')[-1]
q
Given (Unaligned code):
a=1
aa=2
Execute (Check installed plugins):
if has('vim_starting')
Log 'Vader is run from commandline'
runtime! plugin/**/*.vim
endif
Assert exists(':FNR'), 'FNR command should be found'
Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
Assert exists(':EasyAlign'), 'EasyAlign command should be found'
%EasyAlign=
Expect (Aligned code):
a = 1
aa = 2
Given:
Execute (Partial PlugUpdate):
PlugUpdate vim-redis
q
Execute (On-demand loading based on filetypes):
Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
set ft=redis
Assert exists(':RedisExecute'), 'RedisExecute command is now found'
**********************************************************************
~ Local (unmanaged) plugins
**********************************************************************
Execute (Add unmanaged plugin):
let fzf = fnamemodify(g:vader_file, ':h') . '/fzf'
Log fzf
call plug#begin()
Plug fzf, { 'on': 'SomeCommand' }
call plug#end()
" Check uri field
Assert !has_key(g:plugs.fzf, 'uri'), 'Should not have uri field'
" Check dir field
AssertEqual fzf.'/', g:plugs.fzf.dir
" Trailing slashes and backslashes should be stripped
for suffix in ['///', '/\/\/']
call plug#begin()
Plug fzf.suffix, { 'on': 'SomeCommand' }
call plug#end()
" Check dir field
AssertEqual fzf.'/', g:plugs.fzf.dir
endfor
Execute (Plug block for following tests):
call plug#begin()
Plug 'junegunn/vim-easy-align'
Plug fzf, { 'on': 'SomeCommand' }
call plug#end()
" Remove plugins from previous tests
PlugClean!
Execute (PlugInstall will only install vim-easy-align):
PlugInstall
Log getline(1, '$')
AssertExpect 'fzf', 0
q
Execute (PlugUpdate will only update vim-easy-align):
PlugUpdate
Log getline(1, '$')
AssertExpect 'fzf', 0
q
Execute (PlugClean should not care about unmanaged plugins):
PlugClean
Log getline(1, '$')
AssertExpect 'fzf', 0
q
Execute (PlugStatus should point out that the plugin is missing):
PlugStatus
Log getline(1, '$')
AssertExpect 'x fzf', 1
AssertExpect 'Not found', 1
q
Execute (Deploy unmanaged plugin):
Assert !exists(':FZF'), ':FZF command should not exist'
call rename('fzf-staged', 'fzf')
Execute (PlugUpdate still should not care):
PlugUpdate
Log getline(1, '$')
AssertExpect 'fzf', 0
q
Execute (PlugStatus with no error):
PlugStatus
Log getline(1, '$')
AssertExpect 'x fzf', 0
AssertExpect 'Not found', 0
q
Execute (Check &rtp after SomeCommand):
Log &rtp
Assert &rtp !~ 'fzf'
silent! SomeCommand
Assert &rtp =~ 'fzf'
AssertEqual first_rtp, split(&rtp, ',')[0]
AssertEqual last_rtp, split(&rtp, ',')[-1]
Execute (Common parent):
call plug#begin()
Plug 'junegunn/vim-pseudocl'
Plug 'junegunn/vim-fnr'
Plug 'junegunn/vim-oblique'
call plug#end()
PlugInstall
Log getline(1, '$')
AssertExpect! '[===]', 1
q
**********************************************************************
~ Frozen plugins
**********************************************************************
Execute (Frozen plugin are not installed nor updated):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
call plug#end()
redir => out
silent PlugInstall
redir END
Assert out =~ 'No plugin to install'
redir => out
silent PlugUpdate
redir END
Assert out =~ 'No plugin to update'
Execute (But you can still install it if the name is given as the argument):
PlugInstall vim-easy-align
Log getline(1, '$')
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
q
PlugUpdate vim-easy-align
Log getline(1, '$')
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
q
**********************************************************************
~ Retry
**********************************************************************
Execute (Retry failed tasks):
call plug#begin()
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/aaaaaaaaaaaaaa'
call plug#end()
PlugInstall
Log getline(1, '$')
AssertExpect 'x aaa', 1
AssertExpect '- vim-easy-align', 1
normal R
Log getline(1, '$')
AssertExpect 'x aaa', 1
AssertExpect '- vim-easy-align', 0
AssertExpect! '[x]', 1
q
call plug#begin()
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/aaaaaaaaaaaaaa'
Plug 'junegunn/bbbbbbbbbbbbbb'
Plug 'junegunn/cccccccccccccc'
call plug#end()
" Ruby installer
PlugUpdate
normal R
AssertExpect '- vim-easy-align', 0
AssertExpect! '[xxx]', 1
q
" Vim installer
PlugUpdate 1
normal R
AssertExpect '- vim-easy-align', 0
AssertExpect! '[xxx]', 1
q
**********************************************************************
~ Post-update hook (`do` option)
**********************************************************************
Execute (Cleanup):
call plug#begin()
call plug#end()
PlugClean!
Execute (On install):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed' }
Plug 'junegunn/vim-pseudocl'
call plug#end()
PlugInstall
q
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed'),
\ 'vim-easy-align/installed should exist'
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed'),
\ 'vim-pseudocl/installed should not exist'
Execute (On update):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated' }
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' }
call plug#end()
" Reset for updates
call system('cd '.g:plugs['vim-pseudocl'].dir.' && git reset --hard HEAD^')
PlugUpdate
Log getline(1, '$')
q
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated'),
\ 'vim-easy-align/updated should not exist'
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/updated'),
\ 'vim-pseudocl/updated should exist'
Execute (When already installed):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed2' }
Plug 'junegunn/vim-pseudocl', { 'do': 'touch installed2' }
call plug#end()
PlugInstall
q
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
\ 'vim-easy-align/installed2 should not exist'
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed2'),
\ 'vim-pseudocl/installed2 should not exist'
Execute (PlugInstall!):
PlugInstall!
q
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
\ 'vim-easy-align/installed2 should exist'
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/installed2'),
\ 'vim-pseudocl/installed2 should exist'
Execute (When already updated):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated2' }
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated2' }
call plug#end()
PlugUpdate
q
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
\ 'vim-easy-align/updated2 should not exist'
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/updated2'),
\ 'vim-pseudocl/updated2 should not exist'
Execute (PlugUpdate!):
PlugUpdate!
q
Assert filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
\ 'vim-easy-align/updated2 should exist'
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/updated2'),
\ 'vim-pseudocl/updated2 should exist'
Execute (Using Funcref):
function! PlugUpdated(info)
call system('touch '. a:info.name . a:info.status . a:info.force . len(a:info))
endfunction
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': function('PlugUpdated') }
Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
call plug#end()
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
PlugUpdate
Log getline(1, '$')
q
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignupdated03'),
\ 'vim-easy-align/vim-easy-alignupdated03 should exist'
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled03'),
\ 'vim-pseudocl/vim-pseudoclinstalled03 should exist'
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
PlugInstall!
q
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignunchanged13'),
\ 'vim-easy-align/vim-easy-alignunchanged13 should exist'
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled13'),
\ 'vim-pseudocl/vim-pseudoclinstalled13 should exist'
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
PlugUpdate!
q
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignupdated13'),
\ 'vim-easy-align/vim-easy-alignupdated13 should exist'
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclunchanged13'),
\ 'vim-pseudocl/vim-pseudoclunchanged13 should exist'
**********************************************************************
~ Overriding `dir`
**********************************************************************
Execute (Using custom dir):
Assert isdirectory(g:plugs['vim-easy-align'].dir)
call system('rm -rf '.$TMPDIR.'easy-align')
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'dir': $TMPDIR.'easy-align' }
call plug#end()
AssertEqual $TMPDIR.'easy-align/', g:plugs['vim-easy-align'].dir
PlugClean!
Assert !isdirectory(g:plugs['vim-easy-align'].dir)
q
PlugInstall
q
Assert isdirectory(g:plugs['vim-easy-align'].dir)
**********************************************************************
~ On-demand loading load order
**********************************************************************
Before (Clear global vars):
let g:xxx = []
set rtp-=$PWD/xxx/
set rtp-=$PWD/xxx/after
Execute (Immediate loading):
call plug#begin()
Plug '$PWD/xxx'
call plug#end()
" FIXME:
" Different result when Vader is run from commandline with `-c` option
Log g:xxx
if has('vim_starting')
AssertEqual ['/ftdetect', 'after/ftdetect'], g:xxx
else
AssertEqual ['/plugin', 'after/plugin', '/ftdetect', 'after/ftdetect'], g:xxx
endif
Execute (Command-based on-demand loading):
call plug#begin()
Plug '$PWD/xxx', { 'on': 'XXX' }
call plug#end()
AssertEqual [], g:xxx
silent! XXX
AssertEqual ['/ftdetect', 'after/ftdetect', '/plugin', 'after/plugin'], g:xxx
setf xxx
AssertEqual ['/ftdetect', 'after/ftdetect', '/plugin', 'after/plugin', '/ftplugin', 'after/ftplugin', '/indent', 'after/indent', '/syntax', 'after/syntax'], g:xxx
Execute (Filetype-based on-demand loading):
call plug#begin()
Plug '$PWD/xxx', { 'for': 'xxx' }
call plug#end()
AssertEqual ['/ftdetect', 'after/ftdetect'], g:xxx
setf xxx
AssertEqual ['/ftdetect', 'after/ftdetect', '/plugin', 'after/plugin', '/ftplugin', 'after/ftplugin', '/indent', 'after/indent', '/syntax', 'after/syntax'], g:xxx
Before:
**********************************************************************
~ plug#helptags()
**********************************************************************
Execute (plug#helptags):
silent! call delete(expand('$PWD/xxx/doc/tags'))
Assert !filereadable(expand('$PWD/xxx/doc/tags'))
AssertEqual 1, plug#helptags()
Assert filereadable(expand('$PWD/xxx/doc/tags'))
**********************************************************************
~ Manual loading
**********************************************************************
Execute (plug#load - invalid arguments):
AssertEqual 0, plug#load()
AssertEqual 0, plug#load('non-existent-plugin')
AssertEqual 0, plug#load('non-existent-plugin', 'another-non-existent-plugin')
AssertEqual 1, plug#load('xxx')
AssertEqual 0, plug#load('xxx', 'non-existent-plugin')
AssertEqual 0, plug#load('non-existent-plugin', 'xxx')
Execute (on: []):
call plug#begin()
Plug 'junegunn/rust.vim', { 'on': [] }
call plug#end()
PlugInstall
q
Execute (PlugStatus reports (not loaded)):
PlugStatus
AssertExpect 'not loaded', 1
q
Execute (plug#load to load it):
tabnew test.rs
" Vader will switch tab to [Vader-workbench] after Log
" Log &filetype
AssertEqual 1, plug#load('rust.vim')
AssertEqual 'rust', &filetype
q
Execute (PlugStatus should not contain (not loaded)):
PlugStatus
AssertExpect 'not loaded', 0
q
Execute (Load plugin from PlugStatus screen with L key in normal mode):
call plug#begin()
Plug '$PWD/yyy', { 'on': [] }
call plug#end()
PlugStatus
AssertExpect 'not loaded', 1
Assert !exists('g:yyy'), 'yyy not loaded'
/not loaded
normal L
AssertExpect 'not loaded', 0
Assert exists('g:yyy'), 'yyy loaded'
q
Execute (Load plugin from PlugStatus screen with L key in visual mode):
call plug#begin()
Plug '$PWD/z1', { 'on': [] }
Plug '$PWD/z2', { 'for': [] }
call plug#end()
PlugStatus
AssertExpect 'not loaded', 2
Assert !exists('g:z1'), 'z1 not loaded'
Assert !exists('g:z2'), 'z2 not loaded'
normal ggVGL
AssertExpect 'not loaded', 0
Assert exists('g:z1'), 'z1 loaded'
Assert exists('g:z2'), 'z2 loaded'
q
Execute (Cleanup):
call system('rm -rf '.temp_plugged)
unlet g:plugs
unlet g:plug_home
unlet g:vimrc_reloaded
unlet temp_plugged vader plug basertp save_rtp
silent! call system('rm -rf '.temp_plugged)
silent! call rename('fzf', 'fzf-staged')
silent! unlet g:plugs
silent! unlet g:plug_home
silent! unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out
silent! delf PlugStatusSorted
silent! delf AssertExpect
silent! delf PlugUpdated
silent! delc AssertExpect
silent! unmap /
silent! unmap ?
Restore
source $MYVIMRC