mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-08 18:04:46 +08:00
Compare commits
93 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9b70554e3 | ||
|
|
3c6ac68947 | ||
|
|
51dc024b2e | ||
|
|
30a2c5cc14 | ||
|
|
a34b745a21 | ||
|
|
c759170ce2 | ||
|
|
44410a32e3 | ||
|
|
5698a055c3 | ||
|
|
59748b0680 | ||
|
|
95aa96a884 | ||
|
|
bb48508c3e | ||
|
|
8a525f165c | ||
|
|
e362fd5931 | ||
|
|
74169f3761 | ||
|
|
7e4191baaf | ||
|
|
753f7be798 | ||
|
|
c74fae9f8e | ||
|
|
fc200da975 | ||
|
|
77f58a3793 | ||
|
|
308fb9bc94 | ||
|
|
4a96db8971 | ||
|
|
925ec7b325 | ||
|
|
7fec10e088 | ||
|
|
54fc8a4fc7 | ||
|
|
9c1cca32f0 | ||
|
|
f6be60a9a5 | ||
|
|
e81e761d43 | ||
|
|
fb84e6b11c | ||
|
|
ef784c17b1 | ||
|
|
7aeff0ef0d | ||
|
|
773b3cadd0 | ||
|
|
71542dd896 | ||
|
|
f825e4ef6e | ||
|
|
6e7509e2ef | ||
|
|
619e42a182 | ||
|
|
48e8000b6a | ||
|
|
79da5b2654 | ||
|
|
61f010ffad | ||
|
|
4539bb8fb3 | ||
|
|
7d40f592af | ||
|
|
1c61517164 | ||
|
|
061b326b37 | ||
|
|
166426718e | ||
|
|
b440603fa9 | ||
|
|
04fc8f9aba | ||
|
|
ebe8635043 | ||
|
|
334e820c4e | ||
|
|
0e9fa672f8 | ||
|
|
fdf1e53da5 | ||
|
|
470139cd86 | ||
|
|
e8cd357060 | ||
|
|
3606c294de | ||
|
|
06f903d8af | ||
|
|
1f704deb76 | ||
|
|
3ebf6361bf | ||
|
|
9b99c1f885 | ||
|
|
53cc8a53d9 | ||
|
|
2ee153d610 | ||
|
|
7019171737 | ||
|
|
044c3a67c4 | ||
|
|
48514768c2 | ||
|
|
68ad02c5c3 | ||
|
|
12bc2ea1da | ||
|
|
ade7fb95b1 | ||
|
|
9c55223869 | ||
|
|
495becf442 | ||
|
|
425ef39db2 | ||
|
|
bd2cb9d2de | ||
|
|
0263370bd1 | ||
|
|
4b3fbd1592 | ||
|
|
396a534a0a | ||
|
|
a45c3834f8 | ||
|
|
a5c3952380 | ||
|
|
60bda7322f | ||
|
|
05008e7a82 | ||
|
|
2889cb4739 | ||
|
|
61b21068ee | ||
|
|
15da7eb78a | ||
|
|
385a1eb350 | ||
|
|
8c915a5271 | ||
|
|
ee9f0e55b8 | ||
|
|
018adb2aef | ||
|
|
da47e6ee56 | ||
|
|
662274e617 | ||
|
|
4eeff535fa | ||
|
|
c3669836d3 | ||
|
|
eb38fe3d32 | ||
|
|
e7704e6cb3 | ||
|
|
e1e04cabd5 | ||
|
|
afc20ecff3 | ||
|
|
38510a8788 | ||
|
|
a34b06dd54 | ||
|
|
5d910fc9ea |
29
.travis.yml
29
.travis.yml
@@ -1,15 +1,32 @@
|
|||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 1.8.7
|
- 1.8.7
|
||||||
|
- 1.9.2 # Test with vim-nox package on ubuntu
|
||||||
|
- 1.9.3 # Test against python installer
|
||||||
- 2.0.0
|
- 2.0.0
|
||||||
|
|
||||||
before_script: |
|
before_script: |
|
||||||
hg clone https://code.google.com/p/vim/
|
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.2 ]; then
|
||||||
cd vim
|
sudo apt-get update -y
|
||||||
./configure --with-features=huge --enable-rubyinterp
|
sudo apt-get install -y vim-nox
|
||||||
make
|
sudo ln -s /usr/bin/vim /usr/local/bin/vim
|
||||||
sudo make install
|
else
|
||||||
cd -
|
hg clone https://code.google.com/p/vim/
|
||||||
|
cd vim
|
||||||
|
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.3 ]; then
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y python2.7-dev
|
||||||
|
./configure --with-features=huge --enable-pythoninterp
|
||||||
|
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.name "Your Name"
|
||||||
|
|
||||||
script: |
|
script: |
|
||||||
test/run !
|
test/run !
|
||||||
|
|||||||
58
README.md
58
README.md
@@ -1,31 +1,35 @@
|
|||||||

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

|
<img src="https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif" height="450">
|
||||||
|
|
||||||
### Pros.
|
### Pros.
|
||||||
|
|
||||||
- Easier to setup: Single file. No boilerplate code required.
|
- Easier to setup: Single file. No boilerplate code required.
|
||||||
- Easier to use: Concise, intuitive syntax
|
- Easier to use: Concise, intuitive syntax
|
||||||
- [Super-fast](https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif)
|
- [Super-fast][40/4] parallel installation/update
|
||||||
parallel installation/update (requires
|
(with [+python][py] or [+ruby][rb] or [Neovim][nv])
|
||||||
[+ruby](https://github.com/junegunn/vim-plug/wiki/ruby))
|
- On-demand loading for [faster startup time][startup-time]
|
||||||
- On-demand loading to achieve
|
- Can review and rollback updates
|
||||||
[fast startup time](http://junegunn.kr/images/vim-startup-time.png)
|
- Branch/tag support
|
||||||
- Post-update hooks
|
- Post-update hooks
|
||||||
- Can choose a specific branch or tag for each plugin
|
|
||||||
- Support for externally managed plugins
|
- Support for externally managed plugins
|
||||||
|
|
||||||
|
[40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
|
||||||
|
[py]: https://github.com/junegunn/vim-plug/wiki/python
|
||||||
|
[rb]: https://github.com/junegunn/vim-plug/wiki/ruby
|
||||||
|
[nv]: http://neovim.org/
|
||||||
|
[startup-time]: http://junegunn.kr/images/vim-startup-time.png
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
[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 ~/.vim/autoload
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir -p ~/.vim/autoload
|
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||||
curl -fLo ~/.vim/autoload/plug.vim \
|
|
||||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -69,28 +73,29 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
|||||||
| `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` | See the updated changes from the previous PlugUpdate |
|
||||||
|
| `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` | Branch or tag of the repository to use |
|
||||||
| `rtp` | Subdirectory that contains Vim plugin |
|
| `rtp` | Subdirectory that contains Vim plugin |
|
||||||
| `dir` | Custom directory for the plugin |
|
| `dir` | Custom directory for the plugin |
|
||||||
| `do` | Post-update hook (string or funcref) |
|
| `do` | Post-update hook (string or funcref) |
|
||||||
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
||||||
| `for` | On-demand loading: File types |
|
| `for` | On-demand loading: File types |
|
||||||
| `frozen` | Do not install/update plugin unless explicitly given as the argument |
|
| `frozen` | Do not update unless explicitly specified |
|
||||||
|
|
||||||
### Global options
|
### Global options
|
||||||
|
|
||||||
| Flag | Default | Description |
|
| Flag | Default | Description |
|
||||||
| ------------------- | --------------------------------- | ------------------------------------ |
|
| ------------------- | --------------------------------- | ------------------------------------------------------ |
|
||||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||||
| `g:plug_timeout` | 60 | Time limit of each task in seconds |
|
| `g:plug_timeout` | 60 | Time limit of each task in seconds (*Ruby & Python*) |
|
||||||
| `g:plug_retries` | 2 | Number of retries in case of timeout |
|
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
|
||||||
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
|
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
|
||||||
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL |
|
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL |
|
||||||
|
|
||||||
### Keybindings
|
### Keybindings
|
||||||
|
|
||||||
@@ -141,6 +146,7 @@ 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.
|
In that case, use `do` option to describe the task to be performed.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
|
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
|
||||||
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' }
|
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
5
test/fixtures/.gitignore
vendored
Normal file
5
test/fixtures/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
fzf*
|
||||||
|
xxx
|
||||||
|
yyy
|
||||||
|
z1
|
||||||
|
z2
|
||||||
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
Normal file
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
echomsg 'ftplugin'
|
||||||
242
test/regressions.vader
Normal file
242
test/regressions.vader
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
**********************************************************************
|
||||||
|
Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
||||||
|
call plug#begin('$PLUG_FIXTURES')
|
||||||
|
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
redir => out
|
||||||
|
tabnew a.c
|
||||||
|
redir END
|
||||||
|
Assert stridx(out, 'ftplugin') >= 0
|
||||||
|
|
||||||
|
* The same applies to plug#load())
|
||||||
|
redir => out
|
||||||
|
call plug#load('ftplugin-msg')
|
||||||
|
redir END
|
||||||
|
Assert stridx(out, 'ftplugin') >= 0
|
||||||
|
q
|
||||||
|
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#114 Should not contain empty path in &rtp):
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
Log &rtp
|
||||||
|
Assert &rtp !~ ',,', 'Commas'
|
||||||
|
Assert &rtp !~ '^,', 'Comma prefix'
|
||||||
|
Assert &rtp !~ ',$', 'Comma suffix'
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||||
|
augroup PlugLOD
|
||||||
|
autocmd!
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" Cleared on command
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
|
||||||
|
call plug#end()
|
||||||
|
PlugInstall | q
|
||||||
|
|
||||||
|
Assert exists(':EmojiCommand'), 'EmojiCommand not defined'
|
||||||
|
Assert exists(':EmojiCommand2'), 'EmojiCommand2 not defined'
|
||||||
|
Assert !empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) not defined'
|
||||||
|
|
||||||
|
silent! EmojiCommand
|
||||||
|
|
||||||
|
Assert !exists(':EmojiCommand'), 'EmojiCommand defined'
|
||||||
|
Assert !exists(':EmojiCommand2'), 'EmojiCommand2 defined'
|
||||||
|
Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
|
||||||
|
|
||||||
|
" Cleared on FileType
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
Assert exists(':EmojiCommandExtra'), 'EmojiCommandExtra not defined'
|
||||||
|
Assert !empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) not defined'
|
||||||
|
|
||||||
|
setf emoji
|
||||||
|
|
||||||
|
Assert !exists(':EmojiCommandExtra'), 'EmojiCommandExtra defined'
|
||||||
|
Assert empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) defined'
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#131 Syntax error):
|
||||||
|
call plug#begin('/no-permission')
|
||||||
|
Plug 'junegunn/vim-emoji'
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
redir => out
|
||||||
|
silent PlugInstall
|
||||||
|
redir END
|
||||||
|
Assert out =~ 'Invalid plug directory: /no-permission'
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#139-1 Using new remote branch):
|
||||||
|
" Make sure to remove the clone
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
call plug#end()
|
||||||
|
PlugClean!
|
||||||
|
|
||||||
|
" Install master branch
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
Plug expand('file:///$TMPDIR/new-branch')
|
||||||
|
call plug#end()
|
||||||
|
PlugUpdate
|
||||||
|
|
||||||
|
unlet! g:foo g:bar g:baz
|
||||||
|
call plug#load('new-branch')
|
||||||
|
Assert exists('g:foo'), 'g:foo should be found'
|
||||||
|
Assert !exists('g:bar'), 'g:bar should not be found'
|
||||||
|
Assert !exists('g:baz'), 'g:baz should not be found'
|
||||||
|
|
||||||
|
" Create a new branch on origin
|
||||||
|
call system('cd $TMPDIR/new-branch && git checkout -b new &&'
|
||||||
|
\. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
|
||||||
|
\. 'git commit -m second')
|
||||||
|
|
||||||
|
" We're setting up two plugins so that parallel installer is used
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
Plug 'junegunn/seoul256.vim'
|
||||||
|
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'new' }
|
||||||
|
call plug#end()
|
||||||
|
PlugUpdate
|
||||||
|
silent %y
|
||||||
|
Log @"
|
||||||
|
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
|
||||||
|
|
||||||
|
unlet! g:foo g:bar g:baz
|
||||||
|
call plug#load('new-branch')
|
||||||
|
Assert exists('g:foo'), 'g:foo should be found'
|
||||||
|
Assert exists('g:bar'), 'g:bar should be found'
|
||||||
|
Assert !exists('g:baz'), 'g:baz should not be found'
|
||||||
|
|
||||||
|
call PlugStatusSorted()
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
- new-branch: OK
|
||||||
|
- seoul256.vim: OK
|
||||||
|
Finished. 0 error(s).
|
||||||
|
[==]
|
||||||
|
|
||||||
|
Execute (#139-2 Using yet another new remote branch):
|
||||||
|
" Create another branch on origin
|
||||||
|
call system('cd $TMPDIR/new-branch && git checkout master &&'
|
||||||
|
\. 'git checkout -b brand-new &&'
|
||||||
|
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
|
||||||
|
\. 'git commit -m third')
|
||||||
|
|
||||||
|
" Test Vim installer here
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'brand-new' }
|
||||||
|
call plug#end()
|
||||||
|
PlugUpdate
|
||||||
|
silent %y
|
||||||
|
Log @"
|
||||||
|
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
|
||||||
|
|
||||||
|
unlet! g:foo g:bar g:baz
|
||||||
|
call plug#load('new-branch')
|
||||||
|
Assert exists('g:foo'), 'g:foo should be found'
|
||||||
|
Assert !exists('g:bar'), 'g:bar should not be found'
|
||||||
|
Assert exists('g:baz'), 'g:baz should be found'
|
||||||
|
|
||||||
|
call PlugStatusSorted()
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
- new-branch: OK
|
||||||
|
Finished. 0 error(s).
|
||||||
|
[=]
|
||||||
|
|
||||||
|
Execute (#139-3 Should fail when not possible to fast-forward):
|
||||||
|
" Commit on cloned repo
|
||||||
|
call system('cd $TMPDIR/plugged/new-branch && git checkout master &&'
|
||||||
|
\. 'touch foobar && git add foobar && git commit -m foobar')
|
||||||
|
|
||||||
|
" Different commit on remote
|
||||||
|
call system('cd $TMPDIR/new-branch && git checkout master &&'
|
||||||
|
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
|
||||||
|
|
||||||
|
for multi in [0, 1]
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
if multi
|
||||||
|
Plug 'junegunn/seoul256.vim'
|
||||||
|
endif
|
||||||
|
Plug expand('file:///$TMPDIR/new-branch')
|
||||||
|
call plug#end()
|
||||||
|
PlugUpdate
|
||||||
|
silent %y
|
||||||
|
Assert @" =~ 'Not possible to fast-forward', @"
|
||||||
|
endfor
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#145: Merging on-demand loading triggers - cmd):
|
||||||
|
unlet! g:xxx g:yyy
|
||||||
|
call plug#begin()
|
||||||
|
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
|
||||||
|
Plug '$PLUG_FIXTURES/yyy', { 'on': ['XXX', 'YYY'] }
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
silent! XXX
|
||||||
|
|
||||||
|
Assert exists('g:xxx'), 'xxx is not loaded'
|
||||||
|
Assert exists('g:yyy'), 'yyy is not loaded'
|
||||||
|
Assert !exists(':YYY')
|
||||||
|
|
||||||
|
Execute (#145: Merging on-demand loading triggers - map):
|
||||||
|
unlet! g:xxx g:yyy
|
||||||
|
|
||||||
|
call plug#begin()
|
||||||
|
Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
|
||||||
|
Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
Assert !empty(mapcheck("<Plug>(xxx)"))
|
||||||
|
Assert !empty(mapcheck("<Plug>(yyy)"))
|
||||||
|
|
||||||
|
# FIXME feedkeys() cannot be tested with Vader
|
||||||
|
call plug#load('xxx', 'yyy')
|
||||||
|
Assert empty(mapcheck("<Plug>(xxx)"))
|
||||||
|
Assert empty(mapcheck("<Plug>(yyy)"))
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#159: shell=/bin/tcsh):
|
||||||
|
let org = &shell
|
||||||
|
try
|
||||||
|
set shell=/bin/tcsh
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
Plug 'junegunn/seoul256.vim'
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
PlugStatus
|
||||||
|
Log getline(1, '$')
|
||||||
|
q
|
||||||
|
AssertEqual '/bin/tcsh', &shell
|
||||||
|
finally
|
||||||
|
let &shell = org
|
||||||
|
endtry
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#154: Spaces in &rtp should not be escaped):
|
||||||
|
call plug#begin('$TMPDIR/plug it')
|
||||||
|
Plug 'seoul256 vim'
|
||||||
|
call plug#end()
|
||||||
|
Log &rtp
|
||||||
|
Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (#184: Duplicate entries in &rtp):
|
||||||
|
call plug#begin('$TMPDIR/plugged')
|
||||||
|
Plug 'plugin1'
|
||||||
|
\| Plug 'plugin0'
|
||||||
|
|
||||||
|
Plug 'plugin2'
|
||||||
|
\| Plug 'plugin0'
|
||||||
|
\| Plug 'plugin1'
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
Log &rtp
|
||||||
|
AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0'))
|
||||||
|
|
||||||
77
test/run
77
test/run
@@ -5,18 +5,35 @@ cd ..
|
|||||||
PLUG_SRC=$(pwd)/plug.vim
|
PLUG_SRC=$(pwd)/plug.vim
|
||||||
cd - > /dev/null
|
cd - > /dev/null
|
||||||
|
|
||||||
if [ ! -d vader.vim ]; then
|
export PLUG_FIXTURES=$(pwd)/fixtures
|
||||||
git clone https://github.com/junegunn/vader.vim.git
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf fzf
|
clone() {
|
||||||
if [ ! -d fzf-staged ]; then
|
if [ ! -d $2 ]; then
|
||||||
git clone https://github.com/junegunn/fzf.git fzf-staged
|
git clone $1 $2
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Clone
|
||||||
|
cd /tmp
|
||||||
|
mkdir -p junegunn vim-scripts jg
|
||||||
|
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
|
||||||
|
vim-oblique vim-pseudocl vim-redis vim-emoji; do
|
||||||
|
clone https://github.com/junegunn/${repo}.git junegunn/$repo &
|
||||||
|
done
|
||||||
|
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
|
||||||
|
|
||||||
|
rm -rf $PLUG_FIXTURES/fzf
|
||||||
|
clone https://github.com/junegunn/fzf.git $PLUG_FIXTURES/fzf-staged &
|
||||||
|
wait
|
||||||
|
|
||||||
|
(cd junegunn/seoul256.vim &&
|
||||||
|
git checkout no-t_co && git checkout master) > /dev/null 2>&1
|
||||||
|
clone junegunn/vim-emoji jg/vim-emoji
|
||||||
|
cd - > /dev/null
|
||||||
|
|
||||||
make_dirs() {
|
make_dirs() {
|
||||||
mkdir -p "$1"
|
mkdir -p "$PLUG_FIXTURES/$1"
|
||||||
cd "$1"
|
cd "$PLUG_FIXTURES/$1"
|
||||||
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
||||||
for d in *; do
|
for d in *; do
|
||||||
[ -d $d ] || continue
|
[ -d $d ] || continue
|
||||||
@@ -32,29 +49,47 @@ EOF
|
|||||||
cd - > /dev/null
|
cd - > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
make_dirs xxx/ xxx
|
init() {
|
||||||
make_dirs xxx/after xxx
|
rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2}
|
||||||
mkdir -p xxx/doc
|
rm -rf $TMPDIR/new-branch
|
||||||
cat > xxx/doc/xxx.txt << DOC
|
|
||||||
|
make_dirs xxx/ xxx
|
||||||
|
make_dirs xxx/after xxx
|
||||||
|
mkdir -p $PLUG_FIXTURES/xxx/doc
|
||||||
|
cat > $PLUG_FIXTURES/xxx/doc/xxx.txt << DOC
|
||||||
hello *xxx*
|
hello *xxx*
|
||||||
DOC
|
DOC
|
||||||
|
|
||||||
make_dirs yyy/ yyy
|
make_dirs yyy/ yyy
|
||||||
make_dirs yyy/after yyy
|
make_dirs yyy/after yyy
|
||||||
|
|
||||||
make_dirs z1/ z1
|
make_dirs z1/ z1
|
||||||
make_dirs z2/ z2
|
make_dirs z2/ z2
|
||||||
|
|
||||||
|
(
|
||||||
|
cd $TMPDIR
|
||||||
|
git init new-branch
|
||||||
|
cd new-branch
|
||||||
|
mkdir plugin
|
||||||
|
echo 'let g:foo = 1' > plugin/foo.vim
|
||||||
|
git add plugin/foo.vim
|
||||||
|
git commit -m initial
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
cat > /tmp/mini-vimrc << VIMRC
|
cat > /tmp/mini-vimrc << VIMRC
|
||||||
set rtp+=vader.vim
|
set rtp+=/tmp/junegunn/vader.vim
|
||||||
set shell=/bin/bash
|
set shell=/bin/bash
|
||||||
source $PLUG_SRC
|
source $PLUG_SRC
|
||||||
VIMRC
|
VIMRC
|
||||||
|
|
||||||
|
[ -z "$TMPDIR" ] && export TMPDIR=/tmp/
|
||||||
|
init
|
||||||
if [ "$1" = '!' ]; then
|
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 'Vader! test.vader' > /dev/null &&
|
||||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! workflow.vader' > /dev/null
|
init &&
|
||||||
|
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||||
else
|
else
|
||||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
|
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader test.vader'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
72
test/test.vader
Normal file
72
test/test.vader
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
Execute (Initialize test environment):
|
||||||
|
Save &rtp, g:plugs, g:plug_home, g:plug_window
|
||||||
|
|
||||||
|
let first_rtp = split(&rtp, ',')[0]
|
||||||
|
let last_rtp = split(&rtp, ',')[-1]
|
||||||
|
|
||||||
|
let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h')
|
||||||
|
let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h')
|
||||||
|
set rtp=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
|
||||||
|
execute 'set rtp^='.vader
|
||||||
|
execute 'set rtp^='.plug
|
||||||
|
let basertp = &rtp
|
||||||
|
|
||||||
|
unlet! g:plugs g:plug_home g:plug_window
|
||||||
|
let g:plug_url_format = 'file:///tmp/%s'
|
||||||
|
|
||||||
|
set t_Co=256
|
||||||
|
colo default
|
||||||
|
pclose
|
||||||
|
|
||||||
|
function! PlugStatusSorted()
|
||||||
|
PlugStatus
|
||||||
|
%y
|
||||||
|
q
|
||||||
|
normal! P
|
||||||
|
%sort
|
||||||
|
g/^$/d
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! AssertExpect(bang, pat, cnt)
|
||||||
|
let op = a:bang ? '==#' : '=~#'
|
||||||
|
AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
|
||||||
|
endfunction
|
||||||
|
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
|
||||||
|
|
||||||
|
function! EnsureLoaded()
|
||||||
|
if has('vim_starting')
|
||||||
|
runtime! plugin/**/*.vim
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
Execute (Print Interpreter Version):
|
||||||
|
redir => out
|
||||||
|
if has('ruby')
|
||||||
|
silent ruby puts 'Ruby: ' + RUBY_VERSION
|
||||||
|
elseif has('python')
|
||||||
|
silent python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2])
|
||||||
|
endif
|
||||||
|
redir END
|
||||||
|
Log substitute(out, '\n', '', 'g')
|
||||||
|
|
||||||
|
Include: workflow.vader
|
||||||
|
Include: regressions.vader
|
||||||
|
|
||||||
|
Execute (Cleanup):
|
||||||
|
silent! call system('rm -rf '.temp_plugged)
|
||||||
|
silent! call system('rm -rf '.temp_plugged)
|
||||||
|
silent! call rename(fzf, expand('$PLUG_FIXTURES/fzf-staged'))
|
||||||
|
silent! unlet g:plugs
|
||||||
|
silent! unlet g:plug_home
|
||||||
|
silent! unlet g:plug_url_format
|
||||||
|
silent! unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out tabnr found len
|
||||||
|
silent! delf PlugStatusSorted
|
||||||
|
silent! delf AssertExpect
|
||||||
|
silent! delf PlugUpdated
|
||||||
|
silent! delf EnsureLoaded
|
||||||
|
silent! delc AssertExpect
|
||||||
|
silent! unmap /
|
||||||
|
silent! unmap ?
|
||||||
|
|
||||||
|
Restore
|
||||||
|
|
||||||
@@ -1,52 +1,6 @@
|
|||||||
Execute (Initialize test environment):
|
|
||||||
Save &rtp, g:plugs, g:plug_home, g:plug_window
|
|
||||||
|
|
||||||
let first_rtp = split(&rtp, ',')[0]
|
|
||||||
let last_rtp = split(&rtp, ',')[-1]
|
|
||||||
|
|
||||||
let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h')
|
|
||||||
let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h')
|
|
||||||
set rtp=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
|
|
||||||
execute 'set rtp^='.vader
|
|
||||||
execute 'set rtp^='.plug
|
|
||||||
let basertp = &rtp
|
|
||||||
|
|
||||||
unlet! g:plugs g:plug_home g:plug_window
|
|
||||||
|
|
||||||
set t_Co=256
|
|
||||||
colo default
|
|
||||||
pclose
|
|
||||||
|
|
||||||
function! PlugStatusSorted()
|
|
||||||
PlugStatus
|
|
||||||
%y
|
|
||||||
q
|
|
||||||
normal! P
|
|
||||||
%sort
|
|
||||||
g/^$/d
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! AssertExpect(bang, pat, cnt)
|
|
||||||
let op = a:bang ? '==#' : '=~#'
|
|
||||||
AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
|
|
||||||
endfunction
|
|
||||||
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
|
|
||||||
|
|
||||||
function! EnsureLoaded()
|
|
||||||
if has('vim_starting')
|
|
||||||
runtime! plugin/**/*.vim
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
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):
|
Execute (plug#end() before plug#begin() should fail):
|
||||||
redir => out
|
redir => out
|
||||||
AssertEqual 0, plug#end()
|
silent! AssertEqual 0, plug#end()
|
||||||
redir END
|
redir END
|
||||||
Assert stridx(out, 'Call plug#begin() first') >= 0
|
Assert stridx(out, 'Call plug#begin() first') >= 0
|
||||||
|
|
||||||
@@ -78,33 +32,33 @@ Execute (Subsequent plug#begin() calls will reuse g:plug_home):
|
|||||||
AssertEqual temp_plugged, g:plug_home
|
AssertEqual temp_plugged, g:plug_home
|
||||||
|
|
||||||
Execute (Test Plug command):
|
Execute (Test Plug command):
|
||||||
" Git repo with branch
|
^ Git repo with branch (DEPRECATED. USE BRANCH OPTION)
|
||||||
Plug 'junegunn/seoul256.vim', 'yes-t_co'
|
Plug 'junegunn/seoul256.vim', { 'branch': 'yes-t_co' }
|
||||||
AssertEqual 'https://git::@github.com/junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
|
AssertEqual 'file:///tmp/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
|
||||||
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||||
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
|
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
|
||||||
|
|
||||||
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
|
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
|
||||||
AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
|
AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
|
||||||
|
|
||||||
" Git repo with tag
|
^ Git repo with tag (DEPRECATED. USE TAG OPTION)
|
||||||
Plug 'junegunn/goyo.vim', '1.5.2'
|
Plug 'junegunn/goyo.vim', '1.5.2'
|
||||||
AssertEqual 'https://git::@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
|
AssertEqual 'file:///tmp/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
|
||||||
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
|
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
|
||||||
AssertEqual '1.5.2', g:plugs['goyo.vim'].branch
|
AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
|
||||||
|
|
||||||
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
|
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
|
||||||
AssertEqual '1.5.3', g:plugs['goyo.vim'].branch
|
AssertEqual '1.5.3', g:plugs['goyo.vim'].tag
|
||||||
|
|
||||||
" Git URI
|
" Git URI
|
||||||
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
|
Plug 'file:///tmp/jg/vim-emoji'
|
||||||
AssertEqual 'https://bitbucket.org/junegunn/vim-emoji.git', g:plugs['vim-emoji'].uri
|
AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri
|
||||||
AssertEqual 'master', g:plugs['vim-emoji'].branch
|
AssertEqual 'master', g:plugs['vim-emoji'].branch
|
||||||
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
|
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
|
||||||
|
|
||||||
" vim-scripts/
|
" vim-scripts/
|
||||||
Plug 'beauty256'
|
Plug 'beauty256'
|
||||||
AssertEqual 'https://git::@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
|
AssertEqual 'file:///tmp/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)
|
||||||
@@ -155,7 +109,27 @@ Execute (PlugStatus after installation):
|
|||||||
AssertExpect 'OK', 4
|
AssertExpect 'OK', 4
|
||||||
q
|
q
|
||||||
|
|
||||||
|
Execute (PlugUpdate - tagged plugin should not fail (#174)):
|
||||||
|
PlugUpdate goyo.vim
|
||||||
|
Log getline(1, '$')
|
||||||
|
AssertExpect '^- goyo.vim', 1
|
||||||
|
q
|
||||||
|
|
||||||
Execute (Change tag of goyo.vim):
|
Execute (Change tag of goyo.vim):
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/goyo.vim', { 'tag': '9.9.9' }
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
Execute (PlugStatus):
|
||||||
|
call PlugStatusSorted()
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
Invalid tag: 1.5.3 (expected: 9.9.9). Try PlugUpdate.
|
||||||
|
Finished. 1 error(s).
|
||||||
|
[=]
|
||||||
|
x goyo.vim:
|
||||||
|
|
||||||
|
Execute (Remove tag of goyo.vim):
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug 'junegunn/goyo.vim'
|
Plug 'junegunn/goyo.vim'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
@@ -164,7 +138,7 @@ Execute (PlugStatus):
|
|||||||
call PlugStatusSorted()
|
call PlugStatusSorted()
|
||||||
|
|
||||||
Expect:
|
Expect:
|
||||||
Invalid branch/tag: 1.5.3 (expected: master). Try PlugUpdate.
|
Invalid branch: HEAD (expected: master). Try PlugUpdate.
|
||||||
Finished. 1 error(s).
|
Finished. 1 error(s).
|
||||||
[=]
|
[=]
|
||||||
x goyo.vim:
|
x goyo.vim:
|
||||||
@@ -181,31 +155,53 @@ 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 'https://bitbucket.org/junegunn/vim-emoji.git'
|
Plug 'file:///tmp/jg/vim-emoji'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
Execute (PlugStatus):
|
Execute (PlugStatus):
|
||||||
call PlugStatusSorted()
|
call PlugStatusSorted()
|
||||||
|
|
||||||
Expect:
|
Expect:
|
||||||
Invalid branch/tag: no-t_co (expected: master). Try PlugUpdate.
|
Invalid branch: no-t_co (expected: master). Try PlugUpdate.
|
||||||
- vim-emoji: OK
|
- vim-emoji: OK
|
||||||
Finished. 1 error(s).
|
Finished. 1 error(s).
|
||||||
[==]
|
[==]
|
||||||
x seoul256.vim:
|
x seoul256.vim:
|
||||||
|
|
||||||
|
Execute (PlugUpdate to switch branch, then PlugStatus):
|
||||||
|
PlugUpdate
|
||||||
|
call PlugStatusSorted()
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
- seoul256.vim: OK
|
||||||
|
- vim-emoji: OK
|
||||||
|
Finished. 0 error(s).
|
||||||
|
[==]
|
||||||
|
|
||||||
|
Execute (Change tag of seoul256.vim):
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/seoul256.vim', { 'tag': 'no-such-tag' }
|
||||||
|
call plug#end()
|
||||||
|
call PlugStatusSorted()
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
Invalid tag: N/A (expected: no-such-tag). Try PlugUpdate.
|
||||||
|
Finished. 1 error(s).
|
||||||
|
[=]
|
||||||
|
x seoul256.vim:
|
||||||
|
|
||||||
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 'https://bitbucket.org/junegunn/vim-emoji.git'
|
Plug 'file:///tmp/jg/vim-emoji'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
Execute (PlugStatus):
|
Execute (PlugStatus):
|
||||||
call PlugStatusSorted()
|
call PlugStatusSorted()
|
||||||
|
|
||||||
Expect:
|
Expect:
|
||||||
Expected: https://git::@github.com/junegunn.choi/seoul256.vim.git
|
Expected: file:///tmp/junegunn.choi/seoul256.vim
|
||||||
Invalid URI: https://git::@github.com/junegunn/seoul256.vim.git
|
Invalid URI: file:///tmp/junegunn/seoul256.vim
|
||||||
PlugClean required.
|
PlugClean required.
|
||||||
- vim-emoji: OK
|
- vim-emoji: OK
|
||||||
Finished. 1 error(s).
|
Finished. 1 error(s).
|
||||||
@@ -238,8 +234,8 @@ Execute (PlugStatus):
|
|||||||
call PlugStatusSorted()
|
call PlugStatusSorted()
|
||||||
|
|
||||||
Expect:
|
Expect:
|
||||||
Expected: https://git::@github.com/junegunn/vim-emoji.git
|
Expected: file:///tmp/junegunn/vim-emoji
|
||||||
Invalid URI: https://bitbucket.org/junegunn/vim-emoji.git
|
Invalid URI: file:///tmp/jg/vim-emoji
|
||||||
Not found. Try PlugInstall.
|
Not found. Try PlugInstall.
|
||||||
PlugClean required.
|
PlugClean required.
|
||||||
Finished. 2 error(s).
|
Finished. 2 error(s).
|
||||||
@@ -304,7 +300,8 @@ Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
|
|||||||
|
|
||||||
" ]] motion
|
" ]] motion
|
||||||
execute 'normal $]]'
|
execute 'normal $]]'
|
||||||
AssertEqual lnum + 4, line('.')
|
Assert line('.') >= 4
|
||||||
|
" 5+ for merge commit
|
||||||
AssertEqual 3, col('.')
|
AssertEqual 3, col('.')
|
||||||
|
|
||||||
" [[ motion
|
" [[ motion
|
||||||
@@ -337,7 +334,8 @@ Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
|
|||||||
AssertEqual 1, &previewwindow
|
AssertEqual 1, &previewwindow
|
||||||
pclose
|
pclose
|
||||||
|
|
||||||
Execute (Plug window in a new tab):
|
Execute (Reuse Plug window in another tab):
|
||||||
|
let tabnr = tabpagenr()
|
||||||
PlugDiff
|
PlugDiff
|
||||||
tab new new-tab
|
tab new new-tab
|
||||||
set buftype=nofile
|
set buftype=nofile
|
||||||
@@ -345,8 +343,8 @@ Execute (Plug window in a new tab):
|
|||||||
normal D
|
normal D
|
||||||
AssertExpect '^- ', 1
|
AssertExpect '^- ', 1
|
||||||
normal q
|
normal q
|
||||||
AssertEqual 'new-tab', expand('%')
|
AssertEqual tabnr, tabpagenr()
|
||||||
q
|
normal! gt
|
||||||
q
|
q
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
@@ -420,7 +418,7 @@ Execute (On-demand loading based on filetypes):
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
|
||||||
Execute (Add unmanaged plugin):
|
Execute (Add unmanaged plugin):
|
||||||
let fzf = fnamemodify(g:vader_file, ':h') . '/fzf'
|
let fzf = expand('$PLUG_FIXTURES/fzf')
|
||||||
Log fzf
|
Log fzf
|
||||||
|
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
@@ -450,6 +448,7 @@ Execute (Plug block for following tests):
|
|||||||
call plug#end()
|
call plug#end()
|
||||||
" Remove plugins from previous tests
|
" Remove plugins from previous tests
|
||||||
PlugClean!
|
PlugClean!
|
||||||
|
q
|
||||||
|
|
||||||
Execute (PlugInstall will only install vim-easy-align):
|
Execute (PlugInstall will only install vim-easy-align):
|
||||||
PlugInstall
|
PlugInstall
|
||||||
@@ -478,7 +477,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 rename('fzf-staged', 'fzf')
|
call rename(expand('$PLUG_FIXTURES/fzf-staged'), fzf)
|
||||||
|
|
||||||
Execute (PlugUpdate still should not care):
|
Execute (PlugUpdate still should not care):
|
||||||
PlugUpdate
|
PlugUpdate
|
||||||
@@ -516,12 +515,37 @@ Execute (Common parent):
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
~ Frozen plugins
|
~ Frozen plugins
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
- We've decided to install plugins that are frozen: see #113
|
||||||
|
Execute (Frozen plugin are not ~~installed nor~~ updated):
|
||||||
|
" Remove plugins
|
||||||
|
call plug#begin()
|
||||||
|
call plug#end()
|
||||||
|
PlugClean!
|
||||||
|
q
|
||||||
|
|
||||||
Execute (Frozen plugin are not installed nor updated):
|
" vim-easy-align is not found, so it will be installed even though it's frozen
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
|
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
PlugInstall
|
||||||
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
||||||
|
q
|
||||||
|
|
||||||
|
" Remove plugins again
|
||||||
|
call plug#begin()
|
||||||
|
call plug#end()
|
||||||
|
PlugClean!
|
||||||
|
q
|
||||||
|
|
||||||
|
" PlugUpdate will do the same
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
|
||||||
|
call plug#end()
|
||||||
|
PlugInstall
|
||||||
|
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
||||||
|
q
|
||||||
|
|
||||||
|
" Since vim-easy-align already exists, PlugInstall or PlugUpdate will skip it
|
||||||
redir => out
|
redir => out
|
||||||
silent PlugInstall
|
silent PlugInstall
|
||||||
redir END
|
redir END
|
||||||
@@ -593,6 +617,7 @@ Execute (Cleanup):
|
|||||||
call plug#begin()
|
call plug#begin()
|
||||||
call plug#end()
|
call plug#end()
|
||||||
PlugClean!
|
PlugClean!
|
||||||
|
q
|
||||||
|
|
||||||
Execute (On install):
|
Execute (On install):
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
@@ -600,7 +625,7 @@ Execute (On install):
|
|||||||
Plug 'junegunn/vim-pseudocl'
|
Plug 'junegunn/vim-pseudocl'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
PlugInstall
|
silent PlugInstall
|
||||||
q
|
q
|
||||||
|
|
||||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed'),
|
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed'),
|
||||||
@@ -617,7 +642,7 @@ Execute (On update):
|
|||||||
" Reset for updates
|
" Reset for updates
|
||||||
call system('cd '.g:plugs['vim-pseudocl'].dir.' && git reset --hard HEAD^')
|
call system('cd '.g:plugs['vim-pseudocl'].dir.' && git reset --hard HEAD^')
|
||||||
|
|
||||||
PlugUpdate
|
silent PlugUpdate
|
||||||
Log getline(1, '$')
|
Log getline(1, '$')
|
||||||
q
|
q
|
||||||
|
|
||||||
@@ -640,7 +665,7 @@ Execute (When already installed):
|
|||||||
\ 'vim-pseudocl/installed2 should not exist'
|
\ 'vim-pseudocl/installed2 should not exist'
|
||||||
|
|
||||||
Execute (PlugInstall!):
|
Execute (PlugInstall!):
|
||||||
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'
|
||||||
@@ -661,7 +686,7 @@ Execute (When already updated):
|
|||||||
\ 'vim-pseudocl/updated2 should not exist'
|
\ 'vim-pseudocl/updated2 should not exist'
|
||||||
|
|
||||||
Execute (PlugUpdate!):
|
Execute (PlugUpdate!):
|
||||||
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'
|
||||||
@@ -731,12 +756,12 @@ Execute (Using custom dir):
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
Before (Clear global vars):
|
Before (Clear global vars):
|
||||||
let g:xxx = []
|
let g:xxx = []
|
||||||
set rtp-=$PWD/xxx/
|
set rtp-=$PLUG_FIXTURES/xxx/
|
||||||
set rtp-=$PWD/xxx/after
|
set rtp-=$PLUG_FIXTURES/xxx/after
|
||||||
|
|
||||||
Execute (Immediate loading):
|
Execute (Immediate loading):
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug '$PWD/xxx'
|
Plug '$PLUG_FIXTURES/xxx'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
" FIXME:
|
" FIXME:
|
||||||
@@ -750,7 +775,7 @@ Execute (Immediate loading):
|
|||||||
|
|
||||||
Execute (Command-based on-demand loading):
|
Execute (Command-based on-demand loading):
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug '$PWD/xxx', { 'on': 'XXX' }
|
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
AssertEqual [], g:xxx
|
AssertEqual [], g:xxx
|
||||||
@@ -763,7 +788,7 @@ Execute (Command-based on-demand loading):
|
|||||||
|
|
||||||
Execute (Filetype-based on-demand loading):
|
Execute (Filetype-based on-demand loading):
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug '$PWD/xxx', { 'for': 'xxx' }
|
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
||||||
@@ -778,10 +803,10 @@ Before:
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
|
||||||
Execute (plug#helptags):
|
Execute (plug#helptags):
|
||||||
silent! call delete(expand('$PWD/xxx/doc/tags'))
|
silent! call delete(expand('$PLUG_FIXTURES/xxx/doc/tags'))
|
||||||
Assert !filereadable(expand('$PWD/xxx/doc/tags'))
|
Assert !filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
|
||||||
AssertEqual 1, plug#helptags()
|
AssertEqual 1, plug#helptags()
|
||||||
Assert filereadable(expand('$PWD/xxx/doc/tags'))
|
Assert filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
~ Manual loading
|
~ Manual loading
|
||||||
@@ -822,7 +847,7 @@ Execute (PlugStatus should not contain (not loaded)):
|
|||||||
|
|
||||||
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 plug#begin()
|
call plug#begin()
|
||||||
Plug '$PWD/yyy', { 'on': [] }
|
Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
PlugStatus
|
PlugStatus
|
||||||
@@ -836,8 +861,8 @@ Execute (Load plugin from PlugStatus screen with L key in normal mode):
|
|||||||
|
|
||||||
Execute (Load plugin from PlugStatus screen with L key in visual mode):
|
Execute (Load plugin from PlugStatus screen with L key in visual mode):
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug '$PWD/z1', { 'on': [] }
|
Plug '$PLUG_FIXTURES/z1', { 'on': [] }
|
||||||
Plug '$PWD/z2', { 'for': [] }
|
Plug '$PLUG_FIXTURES/z2', { 'for': [] }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
PlugStatus
|
PlugStatus
|
||||||
@@ -882,6 +907,7 @@ Execute (Open plug window in a new tab):
|
|||||||
~ g:plug_url_format
|
~ g:plug_url_format
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
Execute (Using g:plug_url_format):
|
Execute (Using g:plug_url_format):
|
||||||
|
let prev_plug_url_format = g:plug_url_format
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
let g:plug_url_format = 'git@bitbucket.org:%s.git'
|
let g:plug_url_format = 'git@bitbucket.org:%s.git'
|
||||||
Plug 'junegunn/seoul256.vim'
|
Plug 'junegunn/seoul256.vim'
|
||||||
@@ -889,7 +915,7 @@ Execute (Using g:plug_url_format):
|
|||||||
Plug 'beauty256'
|
Plug 'beauty256'
|
||||||
AssertEqual 'git@bitbucket.org:junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
|
AssertEqual 'git@bitbucket.org:junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
|
||||||
AssertEqual 'git@bitsocket.org:vim-scripts/beauty256.git', g:plugs['beauty256'].uri
|
AssertEqual 'git@bitsocket.org:vim-scripts/beauty256.git', g:plugs['beauty256'].uri
|
||||||
unlet g:plug_url_format
|
let g:plug_url_format = prev_plug_url_format
|
||||||
|
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
~ U
|
~ U
|
||||||
@@ -963,8 +989,8 @@ Execute (Plug directory with comma):
|
|||||||
Execute (Strict load order):
|
Execute (Strict load order):
|
||||||
let g:total_order = []
|
let g:total_order = []
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug '$PWD/xxx'
|
Plug '$PLUG_FIXTURES/xxx'
|
||||||
Plug '$PWD/yyy', { 'for': ['xxx'] }
|
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
call EnsureLoaded()
|
call EnsureLoaded()
|
||||||
setf xxx
|
setf xxx
|
||||||
@@ -976,8 +1002,8 @@ Execute (Strict load order):
|
|||||||
|
|
||||||
let g:total_order = []
|
let g:total_order = []
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug '$PWD/xxx', { 'for': ['xxx'] }
|
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
|
||||||
Plug '$PWD/yyy'
|
Plug '$PLUG_FIXTURES/yyy'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
call EnsureLoaded()
|
call EnsureLoaded()
|
||||||
set rtp^=manually-prepended
|
set rtp^=manually-prepended
|
||||||
@@ -993,8 +1019,8 @@ Execute (Strict load order):
|
|||||||
|
|
||||||
let g:total_order = []
|
let g:total_order = []
|
||||||
call plug#begin()
|
call plug#begin()
|
||||||
Plug '$PWD/xxx', { 'for': ['xxx'] }
|
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
|
||||||
Plug '$PWD/yyy', { 'for': ['xxx'] }
|
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
call EnsureLoaded()
|
call EnsureLoaded()
|
||||||
setf xxx
|
setf xxx
|
||||||
@@ -1004,20 +1030,46 @@ Execute (Strict load order):
|
|||||||
Assert index(g:total_order, 'xxx/after/plugin') < index(g:total_order, 'yyy/after/plugin')
|
Assert index(g:total_order, 'xxx/after/plugin') < index(g:total_order, 'yyy/after/plugin')
|
||||||
AssertEqual len + 2, len(split(&rtp, ','))
|
AssertEqual len + 2, len(split(&rtp, ','))
|
||||||
|
|
||||||
Execute (Cleanup):
|
**********************************************************************
|
||||||
silent! call system('rm -rf '.temp_plugged)
|
Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home):
|
||||||
silent! call rename('fzf', 'fzf-staged')
|
call plug#begin('$PLUG_FIXTURES')
|
||||||
silent! unlet g:plugs
|
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': [] }
|
||||||
silent! unlet g:plug_home
|
Plug '$PLUG_FIXTURES/fzf'
|
||||||
silent! unlet g:plug_url_format
|
Plug '$PLUG_FIXTURES/xxx'
|
||||||
silent! unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out tabnr found len
|
Plug '$PLUG_FIXTURES/yyy'
|
||||||
silent! delf PlugStatusSorted
|
call plug#end()
|
||||||
silent! delf AssertExpect
|
|
||||||
silent! delf PlugUpdated
|
|
||||||
silent! delf EnsureLoaded
|
|
||||||
silent! delc AssertExpect
|
|
||||||
silent! unmap /
|
|
||||||
silent! unmap ?
|
|
||||||
|
|
||||||
Restore
|
" Remove z1, z2
|
||||||
|
PlugClean!
|
||||||
|
AssertExpect '^- ', 2
|
||||||
|
AssertExpect 'Already clean', 0
|
||||||
|
|
||||||
|
PlugClean!
|
||||||
|
AssertExpect '^- ', 0
|
||||||
|
AssertExpect 'Already clean', 1
|
||||||
|
q
|
||||||
|
|
||||||
|
**********************************************************************
|
||||||
|
Execute (PlugSnapshot / #154 issues with paths containing spaces):
|
||||||
|
call plug#begin('$TMPDIR/plug with spaces')
|
||||||
|
Plug 'junegunn/vim-easy-align'
|
||||||
|
Plug 'junegunn/seoul256.vim'
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
PlugClean!
|
||||||
|
PlugInstall
|
||||||
|
call plug#load('vim-easy-align') " Should properly handle paths with spaces
|
||||||
|
PlugSnapshot
|
||||||
|
AssertEqual '#!/bin/sh', getline(1)
|
||||||
|
AssertEqual '# Generated by vim-plug', getline(2)
|
||||||
|
AssertEqual 'vim +PlugUpdate +qa', getline(5)
|
||||||
|
AssertEqual 'PLUG_HOME=$TMPDIR/plug\ with\ spaces', getline(7)
|
||||||
|
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'
|
||||||
|
AssertEqual 'sh', &filetype
|
||||||
|
AssertEqual 'snapshot.sh', fnamemodify(expand('%'), ':t')
|
||||||
|
q
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user