mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-06 17:14:26 +08:00
Compare commits
186 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b44ea685aa | ||
|
|
9df0580eff | ||
|
|
e15598fe45 | ||
|
|
326cb71a2a | ||
|
|
c9a7ca1e9e | ||
|
|
5695fb8474 | ||
|
|
f68a4fddae | ||
|
|
17996cedce | ||
|
|
460fbe82e0 | ||
|
|
05a1620bb1 | ||
|
|
cb5bed0e35 | ||
|
|
44893a1901 | ||
|
|
765a2d21d3 | ||
|
|
eb25f320a0 | ||
|
|
7c7ef8cf2f | ||
|
|
a8b09617f9 | ||
|
|
bf1e0fb8eb | ||
|
|
656ccef8dc | ||
|
|
41de3c713c | ||
|
|
0507fc897e | ||
|
|
e6ea538558 | ||
|
|
3de4567bc0 | ||
|
|
0d9efb01c7 | ||
|
|
92bcecddd6 | ||
|
|
d1752e7d14 | ||
|
|
367e61b6b0 | ||
|
|
612ee1d461 | ||
|
|
c6ed41f47e | ||
|
|
0f3bd51d44 | ||
|
|
3595d5b52a | ||
|
|
10008e5843 | ||
|
|
d1351201d9 | ||
|
|
a61d097037 | ||
|
|
158fd28bc4 | ||
|
|
76e9076ef4 | ||
|
|
36973defbd | ||
|
|
82ac9d9075 | ||
|
|
bdc5c8d3cc | ||
|
|
c1f9d7cdb4 | ||
|
|
f666048052 | ||
|
|
db223a4d84 | ||
|
|
eb47183af2 | ||
|
|
e4ddb89c20 | ||
|
|
a4e2c064f0 | ||
|
|
820cc63569 | ||
|
|
c463c9fe83 | ||
|
|
7218143147 | ||
|
|
c3d57ac6b5 | ||
|
|
16902f9003 | ||
|
|
b082ae3847 | ||
|
|
6246ad284c | ||
|
|
c06d222480 | ||
|
|
b0f714e812 | ||
|
|
31b26aa266 | ||
|
|
d96e303692 | ||
|
|
a88753ef4e | ||
|
|
396c60f24c | ||
|
|
ffd54224a0 | ||
|
|
8d4c341a0a | ||
|
|
3e712f3936 | ||
|
|
88e2fa380c | ||
|
|
03590d8422 | ||
|
|
d5a5697dc0 | ||
|
|
799e20a682 | ||
|
|
c88ab60007 | ||
|
|
7d494b4a7b | ||
|
|
676174c34d | ||
|
|
6f60192d71 | ||
|
|
7e7dec9252 | ||
|
|
13234b4029 | ||
|
|
03504f26b1 | ||
|
|
46dda37494 | ||
|
|
fa2569dc84 | ||
|
|
fe0ff38cd9 | ||
|
|
77413875da | ||
|
|
f695463daf | ||
|
|
e6f40479ee | ||
|
|
6843e5aeec | ||
|
|
0cfa683cd0 | ||
|
|
e929534199 | ||
|
|
52d7da3925 | ||
|
|
cd26cd562e | ||
|
|
24a71f9a91 | ||
|
|
b836656556 | ||
|
|
7f598e5b58 | ||
|
|
87b426e381 | ||
|
|
ba97f4458e | ||
|
|
060c0e6d6c | ||
|
|
80e5b3eab5 | ||
|
|
aae282e4f0 | ||
|
|
7cdd4036de | ||
|
|
173bfea4c5 | ||
|
|
c233234bd9 | ||
|
|
84faabe4cc | ||
|
|
6173ecc210 | ||
|
|
dbd045e995 | ||
|
|
0611369d0d | ||
|
|
d478351363 | ||
|
|
8381041ac1 | ||
|
|
93d9e434a2 | ||
|
|
c3bcd95459 | ||
|
|
f820fb9f0d | ||
|
|
072d28e86e | ||
|
|
8fb0efe4e5 | ||
|
|
e11e045577 | ||
|
|
e00be1b493 | ||
|
|
38e1e6335c | ||
|
|
0c710f75f4 | ||
|
|
8292b3f31a | ||
|
|
26e4a77317 | ||
|
|
dd28fc7368 | ||
|
|
fb8a5f9246 | ||
|
|
eb29cc9b47 | ||
|
|
a93bdfc175 | ||
|
|
ded1ab7562 | ||
|
|
91fe6ad3e9 | ||
|
|
86e75e5d08 | ||
|
|
7e1dc1bcc8 | ||
|
|
58d39115f9 | ||
|
|
675b09dbfc | ||
|
|
a190f4e843 | ||
|
|
27289deb5c | ||
|
|
a6f3a020e3 | ||
|
|
4e5b5b978e | ||
|
|
2653f4bdfd | ||
|
|
69d6c9d545 | ||
|
|
51cf219213 | ||
|
|
6286337e5b | ||
|
|
23b508e5fd | ||
|
|
c34b35d50e | ||
|
|
240dc9cbb6 | ||
|
|
f85d4d774b | ||
|
|
50cd5e5819 | ||
|
|
099057da65 | ||
|
|
8e0fcf88c0 | ||
|
|
025f314144 | ||
|
|
48fba1454b | ||
|
|
2ed1f27aa2 | ||
|
|
7760f1c22b | ||
|
|
0bd23f5b47 | ||
|
|
0227c78910 | ||
|
|
8a72305371 | ||
|
|
018b48e071 | ||
|
|
7ace0c42db | ||
|
|
179fa7bb82 | ||
|
|
76bce26ab8 | ||
|
|
36e4364b81 | ||
|
|
76ec644114 | ||
|
|
9e0a082a3d | ||
|
|
9bee42ca0a | ||
|
|
18313fa43e | ||
|
|
32eb4f5cbe | ||
|
|
96824ccd14 | ||
|
|
ef4549d2d1 | ||
|
|
d738da2ddb | ||
|
|
d17d10dccb | ||
|
|
6677e8bffd | ||
|
|
80ca4ebf54 | ||
|
|
8f1df15cc3 | ||
|
|
2218b8fe20 | ||
|
|
c632c1fd6a | ||
|
|
42300e0c4d | ||
|
|
13de76383d | ||
|
|
481a400ba4 | ||
|
|
02710070a1 | ||
|
|
e04f93b162 | ||
|
|
923f3fb3d5 | ||
|
|
6a7efea26b | ||
|
|
0e3e1cab75 | ||
|
|
27354c826e | ||
|
|
650927980d | ||
|
|
047fbba4cd | ||
|
|
fa5ece81f7 | ||
|
|
e1b7f1ae85 | ||
|
|
cf1f644aa8 | ||
|
|
8da3942484 | ||
|
|
cbaf4f3088 | ||
|
|
a06687b4ed | ||
|
|
9abd50facd | ||
|
|
b3226fbbf6 | ||
|
|
d0120cfb45 | ||
|
|
d9b70554e3 | ||
|
|
3c6ac68947 | ||
|
|
51dc024b2e | ||
|
|
30a2c5cc14 | ||
|
|
a34b745a21 |
32
.github/ISSUE_TEMPLATE.md
vendored
Normal file
32
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<!--
|
||||
### Before Submitting
|
||||
|
||||
- You checked the [faq](https://github.com/junegunn/vim-plug/wiki/faq) for common problems.
|
||||
- Check your [requirements](https://github.com/junegunn/vim-plug/wiki/requirements) are satisfied.
|
||||
- You are not going to suggest vim-plug manage itself like Vundle, see #240, #364, #367 ...
|
||||
-->
|
||||
|
||||
Explain the problem here ...
|
||||
|
||||
------------------------------
|
||||
|
||||
<!-- Put the contents of `:version` below -->
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
<!-- Check all that apply. -->
|
||||
- Type:
|
||||
- [ ] Bug
|
||||
- [ ] Enhancement
|
||||
- [ ] Feature Request
|
||||
- [ ] Question
|
||||
- OS:
|
||||
- [ ] All/Other
|
||||
- [ ] Linux
|
||||
- [ ] OS X
|
||||
- [ ] Windows
|
||||
- Vim:
|
||||
- [ ] Terminal Vim
|
||||
- [ ] GVim
|
||||
- [ ] Neovim
|
||||
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
8
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<!-- ## Before Submitting
|
||||
|
||||
- You made sure the existing tests/travis build works.
|
||||
- You made sure any new features were tested where appropriate.
|
||||
- You checked a similar feature wasn't already turned down by searching issues & PRs.
|
||||
-->
|
||||
|
||||
Describe the details of your PR ...
|
||||
75
.travis.yml
75
.travis.yml
@@ -1,32 +1,51 @@
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.2 # Test with vim-nox package on ubuntu
|
||||
- 1.9.3 # Test against python installer
|
||||
- 2.0.0
|
||||
|
||||
before_script: |
|
||||
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.2 ]; then
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y vim-nox
|
||||
sudo ln -s /usr/bin/vim /usr/local/bin/vim
|
||||
else
|
||||
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
|
||||
|
||||
sudo: false
|
||||
env:
|
||||
global:
|
||||
- DEPS=$HOME/deps
|
||||
- PATH=$DEPS/bin:$PATH
|
||||
matrix:
|
||||
include:
|
||||
- env: ENV=nox
|
||||
rvm: 1.8.7
|
||||
addons: { apt: { packages: [vim-nox] } }
|
||||
- env: ENV=python
|
||||
rvm: 1.8.7
|
||||
addons: { apt: { packages: [python2.7-dev] } }
|
||||
- env: ENV=python3
|
||||
rvm: 1.8.7
|
||||
addons: { apt: { packages: [python3-dev] } }
|
||||
- env: ENV=ruby
|
||||
rvm: 1.8.7
|
||||
- env: ENV=ruby
|
||||
rvm: 2.0.0
|
||||
install: |
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
|
||||
script: |
|
||||
test/run !
|
||||
if [ "$ENV" == "nox" ]; then
|
||||
mkdir -p ${DEPS}/bin
|
||||
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
|
||||
return
|
||||
fi
|
||||
|
||||
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui "
|
||||
case "$ENV" in
|
||||
python)
|
||||
C_OPTS+=--enable-pythoninterp
|
||||
;;
|
||||
python3)
|
||||
C_OPTS+=--enable-python3interp
|
||||
;;
|
||||
ruby)
|
||||
C_OPTS+=--enable-rubyinterp
|
||||
;;
|
||||
esac
|
||||
|
||||
git clone --depth 1 https://github.com/vim/vim
|
||||
cd vim
|
||||
./configure $C_OPTS
|
||||
make
|
||||
make install
|
||||
cd -
|
||||
script: test/run !
|
||||
|
||||
134
README.md
134
README.md
@@ -1,5 +1,5 @@
|
||||
<img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="56" alt="vim-plug">
|
||||
[](https://travis-ci.org/junegunn/vim-plug)
|
||||
<img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="75" alt="vim-plug">[](https://travis-ci.org/junegunn/vim-plug)
|
||||
===
|
||||
|
||||
A minimalist Vim plugin manager.
|
||||
|
||||
@@ -10,54 +10,98 @@ A minimalist Vim plugin manager.
|
||||
- Easier to setup: Single file. No boilerplate code required.
|
||||
- Easier to use: Concise, intuitive syntax
|
||||
- [Super-fast][40/4] parallel installation/update
|
||||
(with [+python][py] or [+ruby][rb] or [Neovim][nv])
|
||||
(with any of `+python`, `+python3`, `+ruby`, or [Neovim][nv])
|
||||
- Creates shallow clones to minimize disk space usage and download time
|
||||
- On-demand loading for [faster startup time][startup-time]
|
||||
- Can review and rollback updates
|
||||
- Branch/tag support
|
||||
- Branch/tag/commit support
|
||||
- Post-update hooks
|
||||
- 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
|
||||
### Installation
|
||||
|
||||
[Download plug.vim](https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim)
|
||||
and put it in ~/.vim/autoload
|
||||
and put it in the "autoload" directory.
|
||||
|
||||
###### Unix
|
||||
|
||||
```sh
|
||||
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
```
|
||||
|
||||
Edit your .vimrc
|
||||
###### Neovim
|
||||
|
||||
```sh
|
||||
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
```
|
||||
|
||||
###### Windows (PowerShell)
|
||||
|
||||
```powershell
|
||||
md ~\vimfiles\autoload
|
||||
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
(New-Object Net.WebClient).DownloadFile($uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\autoload\plug.vim"))
|
||||
```
|
||||
|
||||
### Getting Help
|
||||
|
||||
- See the [requirements] page for debugging information & tested configurations.
|
||||
- See the [FAQ] for common problems and questions.
|
||||
- Create an [issue](https://github.com/junegunn/vim-plug/issues/new).
|
||||
|
||||
[FAQ]: https://github.com/junegunn/vim-plug/wiki/faq
|
||||
[requirements]: https://github.com/junegunn/vim-plug/wiki/requirements
|
||||
|
||||
### Usage
|
||||
|
||||
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neovim):
|
||||
|
||||
1. Begin the section with `call plug#begin()`
|
||||
1. List the plugins with `Plug` commands
|
||||
1. `call plug#end()` to update `&runtimepath` and initialize plugin system
|
||||
|
||||
#### Example
|
||||
|
||||
```vim
|
||||
call plug#begin('~/.vim/plugged')
|
||||
|
||||
" Make sure you use single quotes
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
|
||||
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
|
||||
" Any valid git URL is allowed
|
||||
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
|
||||
|
||||
" Group dependencies, vim-snippets depends on ultisnips
|
||||
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
|
||||
|
||||
" 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'
|
||||
" Using a non-master branch
|
||||
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
|
||||
|
||||
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
|
||||
Plug 'fatih/vim-go', { 'tag': '*' }
|
||||
|
||||
" Plugin options
|
||||
Plug 'nsf/gocode', { 'tag': 'go.weekly.2012-03-13', 'rtp': 'vim' }
|
||||
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
|
||||
|
||||
" Plugin outside ~/.vim/plugged with post-update hook
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||
|
||||
" Unmanaged plugin (manually installed and updated)
|
||||
Plug '~/my-prototype-plugin'
|
||||
|
||||
" Add plugins to &runtimepath
|
||||
call plug#end()
|
||||
```
|
||||
|
||||
@@ -72,30 +116,34 @@ Reload .vimrc and `:PlugInstall` to install 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 |
|
||||
| `PlugSnapshot [output path]` | Generate script for restoring the current snapshot of the plugins |
|
||||
| `PlugDiff` | Examine changes from the previous update and the pending changes |
|
||||
| `PlugSnapshot[!] [output path]` | Generate script for restoring the current snapshot of the plugins |
|
||||
|
||||
### `Plug` options
|
||||
|
||||
| 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 update unless explicitly specified |
|
||||
| Option | Description |
|
||||
| ----------------------- | ------------------------------------------------ |
|
||||
| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
|
||||
| `rtp` | Subdirectory that contains Vim plugin |
|
||||
| `dir` | Custom directory for the plugin |
|
||||
| `as` | Use different name for the plugin |
|
||||
| `do` | Post-update hook (string or funcref) |
|
||||
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
||||
| `for` | On-demand loading: File types |
|
||||
| `frozen` | Do not update unless explicitly specified |
|
||||
|
||||
### Global options
|
||||
|
||||
| Flag | Default | Description |
|
||||
| ------------------- | --------------------------------- | -----------------------------------------------------------|
|
||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||
| Flag | Default | Description |
|
||||
| ------------------- | --------------------------------- | ------------------------------------------------------ |
|
||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||
| `g:plug_timeout` | 60 | Time limit of each task in seconds (*Ruby & Python*) |
|
||||
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
|
||||
| `g:plug_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_shallow` | 1 | Use shallow clone |
|
||||
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
|
||||
| `g:plug_pwindow` | `above 12new` | Command to open preview window in `PlugDiff` |
|
||||
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands) |
|
||||
|
||||
|
||||
### Keybindings
|
||||
|
||||
@@ -134,6 +182,10 @@ Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
|
||||
|
||||
" On-demand loading on both conditions
|
||||
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
|
||||
|
||||
" Code to execute when the plugin is lazily loaded on demand
|
||||
Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
|
||||
autocmd! User goyo.vim echom 'Goyo is now loaded!'
|
||||
```
|
||||
|
||||
`for` option is generally not needed as most plugins for specific file types
|
||||
@@ -147,7 +199,13 @@ In that case, use `do` option to describe the task to be performed.
|
||||
|
||||
```vim
|
||||
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
|
||||
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' }
|
||||
Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
|
||||
```
|
||||
|
||||
If the value starts with `:`, it will be recognized as a Vim command.
|
||||
|
||||
```vim
|
||||
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
||||
```
|
||||
|
||||
If you need more control, you can pass a reference to a Vim function that
|
||||
@@ -160,7 +218,7 @@ function! BuildYCM(info)
|
||||
" - status: 'installed', 'updated', or 'unchanged'
|
||||
" - force: set on PlugInstall! or PlugUpdate!
|
||||
if a:info.status == 'installed' || a:info.force
|
||||
!./install.sh
|
||||
!./install.py
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -188,9 +246,17 @@ let g:fzf_install = 'yes | ./install'
|
||||
Plug 'junegunn/fzf', { 'do': g:fzf_install }
|
||||
```
|
||||
|
||||
### FAQ/Troubleshooting
|
||||
### `PlugInstall!` and `PlugUpdate!`
|
||||
|
||||
See [FAQ/Troubleshooting](https://github.com/junegunn/vim-plug/wiki/faq).
|
||||
The installer takes the following steps when installing/updating a plugin:
|
||||
|
||||
1. `git clone` or `git fetch` from its origin
|
||||
2. Check out branch, tag, or commit and optionally `git merge` remote branch
|
||||
3. If the plugin was updated (or installed for the first time)
|
||||
1. Update submodules
|
||||
2. Execute post-update hooks
|
||||
|
||||
The commands with `!` suffix ensure that all steps are run unconditionally.
|
||||
|
||||
### Articles
|
||||
|
||||
|
||||
BIN
plug.png
BIN
plug.png
Binary file not shown.
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 23 KiB |
5
test/fixtures/.gitignore
vendored
5
test/fixtures/.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
fzf*
|
||||
xxx
|
||||
yyy
|
||||
z1
|
||||
z2
|
||||
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
1
test/fixtures/ftplugin-msg/ftplugin/c.vim
vendored
@@ -1 +0,0 @@
|
||||
echomsg 'ftplugin'
|
||||
@@ -7,19 +7,19 @@ Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
||||
redir => out
|
||||
tabnew a.c
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin') >= 0
|
||||
Assert stridx(out, 'ftplugin-c') >= 0
|
||||
|
||||
* The same applies to plug#load())
|
||||
redir => out
|
||||
call plug#load('ftplugin-msg')
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin') >= 0
|
||||
Assert stridx(out, 'ftplugin-c') >= 0
|
||||
q
|
||||
|
||||
|
||||
**********************************************************************
|
||||
Execute (#114 Should not contain empty path in &rtp):
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
|
||||
Log &rtp
|
||||
@@ -34,7 +34,8 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||
augroup END
|
||||
|
||||
" Cleared on command
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
@@ -50,7 +51,8 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||
Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
|
||||
|
||||
" Cleared on FileType
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
|
||||
call plug#end()
|
||||
|
||||
@@ -64,25 +66,25 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||
|
||||
**********************************************************************
|
||||
Execute (#131 Syntax error):
|
||||
call plug#begin('/no-permission')
|
||||
call plug#begin('/proc/no-permission')
|
||||
Plug 'junegunn/vim-emoji'
|
||||
call plug#end()
|
||||
|
||||
redir => out
|
||||
silent PlugInstall
|
||||
redir END
|
||||
Assert out =~ 'Invalid plug directory: /no-permission'
|
||||
Assert out =~ 'Invalid plug directory: /proc/no-permission', out
|
||||
|
||||
**********************************************************************
|
||||
Execute (#139-1 Using new remote branch):
|
||||
" Make sure to remove the clone
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Install master branch
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
Plug expand('file:///$TMPDIR/new-branch')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
|
||||
@@ -93,14 +95,14 @@ Execute (#139-1 Using new remote branch):
|
||||
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 &&'
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout -b new &&'
|
||||
\. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
|
||||
\. 'git commit -m second')
|
||||
|
||||
" We're setting up two plugins so that parallel installer is used
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'new' }
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
@@ -123,14 +125,14 @@ Expect:
|
||||
|
||||
Execute (#139-2 Using yet another new remote branch):
|
||||
" Create another branch on origin
|
||||
call system('cd $TMPDIR/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
|
||||
\. 'git checkout -b brand-new &&'
|
||||
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
|
||||
\. 'git commit -m third')
|
||||
|
||||
" Test Vim installer here
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'brand-new' }
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'brand-new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
@@ -152,24 +154,25 @@ Expect:
|
||||
|
||||
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 &&'
|
||||
call system('cd /tmp/vim-plug-test/plugged/new-branch && git checkout master &&'
|
||||
\. 'touch foobar && git add foobar && git commit -m foobar')
|
||||
|
||||
" Different commit on remote
|
||||
call system('cd $TMPDIR/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
|
||||
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
|
||||
|
||||
for multi in [0, 1]
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
if multi
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
endif
|
||||
Plug expand('file:///$TMPDIR/new-branch')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
Assert @" =~ 'Not possible to fast-forward', @"
|
||||
endfor
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (#145: Merging on-demand loading triggers - cmd):
|
||||
@@ -188,6 +191,7 @@ Execute (#145: Merging on-demand loading triggers - cmd):
|
||||
Execute (#145: Merging on-demand loading triggers - map):
|
||||
unlet! g:xxx g:yyy
|
||||
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
|
||||
@@ -206,7 +210,7 @@ Execute (#159: shell=/bin/tcsh):
|
||||
let org = &shell
|
||||
try
|
||||
set shell=/bin/tcsh
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
|
||||
@@ -220,9 +224,109 @@ Execute (#159: shell=/bin/tcsh):
|
||||
|
||||
**********************************************************************
|
||||
Execute (#154: Spaces in &rtp should not be escaped):
|
||||
call plug#begin('$TMPDIR/plug it')
|
||||
call plug#begin('/tmp/vim-plug-test/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('/tmp/vim-plug-test/plugged')
|
||||
Plug 'plugin1'
|
||||
\| Plug 'plugin0'
|
||||
|
||||
Plug 'plugin2'
|
||||
\| Plug 'plugin0'
|
||||
\| Plug 'plugin1'
|
||||
call plug#end()
|
||||
|
||||
Log &rtp
|
||||
AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0'))
|
||||
|
||||
**********************************************************************
|
||||
Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
||||
unlet! g:loaded_easy_align_plugin
|
||||
silent! delc EasyAlign
|
||||
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
|
||||
Assert &rtp !~ '/vim-easy-align', 'Plugin should not be in &rtp'
|
||||
%EasyAlign=
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
|
||||
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
|
||||
|
||||
**********************************************************************
|
||||
Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Shallow clone. We should have at least 2 plugins to enable parallel installer.
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
|
||||
|
||||
" Now unshallowed
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.0' }
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (#474: Load ftdetect files in filetypedetect augroup):
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/rust.vim', { 'for': 'rust', 'commit': '115d321d383eb96d438466c56cc871fcc1bd0faa' }
|
||||
call plug#end()
|
||||
PlugInstall!
|
||||
q
|
||||
|
||||
tabnew /tmp/vim-plug-test/any.rs
|
||||
AssertEqual 'rust', &filetype
|
||||
Log &filetype
|
||||
filetype detect
|
||||
AssertEqual 'rust', &filetype
|
||||
Log &filetype
|
||||
bd
|
||||
|
||||
**********************************************************************
|
||||
Execute (#489 On-demand loading with 'on' option should trigger BufRead autocmd):
|
||||
call plug#begin('$PLUG_FIXTURES')
|
||||
Plug 'ftplugin-msg', { 'on': 'XXX' }
|
||||
call plug#end()
|
||||
|
||||
tabnew a.java
|
||||
redir => out
|
||||
silent! XXX
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin-java') >= 0
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (Cursor moved to another window during post-update hook):
|
||||
function! DoSplit(...)
|
||||
new
|
||||
call setline(1, 'empty')
|
||||
endfunction
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/rust.vim', { 'do': function('DoSplit') }
|
||||
call plug#end()
|
||||
PlugInstall!
|
||||
AssertEqual 1, line('$')
|
||||
AssertEqual 'empty', getline(1)
|
||||
q!
|
||||
q
|
||||
|
||||
124
test/run
124
test/run
@@ -1,11 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname $BASH_SOURCE)
|
||||
cd ..
|
||||
PLUG_SRC=$(pwd)/plug.vim
|
||||
cd - > /dev/null
|
||||
cd $(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
export PLUG_FIXTURES=$(pwd)/fixtures
|
||||
export BASE="$PWD"
|
||||
export PLUG_SRC="$PWD/../plug.vim"
|
||||
export PLUG_FIXTURES="$PWD/fixtures"
|
||||
mkdir -p "$PLUG_FIXTURES"
|
||||
export TEMP=/tmp/vim-plug-test
|
||||
rm -rf "$TEMP"
|
||||
mkdir -p "$TEMP"
|
||||
|
||||
cat > $TEMP/mini-vimrc << VIMRC
|
||||
set rtp+=$TEMP/junegunn/vader.vim
|
||||
set shell=/bin/bash
|
||||
VIMRC
|
||||
|
||||
clone() {
|
||||
if [ ! -d $2 ]; then
|
||||
@@ -13,25 +21,25 @@ clone() {
|
||||
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 &
|
||||
clone_repos() (
|
||||
cd $TEMP
|
||||
mkdir -p junegunn vim-scripts jg
|
||||
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
|
||||
vim-oblique vim-pseudocl vim-redis vim-emoji; do
|
||||
clone https://github.com/junegunn/${repo}.git junegunn/$repo &
|
||||
done
|
||||
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
|
||||
clone https://github.com/junegunn/fzf.git fzf &
|
||||
clone https://github.com/yous/subsubmodule.git yous/subsubmodule && \
|
||||
(cd yous/subsubmodule && git submodule update --init --recursive &) &
|
||||
wait
|
||||
|
||||
rm -rf $PLUG_FIXTURES/fzf
|
||||
clone https://github.com/junegunn/fzf.git $PLUG_FIXTURES/fzf-staged &
|
||||
wait
|
||||
clone junegunn/vim-emoji jg/vim-emoji
|
||||
cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master
|
||||
)
|
||||
|
||||
(cd junegunn/seoul256.vim &&
|
||||
git checkout no-t_co && git checkout master) > /dev/null 2>&1
|
||||
clone junegunn/vim-emoji jg/vim-emoji
|
||||
cd - > /dev/null
|
||||
|
||||
make_dirs() {
|
||||
make_dirs() (
|
||||
rm -rf "$PLUG_FIXTURES/$1"
|
||||
mkdir -p "$PLUG_FIXTURES/$1"
|
||||
cd "$PLUG_FIXTURES/$1"
|
||||
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
||||
@@ -46,50 +54,68 @@ make_dirs() {
|
||||
call add(g:total_order, s:name)
|
||||
EOF
|
||||
done
|
||||
cd - > /dev/null
|
||||
}
|
||||
)
|
||||
|
||||
init() {
|
||||
rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2}
|
||||
rm -rf $TMPDIR/new-branch
|
||||
gitinit() (
|
||||
cd "$PLUG_FIXTURES/$1"
|
||||
git init
|
||||
git commit -m 'commit' --allow-empty
|
||||
)
|
||||
|
||||
prepare() {
|
||||
make_dirs xxx/ xxx
|
||||
make_dirs xxx/after xxx
|
||||
mkdir -p $PLUG_FIXTURES/xxx/doc
|
||||
cat > $PLUG_FIXTURES/xxx/doc/xxx.txt << DOC
|
||||
mkdir -p "$PLUG_FIXTURES/xxx/doc"
|
||||
cat > "$PLUG_FIXTURES/xxx/doc/xxx.txt" << DOC
|
||||
hello *xxx*
|
||||
DOC
|
||||
gitinit xxx
|
||||
|
||||
make_dirs yyy/ yyy
|
||||
make_dirs yyy/after yyy
|
||||
gitinit yyy
|
||||
|
||||
make_dirs z1/ z1
|
||||
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
|
||||
)
|
||||
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
||||
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
|
||||
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
|
||||
|
||||
rm -rf $TEMP/new-branch
|
||||
cd $TEMP
|
||||
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
|
||||
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
cat > /tmp/mini-vimrc << VIMRC
|
||||
set rtp+=/tmp/junegunn/vader.vim
|
||||
set shell=/bin/bash
|
||||
source $PLUG_SRC
|
||||
VIMRC
|
||||
select_vim() {
|
||||
local vim=/usr/bin/vim
|
||||
if [ -n "$DEPS" ] && [ -e "${DEPS}/bin/vim" ]; then
|
||||
vim="${DEPS}/bin/vim"
|
||||
elif [ -e "/usr/local/bin/vim" ]; then
|
||||
vim=/usr/local/bin/vim
|
||||
fi
|
||||
echo $vim
|
||||
}
|
||||
|
||||
[ -z "$TMPDIR" ] && export TMPDIR=/tmp/
|
||||
init
|
||||
clone_repos
|
||||
prepare
|
||||
|
||||
git --version
|
||||
VIM=$(select_vim)
|
||||
echo "Selected Vim: $VIM"
|
||||
if [ "$1" = '!' ]; then
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
init &&
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
prepare &&
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
else
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader test.vader'
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'Vader test.vader'
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
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'
|
||||
|
||||
let g:plug_url_format = 'file:///tmp/vim-plug-test/%s'
|
||||
let g:base_rtp = &rtp
|
||||
let g:first_rtp = split(&rtp, ',')[0]
|
||||
let g:last_rtp = split(&rtp, ',')[-1]
|
||||
let g:temp_plugged = tempname()
|
||||
if !exists('$PLUG_SRC')
|
||||
let $PLUG_SRC = globpath(&rtp, 'autoload/plug.vim')
|
||||
endif
|
||||
let $PLUG_TMP = fnamemodify(tempname(), ':h').'/plug.vim'
|
||||
|
||||
" Temporarily patch plug.vim
|
||||
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
|
||||
call writefile(extend(readfile($PLUG_TMP),
|
||||
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_TMP)
|
||||
|
||||
set t_Co=256
|
||||
colo default
|
||||
@@ -39,12 +42,38 @@ Execute (Initialize test environment):
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! RmRf(file)
|
||||
call system(printf('rm -rf "%s"', a:file))
|
||||
endfunction
|
||||
|
||||
function! ReloadPlug()
|
||||
call ResetPlug()
|
||||
source $PLUG_TMP
|
||||
let &rtp = g:base_rtp
|
||||
endfunction
|
||||
|
||||
function! GitBranch(repo)
|
||||
return system(printf('cd %s && git rev-parse --abbrev-ref HEAD', g:plugs[a:repo].dir))[:-2]
|
||||
endfunction
|
||||
|
||||
function! GitTag(repo)
|
||||
return system(printf('cd %s && git describe --tags', g:plugs[a:repo].dir))[:-2]
|
||||
endfunction
|
||||
|
||||
function! GitCommit(repo)
|
||||
return system(printf('cd %s && git rev-parse HEAD', g:plugs[a:repo].dir))[:-2]
|
||||
endfunction
|
||||
|
||||
source $PLUG_TMP
|
||||
|
||||
Execute (Print Interpreter Version):
|
||||
redir => out
|
||||
if has('ruby')
|
||||
silent ruby puts 'Ruby: ' + RUBY_VERSION
|
||||
elseif has('python')
|
||||
silent python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2])
|
||||
elseif has('python3')
|
||||
silent python3 import sys; svi = sys.version_info; print('Python: {}.{}.{}'.format(svi[0], svi[1], svi[2]))
|
||||
endif
|
||||
redir END
|
||||
Log substitute(out, '\n', '', 'g')
|
||||
@@ -53,20 +82,18 @@ 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! call RmRf(g:temp_plugged)
|
||||
silent! unlet g:plugs g:plug_home g:plug_url_format
|
||||
silent! unlet g:temp_plugged g:first_rtp g:last_rtp g:base_rtp out
|
||||
silent! delf PlugStatusSorted
|
||||
silent! delf AssertExpect
|
||||
silent! delf PlugUpdated
|
||||
silent! delf EnsureLoaded
|
||||
silent! delf ReloadPlug
|
||||
silent! delc AssertExpect
|
||||
silent! unmap /
|
||||
silent! unmap ?
|
||||
call delete($PLUG_TMP)
|
||||
|
||||
Restore
|
||||
|
||||
|
||||
@@ -17,25 +17,25 @@ Execute (plug#begin() without path argument with empty &rtp):
|
||||
redir END
|
||||
Assert stridx(out, 'Unable to determine plug home') >= 0
|
||||
let &rtp = save_rtp
|
||||
unlet save_rtp
|
||||
|
||||
Execute (plug#begin(path)):
|
||||
let temp_plugged = tempname()
|
||||
call plug#begin(temp_plugged.'/')
|
||||
call plug#begin(g:temp_plugged.'/')
|
||||
Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home'
|
||||
|
||||
AssertEqual 0, len(g:plugs)
|
||||
AssertEqual temp_plugged, g:plug_home
|
||||
AssertEqual basertp, &rtp
|
||||
AssertEqual g:temp_plugged, g:plug_home
|
||||
AssertEqual g:base_rtp, &rtp
|
||||
|
||||
Execute (Subsequent plug#begin() calls will reuse g:plug_home):
|
||||
call plug#begin()
|
||||
AssertEqual temp_plugged, g:plug_home
|
||||
AssertEqual g:temp_plugged, g:plug_home
|
||||
|
||||
Execute (Test Plug command):
|
||||
^ Git repo with branch (DEPRECATED. USE BRANCH OPTION)
|
||||
Plug 'junegunn/seoul256.vim', { 'branch': 'yes-t_co' }
|
||||
AssertEqual 'file:///tmp/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
|
||||
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||
AssertEqual 'file:///tmp/vim-plug-test/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
|
||||
AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
|
||||
|
||||
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
|
||||
@@ -43,22 +43,22 @@ Execute (Test Plug command):
|
||||
|
||||
^ Git repo with tag (DEPRECATED. USE TAG OPTION)
|
||||
Plug 'junegunn/goyo.vim', '1.5.2'
|
||||
AssertEqual 'file:///tmp/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
|
||||
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
|
||||
AssertEqual 'file:///tmp/vim-plug-test/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
|
||||
AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
|
||||
AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
|
||||
|
||||
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
|
||||
AssertEqual '1.5.3', g:plugs['goyo.vim'].tag
|
||||
|
||||
" Git URI
|
||||
Plug 'file:///tmp/jg/vim-emoji'
|
||||
AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri
|
||||
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
AssertEqual 'file:///tmp/vim-plug-test/jg/vim-emoji', g:plugs['vim-emoji'].uri
|
||||
AssertEqual 'master', g:plugs['vim-emoji'].branch
|
||||
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
|
||||
AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
|
||||
|
||||
" vim-scripts/
|
||||
Plug 'beauty256'
|
||||
AssertEqual 'file:///tmp/vim-scripts/beauty256', g:plugs.beauty256.uri
|
||||
AssertEqual 'file:///tmp/vim-plug-test/vim-scripts/beauty256', g:plugs.beauty256.uri
|
||||
AssertEqual 'master', g:plugs.beauty256.branch
|
||||
|
||||
AssertEqual 4, len(g:plugs)
|
||||
@@ -66,7 +66,7 @@ Execute (Test Plug command):
|
||||
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 join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||
AssertEqual '././', g:plugs['seoul256.vim'].rtp
|
||||
|
||||
Log string(g:plugs)
|
||||
@@ -83,10 +83,14 @@ Execute (PlugClean before installation):
|
||||
q
|
||||
|
||||
Execute (plug#end() updates &rtp):
|
||||
" Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
|
||||
" Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
" Plug 'beauty256'
|
||||
" Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
|
||||
call plug#end()
|
||||
Assert len(&rtp) > len(basertp)
|
||||
AssertEqual first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
||||
Assert len(&rtp) > len(g:base_rtp)
|
||||
AssertEqual g:first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual g:last_rtp, split(&rtp, ',')[-1]
|
||||
|
||||
Execute (Yet, plugins are not available):
|
||||
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
@@ -155,7 +159,7 @@ Expect:
|
||||
Execute (Change branch of seoul256.vim):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug 'file:///tmp/jg/vim-emoji'
|
||||
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
call plug#end()
|
||||
|
||||
Execute (PlugStatus):
|
||||
@@ -193,21 +197,39 @@ Expect:
|
||||
Execute (Change URI of seoul256.vim):
|
||||
call plug#begin()
|
||||
Plug 'junegunn.choi/seoul256.vim'
|
||||
Plug 'file:///tmp/jg/vim-emoji'
|
||||
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
call plug#end()
|
||||
|
||||
Execute (PlugStatus):
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
Expected: file:///tmp/junegunn.choi/seoul256.vim
|
||||
Invalid URI: file:///tmp/junegunn/seoul256.vim
|
||||
Expected: file:///tmp/vim-plug-test/junegunn.choi/seoul256.vim
|
||||
Invalid URI: file:///tmp/vim-plug-test/junegunn/seoul256.vim
|
||||
PlugClean required.
|
||||
- vim-emoji: OK
|
||||
Finished. 1 error(s).
|
||||
[==]
|
||||
x seoul256.vim:
|
||||
|
||||
Execute (Corrected the URI but diverged from master):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
|
||||
call plug#end()
|
||||
for _ in range(3)
|
||||
call system(printf('cd "%s" && git commit --allow-empty -m "dummy"', g:plugs['seoul256.vim'].dir))
|
||||
endfor
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
Diverged from origin/master by 3 commit(s).
|
||||
Reinstall after PlugClean.
|
||||
- vim-emoji: OK
|
||||
Finished. 1 error(s).
|
||||
[==]
|
||||
x seoul256.vim:
|
||||
|
||||
# TODO: does not work due to inputsave()
|
||||
# Do (PlugClean):
|
||||
# :PlugClean\<Enter>y\<Enter>
|
||||
@@ -218,8 +240,9 @@ Expect:
|
||||
Execute (PlugClean! to remove seoul256.vim):
|
||||
PlugClean!
|
||||
" Three removed, emoji left
|
||||
AssertExpect '^- ', 3
|
||||
AssertExpect 'Removed', 1
|
||||
AssertEqual 'Removed 3 directories.', getline(4)
|
||||
AssertExpect '^\~ ', 3
|
||||
AssertExpect 'Diverged', 1
|
||||
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
||||
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
q
|
||||
@@ -234,8 +257,8 @@ Execute (PlugStatus):
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
Expected: file:///tmp/junegunn/vim-emoji
|
||||
Invalid URI: file:///tmp/jg/vim-emoji
|
||||
Expected: file:///tmp/vim-plug-test/junegunn/vim-emoji
|
||||
Invalid URI: file:///tmp/vim-plug-test/jg/vim-emoji
|
||||
Not found. Try PlugInstall.
|
||||
PlugClean required.
|
||||
Finished. 2 error(s).
|
||||
@@ -245,8 +268,8 @@ Expect:
|
||||
|
||||
Execute (PlugClean! to remove vim-emoji):
|
||||
PlugClean!
|
||||
AssertExpect '^- ', 1
|
||||
AssertExpect 'Removed', 1
|
||||
AssertExpect '^\~ ', 1
|
||||
AssertEqual 'Removed 1 directories.', getline(4)
|
||||
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
||||
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
q
|
||||
@@ -262,23 +285,30 @@ Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
|
||||
PlugUpdate
|
||||
AssertExpect 'Already up-to-date', 2
|
||||
normal D
|
||||
AssertEqual 'No updates.', getline(1)
|
||||
AssertEqual '0 plugin(s) updated.', getline(1)
|
||||
q
|
||||
|
||||
Execute (PlugDiff - 'No updates.'):
|
||||
PlugDiff
|
||||
AssertEqual 'No updates.', getline(1)
|
||||
Log getline(1, '$')
|
||||
AssertEqual '0 plugin(s) updated.', getline(1)
|
||||
Assert empty(mapcheck('o'))
|
||||
Assert empty(mapcheck('X'))
|
||||
Assert empty(mapcheck("\<cr>"))
|
||||
q
|
||||
|
||||
Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
|
||||
Execute (New commits on remote, PlugUpdate, then PlugDiff):
|
||||
for repo in ['seoul256.vim', 'vim-emoji']
|
||||
call system(printf('cd %s/%s && git reset HEAD^^ --hard', g:plug_home, repo))
|
||||
for _ in range(2)
|
||||
call system(printf('cd /tmp/vim-plug-test/junegunn/%s && git commit --allow-empty -m "update"', repo))
|
||||
endfor
|
||||
endfor
|
||||
unlet repo
|
||||
PlugUpdate
|
||||
|
||||
" Now we have updates
|
||||
normal D
|
||||
AssertEqual 'Last update:', getline(1)
|
||||
AssertEqual '2 plugin(s) updated.', getline(1)
|
||||
|
||||
" Preview commit
|
||||
silent! wincmd P
|
||||
@@ -307,6 +337,7 @@ Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
|
||||
" [[ motion
|
||||
execute 'normal 0[['
|
||||
AssertEqual lnum, line('.')
|
||||
unlet lnum
|
||||
AssertEqual 3, col('.')
|
||||
|
||||
" X key to revert the update
|
||||
@@ -334,6 +365,22 @@ Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
|
||||
AssertEqual 1, &previewwindow
|
||||
pclose
|
||||
|
||||
Execute (Test g:plug_pwindow):
|
||||
let g:plug_pwindow = 'below 5new'
|
||||
PlugDiff
|
||||
AssertExpect '^- ', 1
|
||||
execute "normal ]]jo"
|
||||
|
||||
AssertEqual 0, &previewwindow
|
||||
AssertEqual 1, winnr()
|
||||
wincmd P
|
||||
AssertEqual 1, &previewwindow
|
||||
AssertEqual 2, winnr()
|
||||
AssertEqual 5, winheight('.')
|
||||
wincmd p
|
||||
normal q
|
||||
unlet g:plug_pwindow
|
||||
|
||||
Execute (Reuse Plug window in another tab):
|
||||
let tabnr = tabpagenr()
|
||||
PlugDiff
|
||||
@@ -346,12 +393,83 @@ Execute (Reuse Plug window in another tab):
|
||||
AssertEqual tabnr, tabpagenr()
|
||||
normal! gt
|
||||
q
|
||||
unlet tabnr
|
||||
|
||||
Execute (contd. PlugDiff should not show inverted history):
|
||||
" Additional PlugUpdate to clear diff
|
||||
PlugUpdate
|
||||
PlugDiff
|
||||
Log getline(1, '$')
|
||||
|
||||
" Checking out older revisions
|
||||
for repo in values(g:plugs)
|
||||
call system(printf('cd %s && git reset HEAD^ --hard', shellescape(repo.dir)))
|
||||
endfor
|
||||
unlet repo
|
||||
|
||||
" PlugDiff should not report the changes i.e. git log --left-only
|
||||
PlugDiff
|
||||
Log getline(1, '$')
|
||||
AssertEqual '0 plugin(s) updated.', getline(1)
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
~ PlugDiff to see the pending changes
|
||||
**********************************************************************
|
||||
|
||||
Execute (PlugDiff):
|
||||
call plug#begin()
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
call plug#begin()
|
||||
Plug 'file://'.expand('$PLUG_FIXTURES').'/xxx'
|
||||
Plug 'file://'.expand('$PLUG_FIXTURES').'/yyy'
|
||||
call plug#end()
|
||||
PlugInstall
|
||||
Log getline(1, '$')
|
||||
|
||||
call system('cd "$PLUG_FIXTURES/xxx" && git commit --allow-empty -m update-xxx && git tag -f xxx')
|
||||
call system('cd "$PLUG_FIXTURES/yyy" && git tag -f yyy && git commit --allow-empty -m update-yyy && git tag -f zzz')
|
||||
|
||||
let g:plugs.yyy.tag = 'yyy'
|
||||
PlugUpdate
|
||||
Log getline(1, '$')
|
||||
|
||||
PlugDiff
|
||||
" 1 plugin(s) updated. 1 plugin(s) have pending updates.
|
||||
" [==]
|
||||
"
|
||||
" Last update:
|
||||
" ------------
|
||||
"
|
||||
" - xxx:
|
||||
" 166cfff (tag: xxx) update-xxx (1 second ago)
|
||||
"
|
||||
" Pending updates:
|
||||
" ----------------
|
||||
"
|
||||
" - yyy: (tag: yyy)
|
||||
" c0a064b (tag: zzz) update-yyy (1 second ago)
|
||||
"
|
||||
Log getline(1, '$')
|
||||
AssertEqual 15, line('$')
|
||||
AssertEqual '1 plugin(s) updated. 1 plugin(s) have pending updates.', getline(1)
|
||||
AssertEqual '[==]', getline(2)
|
||||
AssertEqual '- yyy: (tag: yyy)', getline(13)
|
||||
Assert getline(8) =~ '(tag: xxx)'
|
||||
Assert getline(14) =~ '(tag: zzz)'
|
||||
Assert !empty(mapcheck('o'))
|
||||
Assert !empty(mapcheck('X'))
|
||||
Assert !empty(mapcheck("\<cr>"))
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
~ On-demand loading / Partial installation/update ~
|
||||
**********************************************************************
|
||||
|
||||
Execute (Trying to execute on-demand commands when plugin is not installed):
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] }
|
||||
call plug#end()
|
||||
@@ -364,16 +482,22 @@ Execute (Trying to execute on-demand commands when plugin is not installed):
|
||||
Assert !exists(':LiveEasyAlign')
|
||||
|
||||
Execute (New set of plugins):
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-fnr'
|
||||
Plug 'junegunn/vim-pseudocl'
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
Plug 'junegunn/vim-redis', { 'for': 'redis' }
|
||||
let user_autocmd = {}
|
||||
autocmd! User vim-fnr let user_autocmd.fnr = 1
|
||||
autocmd! User vim-easy-align let user_autocmd.easy_align = 1
|
||||
autocmd! User vim-redis let user_autocmd.redis = 1
|
||||
call plug#end()
|
||||
|
||||
Execute (Check commands):
|
||||
Assert !exists(':FNR'), 'FNR command should not be found'
|
||||
Assert !exists(':RedisExecute'), 'RedisExecute command should not be found'
|
||||
Assert empty(user_autocmd)
|
||||
|
||||
Execute (Partial PlugInstall):
|
||||
PlugInstall vim-fnr vim-easy-align
|
||||
@@ -383,8 +507,8 @@ Execute (Partial PlugInstall):
|
||||
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]
|
||||
AssertEqual g:first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual g:last_rtp, split(&rtp, ',')[-1]
|
||||
q
|
||||
|
||||
Given (Unaligned code):
|
||||
@@ -403,6 +527,10 @@ Expect (Aligned code):
|
||||
a = 1
|
||||
aa = 2
|
||||
|
||||
Then (autocmd executed):
|
||||
Assert user_autocmd.easy_align
|
||||
AssertEqual 1, len(user_autocmd)
|
||||
|
||||
Given:
|
||||
Execute (Partial PlugUpdate):
|
||||
PlugUpdate vim-redis
|
||||
@@ -412,6 +540,11 @@ 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'
|
||||
Assert user_autocmd.redis
|
||||
AssertEqual 2, len(user_autocmd)
|
||||
|
||||
autocmd! User
|
||||
unlet user_autocmd
|
||||
|
||||
**********************************************************************
|
||||
~ Local (unmanaged) plugins
|
||||
@@ -419,6 +552,7 @@ Execute (On-demand loading based on filetypes):
|
||||
|
||||
Execute (Add unmanaged plugin):
|
||||
let fzf = expand('$PLUG_FIXTURES/fzf')
|
||||
call RmRf(fzf)
|
||||
Log fzf
|
||||
|
||||
call plug#begin()
|
||||
@@ -477,7 +611,8 @@ Execute (PlugStatus should point out that the plugin is missing):
|
||||
|
||||
Execute (Deploy unmanaged plugin):
|
||||
Assert !exists(':FZF'), ':FZF command should not exist'
|
||||
call rename(expand('$PLUG_FIXTURES/fzf-staged'), fzf)
|
||||
call RmRf(fzf)
|
||||
Log system(printf('cp -r "/tmp/vim-plug-test/fzf" "%s"', fzf))
|
||||
|
||||
Execute (PlugUpdate still should not care):
|
||||
PlugUpdate
|
||||
@@ -497,8 +632,8 @@ Execute (Check &rtp after SomeCommand):
|
||||
Assert &rtp !~ 'fzf'
|
||||
silent! SomeCommand
|
||||
Assert &rtp =~ 'fzf'
|
||||
AssertEqual first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
||||
AssertEqual g:first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual g:last_rtp, split(&rtp, ',')[-1]
|
||||
|
||||
Execute (Common parent):
|
||||
call plug#begin()
|
||||
@@ -512,6 +647,8 @@ Execute (Common parent):
|
||||
AssertExpect! '[===]', 1
|
||||
q
|
||||
|
||||
unlet fzf
|
||||
|
||||
**********************************************************************
|
||||
~ Frozen plugins
|
||||
**********************************************************************
|
||||
@@ -623,6 +760,9 @@ Execute (On install):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed' }
|
||||
Plug 'junegunn/vim-pseudocl'
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug 'junegunn/goyo.vim'
|
||||
Plug 'yous/subsubmodule'
|
||||
call plug#end()
|
||||
|
||||
silent PlugInstall
|
||||
@@ -632,15 +772,20 @@ Execute (On install):
|
||||
\ 'vim-easy-align/installed should exist'
|
||||
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed'),
|
||||
\ 'vim-pseudocl/installed should not exist'
|
||||
AssertEqual ' ', system('cd '.g:plugs['subsubmodule'].dir.' && git submodule status')[0],
|
||||
\ 'subsubmodule/subsubmodule should be initialized'
|
||||
|
||||
Execute (On update):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' }
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug 'junegunn/goyo.vim'
|
||||
Plug 'yous/subsubmodule'
|
||||
call plug#end()
|
||||
|
||||
" Reset for updates
|
||||
call system('cd '.g:plugs['vim-pseudocl'].dir.' && git reset --hard HEAD^')
|
||||
" New commits on remote
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
|
||||
|
||||
silent PlugUpdate
|
||||
Log getline(1, '$')
|
||||
@@ -654,44 +799,73 @@ Execute (On update):
|
||||
Execute (When already installed):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed2' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': 'touch installed2' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'commit': '7f8cd78' }
|
||||
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' }
|
||||
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
|
||||
Plug 'yous/subsubmodule'
|
||||
call plug#end()
|
||||
|
||||
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'
|
||||
AssertNotEqual '7f8cd78cb1fe52185b98b16a3749811f0cc508af', GitCommit('vim-pseudocl')
|
||||
AssertNotEqual 'no-t_co', GitBranch('seoul256.vim')
|
||||
AssertNotEqual '1.5.3', GitTag('goyo.vim')
|
||||
|
||||
Execute (PlugInstall!):
|
||||
silent 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'
|
||||
AssertEqual '7f8cd78cb1fe52185b98b16a3749811f0cc508af', GitCommit('vim-pseudocl')
|
||||
AssertEqual 'no-t_co', GitBranch('seoul256.vim')
|
||||
AssertEqual '1.5.3', GitTag('goyo.vim')
|
||||
|
||||
Execute (When submodules are not initialized):
|
||||
call system(printf('cd %s && git submodule deinit subsubmodule', g:plugs['subsubmodule'].dir))
|
||||
|
||||
silent PlugInstall!
|
||||
q
|
||||
|
||||
AssertEqual ' ', system(printf('cd %s && git submodule status', g:plugs['subsubmodule'].dir))[0],
|
||||
\ 'subsubmodule/subsubmodule should be initialized'
|
||||
|
||||
Execute (When already updated):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated2' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated2' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'commit': 'dd507ca' }
|
||||
Plug 'junegunn/seoul256.vim', { 'branch': 'master' }
|
||||
Plug 'junegunn/goyo.vim', { 'tag': '1.6.0' }
|
||||
Plug 'yous/subsubmodule'
|
||||
call plug#end()
|
||||
|
||||
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'
|
||||
AssertEqual 'dd507ca0d5f3fdf0d522558cc5ecffdabf824469', GitCommit('vim-pseudocl')
|
||||
AssertEqual 'master', GitBranch('seoul256.vim')
|
||||
AssertEqual '1.6.0', GitTag('goyo.vim')
|
||||
|
||||
Execute (PlugUpdate!):
|
||||
silent 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 (When submodules are not initialized):
|
||||
call system(printf('cd %s && git submodule deinit subsubmodule', g:plugs['subsubmodule'].dir))
|
||||
|
||||
^ #481 submodule update should use standard shell
|
||||
let sh = &shell
|
||||
set sh=/bin/echo
|
||||
silent PlugUpdate!
|
||||
let &shell = sh
|
||||
unlet sh
|
||||
q
|
||||
AssertEqual ' ', system(printf('cd %s && git submodule status', g:plugs['subsubmodule'].dir))[0],
|
||||
\ 'subsubmodule/subsubmodule should be initialized'
|
||||
|
||||
Execute (Using Funcref):
|
||||
function! PlugUpdated(info)
|
||||
@@ -703,8 +877,9 @@ Execute (Using Funcref):
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
|
||||
call plug#end()
|
||||
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
|
||||
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
|
||||
call RmRf(g:plugs['vim-pseudocl'].dir)
|
||||
|
||||
PlugUpdate
|
||||
Log getline(1, '$')
|
||||
@@ -714,7 +889,7 @@ Execute (Using Funcref):
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled03'),
|
||||
\ 'vim-pseudocl/vim-pseudoclinstalled03 should exist'
|
||||
|
||||
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
|
||||
call RmRf(g:plugs['vim-pseudocl'].dir)
|
||||
PlugInstall!
|
||||
q
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignunchanged13'),
|
||||
@@ -730,18 +905,75 @@ Execute (Using Funcref):
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclunchanged13'),
|
||||
\ 'vim-pseudocl/vim-pseudoclunchanged13 should exist'
|
||||
|
||||
Execute (Post-update hook output; success and failure):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'xxx-non-existent-command-xxx' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': 'true' }
|
||||
call plug#end()
|
||||
|
||||
silent PlugInstall! 1
|
||||
AssertEqual '- Post-update hook for vim-pseudocl ... OK', getline(5)
|
||||
AssertEqual 'x Post-update hook for vim-easy-align ... Exit status: 127', getline(6)
|
||||
q
|
||||
|
||||
Execute (Post-update hook output; invalid type or funcref):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 1 }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': function('call') }
|
||||
call plug#end()
|
||||
|
||||
silent PlugInstall! 1
|
||||
AssertEqual 'x Post-update hook for vim-pseudocl ... Vim(call):E119: Not enough arguments for function: call', getline(5)
|
||||
AssertEqual 'x Post-update hook for vim-easy-align ... Invalid hook type', getline(6)
|
||||
q
|
||||
|
||||
Execute (Should not run when failed to update):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'touch failed' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': 'touch not-failed' }
|
||||
call plug#end()
|
||||
|
||||
" Invalid remote URL
|
||||
call system(printf('cd %s && git remote set-url origin xxx', g:plugs['vim-easy-align'].dir))
|
||||
|
||||
" New commits on remote
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
|
||||
|
||||
silent PlugUpdate
|
||||
Log getline(1, '$')
|
||||
q
|
||||
|
||||
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/failed'),
|
||||
\ 'vim-easy-align/failed should not exist'
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/not-failed'),
|
||||
\ 'vim-pseudocl/not-failed should exist'
|
||||
|
||||
Execute (Vim command with : prefix):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': ':call setline(2, 12345)' }
|
||||
call plug#end()
|
||||
|
||||
PlugInstall!
|
||||
Log getline(1, '$')
|
||||
AssertEqual '12345', getline(2)
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
~ Overriding `dir`
|
||||
**********************************************************************
|
||||
|
||||
Execute (Using custom dir):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
call plug#end()
|
||||
Assert isdirectory(g:plugs['vim-easy-align'].dir)
|
||||
|
||||
call system('rm -rf '.$TMPDIR.'easy-align')
|
||||
call RmRf('/tmp/vim-plug-test/easy-align')
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'dir': $TMPDIR.'easy-align' }
|
||||
Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/vim-plug-test/easy-align' }
|
||||
call plug#end()
|
||||
AssertEqual $TMPDIR.'easy-align/', g:plugs['vim-easy-align'].dir
|
||||
AssertEqual '/tmp/vim-plug-test/easy-align/', g:plugs['vim-easy-align'].dir
|
||||
|
||||
PlugClean!
|
||||
Assert !isdirectory(g:plugs['vim-easy-align'].dir)
|
||||
@@ -760,6 +992,7 @@ Before (Clear global vars):
|
||||
set rtp-=$PLUG_FIXTURES/xxx/after
|
||||
|
||||
Execute (Immediate loading):
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx'
|
||||
call plug#end()
|
||||
@@ -774,6 +1007,7 @@ Execute (Immediate loading):
|
||||
endif
|
||||
|
||||
Execute (Command-based on-demand loading):
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
|
||||
call plug#end()
|
||||
@@ -787,14 +1021,20 @@ Execute (Command-based on-demand loading):
|
||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
|
||||
|
||||
Execute (Filetype-based on-demand loading):
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'for': 'yyy' }
|
||||
call plug#end()
|
||||
|
||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
||||
|
||||
setf xxx
|
||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
|
||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/syntax', 'xxx/after/syntax', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent'], g:xxx
|
||||
|
||||
" syntax/xxx.vim and after/syntax/xxx.vim should not be loaded (#410)
|
||||
setf yyy
|
||||
AssertEqual ['yyy/ftdetect', 'yyy/after/ftdetect', 'yyy/plugin', 'yyy/after/plugin'], g:yyy
|
||||
|
||||
Before:
|
||||
|
||||
@@ -846,6 +1086,8 @@ Execute (PlugStatus should not contain (not loaded)):
|
||||
q
|
||||
|
||||
Execute (Load plugin from PlugStatus screen with L key in normal mode):
|
||||
call ResetPlug()
|
||||
unlet! g:yyy
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
|
||||
call plug#end()
|
||||
@@ -901,7 +1143,7 @@ Execute (Open plug window in a new tab):
|
||||
normal S
|
||||
AssertEqual tabnr, tabpagenr()
|
||||
q
|
||||
unlet g:plug_window
|
||||
unlet g:plug_window tabnr
|
||||
|
||||
**********************************************************************
|
||||
~ g:plug_url_format
|
||||
@@ -947,7 +1189,7 @@ Execute (Update plugin with U key in normal mode):
|
||||
q
|
||||
|
||||
Execute (Update plugins with U key in visual mode):
|
||||
silent! call system('rm -rf '.g:plugs['vim-easy-align'].dir)
|
||||
silent! call RmRf(g:plugs['vim-easy-align'].dir)
|
||||
|
||||
PlugStatus
|
||||
normal VGU
|
||||
@@ -974,7 +1216,7 @@ Execute (plug#begin should expand env vars):
|
||||
|
||||
**********************************************************************
|
||||
Execute (Plug directory with comma):
|
||||
call plug#begin(temp_plugged . '/p,l,u,g,g,e,d')
|
||||
call plug#begin(g:temp_plugged . '/p,l,u,g,g,e,d')
|
||||
Plug 'junegunn/vim-emoji'
|
||||
call plug#end()
|
||||
Log &rtp
|
||||
@@ -984,10 +1226,12 @@ Execute (Plug directory with comma):
|
||||
let found = filter(split(globpath(&rtp, 'README.md'), '\n'), 'v:val =~ ","')
|
||||
Log found
|
||||
AssertEqual 1, len(found)
|
||||
unlet found
|
||||
|
||||
**********************************************************************
|
||||
Execute (Strict load order):
|
||||
let g:total_order = []
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx'
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
|
||||
@@ -1001,6 +1245,7 @@ Execute (Strict load order):
|
||||
let len = len(split(&rtp, ','))
|
||||
|
||||
let g:total_order = []
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
|
||||
Plug '$PLUG_FIXTURES/yyy'
|
||||
@@ -1018,6 +1263,9 @@ Execute (Strict load order):
|
||||
AssertEqual len + 2, len(split(&rtp, ','))
|
||||
|
||||
let g:total_order = []
|
||||
call ReloadPlug()
|
||||
set rtp^=manually-prepended
|
||||
set rtp+=manually-appended
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
|
||||
@@ -1041,16 +1289,17 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home
|
||||
|
||||
" Remove z1, z2
|
||||
PlugClean!
|
||||
AssertExpect '^- ', 2
|
||||
AssertExpect '^\~ ', 2
|
||||
AssertExpect 'Already clean', 0
|
||||
|
||||
PlugClean!
|
||||
AssertExpect '^- ', 0
|
||||
AssertExpect '^\~ ', 0
|
||||
AssertExpect 'Already clean', 1
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (PlugSnapshot / #154 issues with paths containing spaces):
|
||||
let $TMPDIR = '/tmp'
|
||||
call plug#begin('$TMPDIR/plug with spaces')
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
@@ -1060,16 +1309,165 @@ Execute (PlugSnapshot / #154 issues with paths containing spaces):
|
||||
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
|
||||
AssertEqual '" Generated by vim-plug', getline(1)
|
||||
AssertEqual 0, stridx(getline(6), "silent! let g:plugs['seoul256.vim'].commit = '")
|
||||
AssertEqual 0, stridx(getline(7), "silent! let g:plugs['vim-easy-align'].commit = '")
|
||||
AssertEqual 'vim', &filetype
|
||||
|
||||
execute 'PlugSnapshot' g:plug_home.'/snapshot.sh'
|
||||
AssertEqual 'sh', &filetype
|
||||
AssertEqual 'snapshot.sh', fnamemodify(expand('%'), ':t')
|
||||
call delete(g:plug_home.'/snapshot.vim')
|
||||
execute 'PlugSnapshot' escape(g:plug_home.'/snapshot.vim', ' ')
|
||||
AssertEqual 'vim', &filetype
|
||||
AssertEqual 'snapshot.vim', fnamemodify(expand('%'), ':t')
|
||||
q
|
||||
|
||||
Execute(PlugSnapshot! to overwrite existing file):
|
||||
call writefile(['foobar'], g:plug_home.'/snapshot.vim')
|
||||
AssertEqual 'foobar', readfile(g:plug_home.'/snapshot.vim')[0]
|
||||
execute 'PlugSnapshot!' escape(g:plug_home.'/snapshot.vim', ' ')
|
||||
AssertEqual '" Generated by vim-plug', readfile(g:plug_home.'/snapshot.vim')[0]
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (#221 Shallow-clone and tag option):
|
||||
call plug#begin(g:temp_plugged)
|
||||
Plug 'junegunn/goyo.vim'
|
||||
call plug#end()
|
||||
PlugInstall
|
||||
|
||||
execute 'cd' g:plugs['goyo.vim'].dir
|
||||
Assert len(split(system('git log --oneline'), '\n')) == 1
|
||||
Assert filereadable('.git/shallow')
|
||||
|
||||
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
|
||||
PlugUpdate
|
||||
q
|
||||
|
||||
Assert len(split(system('git log --oneline'), '\n')) > 1
|
||||
Assert system('git describe --tag') =~ '^1.5.3'
|
||||
Assert !filereadable('.git/shallow')
|
||||
cd -
|
||||
|
||||
Execute (#221 Shallow-clone disabled by g:plug_shallow = 0):
|
||||
call plug#begin(g:temp_plugged)
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
let g:plug_shallow = 0
|
||||
call plug#begin(g:temp_plugged)
|
||||
Plug 'junegunn/goyo.vim'
|
||||
call plug#end()
|
||||
PlugInstall
|
||||
q
|
||||
|
||||
execute 'cd' g:plugs['goyo.vim'].dir
|
||||
Assert len(split(system('git log --oneline'), '\n')) > 1, 'not shallow'
|
||||
Assert !filereadable('.git/shallow'), 'not shallow'
|
||||
cd -
|
||||
unlet g:plug_shallow
|
||||
|
||||
Execute (#221 Shallow-clone disabled by tag):
|
||||
call plug#begin(g:temp_plugged)
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
call plug#begin(g:temp_plugged)
|
||||
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
|
||||
call plug#end()
|
||||
Assert !isdirectory(g:plugs['goyo.vim'].dir)
|
||||
PlugInstall
|
||||
Assert isdirectory(g:plugs['goyo.vim'].dir)
|
||||
q
|
||||
|
||||
execute 'cd' g:plugs['goyo.vim'].dir
|
||||
Assert system('git describe --tag') =~ '^1.5.3'
|
||||
Assert len(split(system('git log --oneline'), '\n')) > 1
|
||||
Assert !filereadable('.git/shallow')
|
||||
cd -
|
||||
|
||||
Execute (Commit hash support):
|
||||
" Get goyo back to master
|
||||
call plug#begin(g:temp_plugged)
|
||||
Plug 'junegunn/goyo.vim'
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
|
||||
call plug#begin(g:temp_plugged)
|
||||
Plug 'junegunn/goyo.vim', { 'commit': 'ffffffff' }
|
||||
Plug 'junegunn/vim-emoji', { 'commit': '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
Log getline(1, '$')
|
||||
AssertEqual 'x goyo.vim: error: pathspec ''ffffffff'' did not match any file(s) known to git.', getline(5)
|
||||
AssertEqual 0, stridx(getline(6), '- vim-emoji: HEAD is now at 9db7fcf...')
|
||||
|
||||
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
|
||||
AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
|
||||
|
||||
" Validate error formatting
|
||||
PlugStatus
|
||||
Log getline(1, '$')
|
||||
AssertEqual ['Finished. 1 error(s).',
|
||||
\'[==]',
|
||||
\'',
|
||||
\'x goyo.vim:'], getline(1, 4)
|
||||
Assert getline(5) =~ ' Invalid HEAD (expected: fffffff, actual: [0-9a-f]\{7})'
|
||||
AssertEqual [' PlugUpdate required.',
|
||||
\'- vim-emoji: OK'], getline(6, '$')
|
||||
|
||||
" PlugDiff should show pending updates for vim-emoji
|
||||
PlugDiff
|
||||
Log getline(1, '$')
|
||||
AssertEqual '0 plugin(s) updated. 1 plugin(s) have pending updates.', getline(1)
|
||||
Assert !empty(mapcheck('o'))
|
||||
Assert empty(mapcheck('X'))
|
||||
Assert !empty(mapcheck("\<cr>"))
|
||||
|
||||
" Nor in PlugSnapshot output
|
||||
PlugSnapshot
|
||||
Log getline(1, '$')
|
||||
AssertEqual 8, line('$')
|
||||
q
|
||||
|
||||
Execute (Commit hash support - cleared):
|
||||
call plug#begin(g:temp_plugged)
|
||||
Plug 'junegunn/goyo.vim'
|
||||
Plug 'junegunn/vim-emoji'
|
||||
call plug#end()
|
||||
|
||||
PlugInstall
|
||||
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
|
||||
AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
|
||||
|
||||
PlugUpdate
|
||||
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
|
||||
AssertNotEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
|
||||
q
|
||||
|
||||
Execute (#371 - 'as' option):
|
||||
call plug#begin()
|
||||
Plug 'jg/goyo.vim'
|
||||
Plug 'junegunn/goyo.vim', {'as': 'yogo'}
|
||||
call plug#end()
|
||||
AssertEqual ['goyo.vim', 'yogo'], sort(keys(g:plugs))
|
||||
Log g:plugs
|
||||
Assert g:plugs.yogo.dir =~# '/yogo/$'
|
||||
|
||||
call plug#begin()
|
||||
Plug 'junegunn/goyo.vim', {'as': 'yogo', 'dir': '/tmp/vim-plug-test/gogo'}
|
||||
call plug#end()
|
||||
AssertEqual ['yogo'], sort(keys(g:plugs))
|
||||
AssertEqual '/tmp/vim-plug-test/gogo/', g:plugs.yogo.dir
|
||||
|
||||
Execute (#427 - Tag option with wildcard (requires git 1.9.2 or above)):
|
||||
if str2nr(split(split(system('git --version'))[-1], '\.')[0]) < 2
|
||||
Log 'tag with wildcard requires git 1.9.2 or above'
|
||||
else
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.*' }
|
||||
call plug#end()
|
||||
PlugInstall!
|
||||
Log getline(1, '$')
|
||||
AssertExpect! '- Latest tag for 2.9.* -> 2.9.7 (vim-easy-align)', 1
|
||||
q
|
||||
AssertEqual '2.9.7', GitTag('vim-easy-align')
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user