mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-06 17:14:26 +08:00
Compare commits
111 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
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 ...
|
||||
78
.travis.yml
78
.travis.yml
@@ -1,35 +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
|
||||
- 2.1.0 # Test against python3 installer
|
||||
|
||||
before_script: |
|
||||
sudo apt-get update -y
|
||||
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.2 ]; then
|
||||
sudo apt-get install -y vim-nox
|
||||
sudo ln -s /usr/bin/vim /usr/local/bin/vim
|
||||
else
|
||||
git clone --depth 1 https://github.com/vim/vim
|
||||
cd vim
|
||||
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.3 ]; then
|
||||
sudo apt-get install -y python2.7-dev
|
||||
./configure --with-features=huge --enable-pythoninterp
|
||||
elif [ $(ruby -e 'puts RUBY_VERSION') = 2.1.0 ]; then
|
||||
sudo apt-get install -y python3-dev
|
||||
./configure --with-features=huge --enable-python3interp
|
||||
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 !
|
||||
|
||||
102
README.md
102
README.md
@@ -14,7 +14,7 @@ A minimalist Vim plugin manager.
|
||||
- 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
|
||||
|
||||
@@ -22,25 +22,63 @@ A minimalist Vim plugin manager.
|
||||
[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 `plug#begin()`
|
||||
1. List the plugins with `Plug` commands
|
||||
1. `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'
|
||||
|
||||
@@ -48,18 +86,22 @@ Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
|
||||
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': '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()
|
||||
```
|
||||
|
||||
@@ -74,20 +116,21 @@ 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
|
||||
|
||||
@@ -98,7 +141,8 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
||||
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
|
||||
| `g:plug_shallow` | 1 | Use shallow clone |
|
||||
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
|
||||
| `g:plug_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 (Only applies to the subsequent `Plug` commands) |
|
||||
|
||||
|
||||
### Keybindings
|
||||
|
||||
@@ -140,7 +184,7 @@ Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
|
||||
|
||||
" Code to execute when the plugin is loaded on demand
|
||||
Plug 'Valloric/YouCompleteMe', { 'for': 'cpp' }
|
||||
autocmd! User YouCompleteMe call youcompleteme#Enable()
|
||||
autocmd! User YouCompleteMe if !has('vim_starting') | call youcompleteme#Enable() | endif
|
||||
```
|
||||
|
||||
`for` option is generally not needed as most plugins for specific file types
|
||||
@@ -154,7 +198,7 @@ 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 you need more control, you can pass a reference to a Vim function that
|
||||
@@ -167,7 +211,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
|
||||
|
||||
@@ -195,9 +239,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
|
||||
|
||||
|
||||
@@ -263,3 +263,42 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
|
||||
|
||||
**********************************************************************
|
||||
Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Shallow clone. We should have at least 2 plugins to enable parallel installer.
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
|
||||
|
||||
" Now unshallowed
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.0' }
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (#474: Load ftdetect files in filetypedetect augroup):
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/rust.vim', { 'for': 'rust', 'commit': '115d321d383eb96d438466c56cc871fcc1bd0faa' }
|
||||
call plug#end()
|
||||
PlugInstall!
|
||||
q
|
||||
|
||||
tabnew /tmp/any.rs
|
||||
AssertEqual 'rust', &filetype
|
||||
Log &filetype
|
||||
filetype detect
|
||||
AssertEqual 'rust', &filetype
|
||||
Log &filetype
|
||||
bd
|
||||
|
||||
40
test/run
40
test/run
@@ -18,7 +18,7 @@ clone() {
|
||||
fi
|
||||
}
|
||||
|
||||
clone_repos() {
|
||||
clone_repos() (
|
||||
cd /tmp
|
||||
mkdir -p junegunn vim-scripts jg
|
||||
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
|
||||
@@ -27,15 +27,15 @@ clone_repos() {
|
||||
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
|
||||
|
||||
clone junegunn/vim-emoji jg/vim-emoji
|
||||
cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master
|
||||
)
|
||||
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
make_dirs() {
|
||||
make_dirs() (
|
||||
rm -rf "$PLUG_FIXTURES/$1"
|
||||
mkdir -p "$PLUG_FIXTURES/$1"
|
||||
cd "$PLUG_FIXTURES/$1"
|
||||
@@ -51,9 +51,13 @@ make_dirs() {
|
||||
call add(g:total_order, s:name)
|
||||
EOF
|
||||
done
|
||||
)
|
||||
|
||||
cd "$BASE"
|
||||
}
|
||||
gitinit() (
|
||||
cd "$PLUG_FIXTURES/$1"
|
||||
git init
|
||||
git commit -m 'commit' --allow-empty
|
||||
)
|
||||
|
||||
prepare() {
|
||||
make_dirs xxx/ xxx
|
||||
@@ -62,9 +66,11 @@ prepare() {
|
||||
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
|
||||
@@ -85,13 +91,27 @@ DOC
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
select_vim() {
|
||||
local vim=/usr/bin/vim
|
||||
if [ -n "$DEPS" ] && [ -e "${DEPS}/bin/vim" ]; then
|
||||
vim="${DEPS}/bin/vim"
|
||||
elif [ -e "/usr/local/bin/vim" ]; then
|
||||
vim=/usr/local/bin/vim
|
||||
fi
|
||||
echo $vim
|
||||
}
|
||||
|
||||
clone_repos
|
||||
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 &&
|
||||
$VIM -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
prepare &&
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
$VIM -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
else
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader test.vader'
|
||||
$VIM -Nu /tmp/mini-vimrc -c 'Vader test.vader'
|
||||
fi
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@ Execute (Initialize test environment):
|
||||
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_SRC.org')
|
||||
call writefile(extend(readfile($PLUG_SRC),
|
||||
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_SRC)
|
||||
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
|
||||
@@ -47,11 +48,23 @@ Execute (Initialize test environment):
|
||||
|
||||
function! ReloadPlug()
|
||||
call ResetPlug()
|
||||
source $PLUG_SRC
|
||||
source $PLUG_TMP
|
||||
let &rtp = g:base_rtp
|
||||
endfunction
|
||||
|
||||
source $PLUG_SRC
|
||||
function! GitBranch(repo)
|
||||
return system(printf('cd %s && git rev-parse --abbrev-ref HEAD', g:plugs[a:repo].dir))[:-2]
|
||||
endfunction
|
||||
|
||||
function! GitTag(repo)
|
||||
return system(printf('cd %s && git describe --tags', g:plugs[a:repo].dir))[:-2]
|
||||
endfunction
|
||||
|
||||
function! GitCommit(repo)
|
||||
return system(printf('cd %s && git rev-parse HEAD', g:plugs[a:repo].dir))[:-2]
|
||||
endfunction
|
||||
|
||||
source $PLUG_TMP
|
||||
|
||||
Execute (Print Interpreter Version):
|
||||
redir => out
|
||||
@@ -80,7 +93,7 @@ Execute (Cleanup):
|
||||
silent! delc AssertExpect
|
||||
silent! unmap /
|
||||
silent! unmap ?
|
||||
call system('mv $PLUG_SRC.org $PLUG_SRC')
|
||||
call delete($PLUG_TMP)
|
||||
|
||||
Restore
|
||||
|
||||
|
||||
@@ -83,6 +83,10 @@ Execute (PlugClean before installation):
|
||||
q
|
||||
|
||||
Execute (plug#end() updates &rtp):
|
||||
" Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
|
||||
" Plug 'file:///tmp/jg/vim-emoji'
|
||||
" Plug 'beauty256'
|
||||
" Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
|
||||
call plug#end()
|
||||
Assert len(&rtp) > len(g:base_rtp)
|
||||
AssertEqual g:first_rtp, split(&rtp, ',')[0]
|
||||
@@ -208,6 +212,24 @@ Expect:
|
||||
[==]
|
||||
x seoul256.vim:
|
||||
|
||||
Execute (Corrected the URI but diverged from master):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug 'file:///tmp/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
|
||||
AssertEqual 'Removed.', getline(4)
|
||||
AssertExpect '^- ', 3
|
||||
AssertExpect 'Removed', 1
|
||||
AssertExpect 'Diverged', 1
|
||||
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
||||
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
q
|
||||
@@ -246,7 +269,7 @@ Expect:
|
||||
Execute (PlugClean! to remove vim-emoji):
|
||||
PlugClean!
|
||||
AssertExpect '^- ', 1
|
||||
AssertExpect 'Removed', 1
|
||||
AssertEqual 'Removed.', getline(4)
|
||||
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
||||
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
q
|
||||
@@ -262,12 +285,16 @@ 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 (New commits on remote, PlugUpdate, then PlugDiff):
|
||||
@@ -281,7 +308,7 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
|
||||
|
||||
" Now we have updates
|
||||
normal D
|
||||
AssertEqual 'Last update:', getline(1)
|
||||
AssertEqual '2 plugin(s) updated.', getline(1)
|
||||
|
||||
" Preview commit
|
||||
silent! wincmd P
|
||||
@@ -352,6 +379,75 @@ Execute (Reuse Plug window in another tab):
|
||||
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 ~
|
||||
**********************************************************************
|
||||
@@ -648,6 +744,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
|
||||
@@ -657,11 +756,16 @@ 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()
|
||||
|
||||
" New commits on remote
|
||||
@@ -679,44 +783,68 @@ 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))
|
||||
|
||||
silent PlugUpdate!
|
||||
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)
|
||||
@@ -756,6 +884,50 @@ 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/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
|
||||
|
||||
silent PlugUpdate
|
||||
Log getline(1, '$')
|
||||
q
|
||||
|
||||
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/failed'),
|
||||
\ 'vim-easy-align/failed should not exist'
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/not-failed'),
|
||||
\ 'vim-pseudocl/not-failed should exist'
|
||||
|
||||
**********************************************************************
|
||||
~ Overriding `dir`
|
||||
**********************************************************************
|
||||
@@ -818,12 +990,17 @@ 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:
|
||||
|
||||
@@ -875,6 +1052,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()
|
||||
@@ -1096,17 +1275,22 @@ 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
|
||||
|
||||
**********************************************************************
|
||||
@@ -1166,3 +1350,90 @@ Execute (#221 Shallow-clone disabled by tag):
|
||||
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/gogo'}
|
||||
call plug#end()
|
||||
AssertEqual ['yogo'], sort(keys(g:plugs))
|
||||
AssertEqual '/tmp/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