mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-07 01:24:27 +08:00
Compare commits
74 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 |
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 ...
|
||||
61
README.md
61
README.md
@@ -41,22 +41,30 @@ curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
```
|
||||
|
||||
###### Windows
|
||||
###### Windows (PowerShell)
|
||||
|
||||
```powershell
|
||||
md ~\vimfiles\autoload
|
||||
|
||||
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
(New-Object Net.WebClient).DownloadFile($uri, (Resolve-Path ~\vimfiles\autoload\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:
|
||||
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neovim):
|
||||
|
||||
1. Begin the section with `plug#begin()`
|
||||
1. Begin the section with `call plug#begin()`
|
||||
1. List the plugins with `Plug` commands
|
||||
1. `plug#end()` to add the plugins to `&runtimepath`
|
||||
1. `call plug#end()` to update `&runtimepath` and initialize plugin system
|
||||
|
||||
#### Example
|
||||
|
||||
@@ -64,9 +72,13 @@ Add a vim-plug section to your .vimrc:
|
||||
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'
|
||||
|
||||
@@ -74,12 +86,12 @@ 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' }
|
||||
|
||||
@@ -114,6 +126,7 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
||||
| `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 |
|
||||
@@ -128,7 +141,9 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
||||
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
|
||||
| `g:plug_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_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
|
||||
|
||||
@@ -168,9 +183,9 @@ 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 loaded on demand
|
||||
Plug 'Valloric/YouCompleteMe', { 'for': 'cpp' }
|
||||
autocmd! User YouCompleteMe call youcompleteme#Enable()
|
||||
" 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
|
||||
@@ -187,6 +202,12 @@ Plug 'Shougo/vimproc.vim', { 'do': 'make' }
|
||||
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
|
||||
takes a single argument.
|
||||
|
||||
@@ -225,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
|
||||
|
||||
|
||||
@@ -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('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
|
||||
Log &rtp
|
||||
@@ -35,7 +35,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||
|
||||
" Cleared on command
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
@@ -52,7 +52,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||
|
||||
" Cleared on FileType
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
|
||||
call plug#end()
|
||||
|
||||
@@ -78,13 +78,13 @@ Execute (#131 Syntax error):
|
||||
**********************************************************************
|
||||
Execute (#139-1 Using new remote branch):
|
||||
" Make sure to remove the clone
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Install master branch
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug expand('file:////tmp/new-branch')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
|
||||
@@ -95,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 /tmp/new-branch && git checkout -b new &&'
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout -b new &&'
|
||||
\. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
|
||||
\. 'git commit -m second')
|
||||
|
||||
" We're setting up two plugins so that parallel installer is used
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug expand('file:////tmp/new-branch'), { 'branch': 'new' }
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
@@ -125,14 +125,14 @@ Expect:
|
||||
|
||||
Execute (#139-2 Using yet another new remote branch):
|
||||
" Create another branch on origin
|
||||
call system('cd /tmp/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
|
||||
\. 'git checkout -b brand-new &&'
|
||||
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
|
||||
\. 'git commit -m third')
|
||||
|
||||
" Test Vim installer here
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug expand('file:////tmp/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
|
||||
@@ -154,19 +154,19 @@ Expect:
|
||||
|
||||
Execute (#139-3 Should fail when not possible to fast-forward):
|
||||
" Commit on cloned repo
|
||||
call system('cd /tmp/plugged/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/vim-plug-test/plugged/new-branch && git checkout master &&'
|
||||
\. 'touch foobar && git add foobar && git commit -m foobar')
|
||||
|
||||
" Different commit on remote
|
||||
call system('cd /tmp/new-branch && git checkout master &&'
|
||||
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
|
||||
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
|
||||
|
||||
for multi in [0, 1]
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
if multi
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
endif
|
||||
Plug expand('file:////tmp/new-branch')
|
||||
Plug expand('file:////tmp/vim-plug-test/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
@@ -210,7 +210,7 @@ Execute (#159: shell=/bin/tcsh):
|
||||
let org = &shell
|
||||
try
|
||||
set shell=/bin/tcsh
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
|
||||
@@ -224,7 +224,7 @@ Execute (#159: shell=/bin/tcsh):
|
||||
|
||||
**********************************************************************
|
||||
Execute (#154: Spaces in &rtp should not be escaped):
|
||||
call plug#begin('/tmp/plug it')
|
||||
call plug#begin('/tmp/vim-plug-test/plug it')
|
||||
Plug 'seoul256 vim'
|
||||
call plug#end()
|
||||
Log &rtp
|
||||
@@ -232,7 +232,7 @@ Execute (#154: Spaces in &rtp should not be escaped):
|
||||
|
||||
**********************************************************************
|
||||
Execute (#184: Duplicate entries in &rtp):
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'plugin1'
|
||||
\| Plug 'plugin0'
|
||||
|
||||
@@ -250,7 +250,7 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
||||
silent! delc EasyAlign
|
||||
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
@@ -259,19 +259,19 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
||||
%EasyAlign=
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
|
||||
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
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#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/plugged')
|
||||
call plug#begin('/tmp/vim-plug-test/plugged')
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
@@ -279,10 +279,54 @@ Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
|
||||
|
||||
" Now unshallowed
|
||||
call plug#begin('/tmp/plugged')
|
||||
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
|
||||
|
||||
25
test/run
25
test/run
@@ -6,9 +6,12 @@ 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 > /tmp/mini-vimrc << VIMRC
|
||||
set rtp+=/tmp/junegunn/vader.vim
|
||||
cat > $TEMP/mini-vimrc << VIMRC
|
||||
set rtp+=$TEMP/junegunn/vader.vim
|
||||
set shell=/bin/bash
|
||||
VIMRC
|
||||
|
||||
@@ -19,7 +22,7 @@ clone() {
|
||||
}
|
||||
|
||||
clone_repos() (
|
||||
cd /tmp
|
||||
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
|
||||
@@ -27,6 +30,8 @@ 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
|
||||
@@ -75,10 +80,11 @@ DOC
|
||||
|
||||
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
||||
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
|
||||
echo "echomsg 'ftplugin'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
|
||||
|
||||
rm -rf /tmp/new-branch
|
||||
cd /tmp
|
||||
rm -rf $TEMP/new-branch
|
||||
cd $TEMP
|
||||
git init new-branch
|
||||
cd new-branch
|
||||
mkdir plugin
|
||||
@@ -102,13 +108,14 @@ select_vim() {
|
||||
clone_repos
|
||||
prepare
|
||||
|
||||
git --version
|
||||
VIM=$(select_vim)
|
||||
echo "Selected Vim: $VIM"
|
||||
if [ "$1" = '!' ]; then
|
||||
$VIM -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
prepare &&
|
||||
$VIM -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
else
|
||||
$VIM -Nu /tmp/mini-vimrc -c 'Vader test.vader'
|
||||
$VIM -Nu $TEMP/mini-vimrc -c 'Vader test.vader'
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ Execute (Initialize test environment):
|
||||
Save &rtp, g:plugs, g:plug_home, g:plug_window
|
||||
unlet! g:plugs g:plug_home g:plug_window
|
||||
|
||||
let g:plug_url_format = 'file:///tmp/%s'
|
||||
let g:plug_url_format = 'file:///tmp/vim-plug-test/%s'
|
||||
let g:base_rtp = &rtp
|
||||
let g:first_rtp = split(&rtp, ',')[0]
|
||||
let g:last_rtp = split(&rtp, ',')[-1]
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ Execute (Subsequent plug#begin() calls will reuse 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 '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
|
||||
|
||||
@@ -43,7 +43,7 @@ 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 '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
|
||||
|
||||
@@ -51,14 +51,14 @@ Execute (Test Plug command):
|
||||
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([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)
|
||||
@@ -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/vim-plug-test/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]
|
||||
@@ -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
|
||||
@@ -277,7 +300,7 @@ Execute (PlugDiff - 'No updates.'):
|
||||
Execute (New commits on remote, PlugUpdate, then PlugDiff):
|
||||
for repo in ['seoul256.vim', 'vim-emoji']
|
||||
for _ in range(2)
|
||||
call system(printf('cd /tmp/junegunn/%s && git commit --allow-empty -m "update"', repo))
|
||||
call system(printf('cd /tmp/vim-plug-test/junegunn/%s && git commit --allow-empty -m "update"', repo))
|
||||
endfor
|
||||
endfor
|
||||
unlet repo
|
||||
@@ -342,6 +365,22 @@ Execute (New commits on remote, 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
|
||||
@@ -573,7 +612,7 @@ Execute (PlugStatus should point out that the plugin is missing):
|
||||
Execute (Deploy unmanaged plugin):
|
||||
Assert !exists(':FZF'), ':FZF command should not exist'
|
||||
call RmRf(fzf)
|
||||
Log system(printf('cp -r "/tmp/fzf" "%s"', fzf))
|
||||
Log system(printf('cp -r "/tmp/vim-plug-test/fzf" "%s"', fzf))
|
||||
|
||||
Execute (PlugUpdate still should not care):
|
||||
PlugUpdate
|
||||
@@ -721,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
|
||||
@@ -730,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()
|
||||
|
||||
" New commits on remote
|
||||
call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
|
||||
|
||||
silent PlugUpdate
|
||||
Log getline(1, '$')
|
||||
@@ -752,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)
|
||||
@@ -801,7 +877,7 @@ Execute (Using Funcref):
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
|
||||
call plug#end()
|
||||
|
||||
call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd /tmp/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
|
||||
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
|
||||
call RmRf(g:plugs['vim-pseudocl'].dir)
|
||||
|
||||
@@ -861,8 +937,8 @@ Execute (Should not run when failed to update):
|
||||
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"')
|
||||
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, '$')
|
||||
@@ -873,18 +949,31 @@ Execute (Should not run when failed to update):
|
||||
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 RmRf('/tmp/easy-align')
|
||||
call RmRf('/tmp/vim-plug-test/easy-align')
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/easy-align' }
|
||||
Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/vim-plug-test/easy-align' }
|
||||
call plug#end()
|
||||
AssertEqual '/tmp/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)
|
||||
@@ -935,12 +1024,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/syntax', 'xxx/after/syntax', '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:
|
||||
|
||||
@@ -992,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()
|
||||
@@ -1193,11 +1289,11 @@ 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
|
||||
|
||||
@@ -1289,15 +1385,20 @@ Execute (#221 Shallow-clone disabled by tag):
|
||||
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 Checking out fffffff of goyo.vim ... Error',
|
||||
\' error: pathspec ''ffffffff'' did not match any file(s) known to git.',
|
||||
\'- Checking out 9db7fcf of vim-emoji ... OK'], getline(5, 7)
|
||||
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
|
||||
@@ -1341,3 +1442,32 @@ Execute (Commit hash support - cleared):
|
||||
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