mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-07 01:24:27 +08:00
Compare commits
96 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99f6f36b69 | ||
|
|
3f82808bea | ||
|
|
7474edf13f | ||
|
|
25b0fb7583 | ||
|
|
a868ee4c11 | ||
|
|
49851436ff | ||
|
|
2f9a94e8c0 | ||
|
|
ab3bd3b17c | ||
|
|
3572ffde79 | ||
|
|
18c8b54793 | ||
|
|
1752de5b7c | ||
|
|
2f3225fc60 | ||
|
|
1022acad0b | ||
|
|
68c7fbbf9d | ||
|
|
da24f714e0 | ||
|
|
c1bbbaf3ef | ||
|
|
f7ebba7b9e | ||
|
|
6272f5e289 | ||
|
|
f43067c7a5 | ||
|
|
e6cba28997 | ||
|
|
f1b8832a13 | ||
|
|
d0c94a9b08 | ||
|
|
3a2e406cd0 | ||
|
|
84cdf61730 | ||
|
|
0aeea1db08 | ||
|
|
8289477d18 | ||
|
|
19b12e2216 | ||
|
|
4c9ebe9c31 | ||
|
|
74dcd13575 | ||
|
|
518f20652f | ||
|
|
665ec057d7 | ||
|
|
bc212dca77 | ||
|
|
8da7b50fb2 | ||
|
|
4ae2e879e1 | ||
|
|
93628b1c3d | ||
|
|
01e126469b | ||
|
|
a7477f04b7 | ||
|
|
0fdb56ba72 | ||
|
|
d89949f16c | ||
|
|
19b8221c14 | ||
|
|
336fadd236 | ||
|
|
a216e38a59 | ||
|
|
d930594686 | ||
|
|
f4261711ae | ||
|
|
61b77bc8e8 | ||
|
|
fe7c7e7b40 | ||
|
|
25afdf138c | ||
|
|
b36fd34da0 | ||
|
|
7e55690f19 | ||
|
|
30ef53d832 | ||
|
|
f58d090bb2 | ||
|
|
eeef77e9c8 | ||
|
|
6af2cd8946 | ||
|
|
878cdd5309 | ||
|
|
9bb2da53a0 | ||
|
|
58c06ed77e | ||
|
|
2e691c6feb | ||
|
|
a18087610a | ||
|
|
276106d987 | ||
|
|
d499fc311a | ||
|
|
c4b4aa8f07 | ||
|
|
d690f8d576 | ||
|
|
8738341ad0 | ||
|
|
5ab2024fbb | ||
|
|
300176ba9f | ||
|
|
da7d6bd58b | ||
|
|
b651558c63 | ||
|
|
2d815ad2f0 | ||
|
|
3af4079179 | ||
|
|
e6a594f1ad | ||
|
|
e741d02ad0 | ||
|
|
b2208640d4 | ||
|
|
aa49c38586 | ||
|
|
b6b10ac17e | ||
|
|
706f7e00ea | ||
|
|
6ff1031339 | ||
|
|
0936877399 | ||
|
|
d956e16f15 | ||
|
|
f98c8456fa | ||
|
|
5b2c03d3a8 | ||
|
|
0b31be49cf | ||
|
|
74fa6ab9df | ||
|
|
0d7e20c984 | ||
|
|
e2714fb56e | ||
|
|
3b83a22ea4 | ||
|
|
cd418369bc | ||
|
|
279a334c8b | ||
|
|
9132e9d50d | ||
|
|
3323163e04 | ||
|
|
e4671eaf9e | ||
|
|
9afa356fb3 | ||
|
|
e04f696682 | ||
|
|
4cb5fd04a6 | ||
|
|
c16743e8fc | ||
|
|
46a6e8441f | ||
|
|
466d1839b3 |
@@ -1,4 +1,7 @@
|
||||
language: vim
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 2.0.0
|
||||
|
||||
before_script: |
|
||||
hg clone https://code.google.com/p/vim/
|
||||
|
||||
237
README.md
237
README.md
@@ -1,35 +1,32 @@
|
||||

|
||||

|
||||

|
||||
|
||||
A single-file Vim plugin manager.
|
||||
A minimalist Vim plugin manager.
|
||||
|
||||
Somewhere between [Pathogen](https://github.com/tpope/vim-pathogen) and
|
||||
[Vundle](https://github.com/gmarik/vundle), but with faster parallel installer.
|
||||
|
||||

|
||||

|
||||
|
||||
### Pros.
|
||||
|
||||
- Easier to setup
|
||||
- Parallel installation/update (requires
|
||||
[+ruby](http://junegunn.kr/2013/09/installing-vim-with-ruby-support/))
|
||||
- Smallest possible feature set
|
||||
- Branch/tag support
|
||||
- On-demand loading
|
||||
- Dependency resolution using `Plugfile` (experimental)
|
||||
|
||||
### Cons.
|
||||
|
||||
- Everything else
|
||||
- Easier to setup: Single file. No boilerplate code required.
|
||||
- Easier to use: Concise, intuitive syntax
|
||||
- [Super-fast](https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif)
|
||||
parallel installation/update (requires
|
||||
[+ruby](https://github.com/junegunn/vim-plug/wiki/ruby))
|
||||
- On-demand loading to achieve
|
||||
[fast startup time](http://junegunn.kr/images/vim-startup-time.png)
|
||||
- Post-update hooks
|
||||
- Can choose a specific branch or tag for each plugin
|
||||
- Support for externally managed plugins
|
||||
|
||||
### Usage
|
||||
|
||||
[Download plug.vim](https://raw.github.com/junegunn/vim-plug/master/plug.vim)
|
||||
[Download plug.vim](https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim)
|
||||
and put it in ~/.vim/autoload
|
||||
|
||||
```sh
|
||||
mkdir -p ~/.vim/autoload
|
||||
curl -fLo ~/.vim/autoload/plug.vim https://raw.github.com/junegunn/vim-plug/master/plug.vim
|
||||
curl -fLo ~/.vim/autoload/plug.vim \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
```
|
||||
|
||||
Edit your .vimrc
|
||||
@@ -37,51 +34,74 @@ Edit your .vimrc
|
||||
```vim
|
||||
call plug#begin('~/.vim/plugged')
|
||||
|
||||
" Make sure you use single quotes
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
|
||||
" On-demand loading
|
||||
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
|
||||
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
|
||||
" Plug 'user/repo1', 'branch_or_tag'
|
||||
" Plug 'user/repo2', { 'rtp': 'vim/plugin/dir', 'branch': 'devel' }
|
||||
" Plug 'git@github.com:junegunn/vim-github-dashboard.git'
|
||||
" ...
|
||||
|
||||
" Using git URL
|
||||
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
|
||||
|
||||
" Plugin options
|
||||
Plug 'nsf/gocode', { 'tag': 'go.weekly.2012-03-13', 'rtp': 'vim' }
|
||||
|
||||
" Plugin outside ~/.vim/plugged with post-update hook
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
|
||||
|
||||
" Unmanaged plugin (manually installed and updated)
|
||||
Plug '~/my-prototype-plugin'
|
||||
|
||||
call plug#end()
|
||||
```
|
||||
|
||||
Reload .vimrc and `:PlugInstall` to install plugins.
|
||||
|
||||
### Plugin directory
|
||||
|
||||
If you omit the path argument to `plug#begin()`, plugins are installed in
|
||||
`plugged` directory under the first path in `runtimepath` at the point when
|
||||
`plug#begin()` is called. This is usually `~/.vim/plugged` (or
|
||||
`$HOME/vimfiles/plugged` on Windows) given that you didn't touch runtimepath
|
||||
before the call.
|
||||
|
||||
### Commands
|
||||
|
||||
| Command | Description |
|
||||
| --------------------------------- | ------------------------------------------------------------------ |
|
||||
| PlugInstall [name ...] [#threads] | Install plugins |
|
||||
| PlugUpdate [name ...] [#threads] | Install or update plugins |
|
||||
| PlugClean[!] | Remove unused directories (bang version will clean without prompt) |
|
||||
| PlugUpgrade | Upgrade vim-plug itself |
|
||||
| PlugStatus | Check the status of plugins |
|
||||
| PlugDiff | See the updated changes from the previous PlugUpdate |
|
||||
| Command | Description |
|
||||
| ----------------------------------- | ------------------------------------------------------------------ |
|
||||
| `PlugInstall [name ...] [#threads]` | Install plugins |
|
||||
| `PlugUpdate [name ...] [#threads]` | Install or update plugins |
|
||||
| `PlugClean[!]` | Remove unused directories (bang version will clean without prompt) |
|
||||
| `PlugUpgrade` | Upgrade vim-plug itself |
|
||||
| `PlugStatus` | Check the status of plugins |
|
||||
| `PlugDiff` | See the updated changes from the previous PlugUpdate |
|
||||
|
||||
### Options for parallel installer
|
||||
### `Plug` options
|
||||
|
||||
| Flag | Default | Description |
|
||||
| ---------------- | ------- | --------------------------------- |
|
||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||
| `g:plug_timeout` | 60 | Time limit of each task in seconds |
|
||||
| Option | Description |
|
||||
| -------------- | -------------------------------------------------------------------- |
|
||||
| `branch`/`tag` | Branch or tag of the repository to use |
|
||||
| `rtp` | Subdirectory that contains Vim plugin |
|
||||
| `dir` | Custom directory for the plugin |
|
||||
| `do` | Post-update hook (string or funcref) |
|
||||
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
||||
| `for` | On-demand loading: File types |
|
||||
| `frozen` | Do not install/update plugin unless explicitly given as the argument |
|
||||
|
||||
### Global options
|
||||
|
||||
| Flag | Default | Description |
|
||||
| ------------------- | --------------------------------- | ------------------------------------ |
|
||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||
| `g:plug_timeout` | 60 | Time limit of each task in seconds |
|
||||
| `g:plug_retries` | 2 | Number of retries in case of timeout |
|
||||
| `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 |
|
||||
|
||||
### Keybindings
|
||||
|
||||
- `D` - `PlugDiff`
|
||||
- `S` - `PlugStatus`
|
||||
- `R` - Retry failed update or installation tasks
|
||||
- `q` - Close the window
|
||||
- `:PlugStatus`
|
||||
- `L` - Load plugin
|
||||
- `:PlugDiff`
|
||||
- `X` - Revert the update
|
||||
|
||||
### Example: A small [sensible](https://github.com/tpope/vim-sensible) Vim configuration
|
||||
|
||||
@@ -103,87 +123,72 @@ Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
|
||||
" Loaded when clojure file is opened
|
||||
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
|
||||
|
||||
" Multiple file types
|
||||
Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
|
||||
|
||||
" On-demand loading on both conditions
|
||||
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
|
||||
```
|
||||
|
||||
### Dependency resolution
|
||||
### Post-update hooks
|
||||
|
||||
See [Dependency
|
||||
Resolution](https://github.com/junegunn/vim-plug/wiki/Dependency-Resolution).
|
||||
There are some plugins that require extra steps after installation or update.
|
||||
In that case, use `do` option to describe the task to be performed.
|
||||
|
||||
```vim
|
||||
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' }
|
||||
```
|
||||
|
||||
If you need more control, you can pass a reference to a Vim function that
|
||||
takes a single argument.
|
||||
|
||||
```vim
|
||||
function! BuildYCM(info)
|
||||
" info is a dictionary with 3 fields
|
||||
" - name: name of the plugin
|
||||
" - status: 'installed', 'updated', or 'unchanged'
|
||||
" - force: set on PlugInstall! or PlugUpdate!
|
||||
if a:info.status == 'installed' || a:info.force
|
||||
!./install.sh
|
||||
endif
|
||||
endfunction
|
||||
|
||||
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
|
||||
```
|
||||
|
||||
Both forms of post-update hook are executed inside the directory of the plugin
|
||||
and only run when the repository has changed, but you can force it to run
|
||||
unconditionally with the bang-versions of the commands: `PlugInstall!` and
|
||||
`PlugUpdate!`.
|
||||
|
||||
Make sure to escape BARs and double-quotes when you write `do` option inline
|
||||
as they are mistakenly recognized as command separator or the start of the
|
||||
trailing comment.
|
||||
|
||||
```vim
|
||||
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
|
||||
```
|
||||
|
||||
But you can avoid the escaping if you extract the inline specification using a
|
||||
variable (or any Vimscript expression) as follows:
|
||||
|
||||
```vim
|
||||
let g:fzf_install = 'yes | ./install'
|
||||
Plug 'junegunn/fzf', { 'do': g:fzf_install }
|
||||
```
|
||||
|
||||
### FAQ/Troubleshooting
|
||||
|
||||
See [FAQ/Troubleshooting](https://github.com/junegunn/vim-plug/wiki/faq).
|
||||
|
||||
### Articles
|
||||
|
||||
- [Writing my own Vim plugin manager](http://junegunn.kr/2013/09/writing-my-own-vim-plugin-manager)
|
||||
- [Thoughts on Vim plugin dependency](http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency)
|
||||
- [Vim plugins and startup time](http://junegunn.kr/2014/07/vim-plugins-and-startup-time)
|
||||
- ~~[Thoughts on Vim plugin dependency](http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency)~~
|
||||
- *Support for Plugfile has been removed since 0.5.0*
|
||||
|
||||
### FAQ/Troubleshooting
|
||||
### License
|
||||
|
||||
#### Plugins are not installed/updated in parallel
|
||||
|
||||
Your Vim does not support Ruby interface. `:echo has('ruby')` should print 1.
|
||||
In order to setup Vim with Ruby support, you may refer to [this
|
||||
article](http://junegunn.kr/2013/09/installing-vim-with-ruby-support).
|
||||
|
||||
#### *Vim: Caught deadly signal SEGV*
|
||||
|
||||
If your Vim crashes with the above message, first check if its Ruby interface is
|
||||
working correctly with the following command:
|
||||
|
||||
```vim
|
||||
:ruby puts RUBY_VERSION
|
||||
```
|
||||
|
||||
If Vim crashes even with this command, it is likely that Ruby interface is
|
||||
broken, and you have to rebuild Vim with a working version of Ruby.
|
||||
(`brew remove vim && brew install vim` or `./configure && make ...`)
|
||||
|
||||
If you're on OS X, one possibility is that you had installed Vim with
|
||||
[Homebrew](http://brew.sh/) while using a Ruby installed with
|
||||
[RVM](http://rvm.io/) or [rbenv](https://github.com/sstephenson/rbenv) and later
|
||||
removed that version of Ruby.
|
||||
|
||||
[Please let me know](https://github.com/junegunn/vim-plug/issues) if you can't
|
||||
resolve the problem. In the meantime, you can set `g:plug_threads` to 1, so that
|
||||
Ruby installer is not used at all.
|
||||
|
||||
#### Errors on fish shell
|
||||
|
||||
If vim-plug doesn't work correctly on fish shell, you might need to add `set
|
||||
shell=/bin/sh` to your .vimrc.
|
||||
|
||||
Refer to the following links for the details:
|
||||
- http://badsimplicity.com/vim-fish-e484-cant-open-file-tmpvrdnvqe0-error/
|
||||
- https://github.com/junegunn/vim-plug/issues/12
|
||||
|
||||
#### Freezing plugin version with commit hash
|
||||
|
||||
vim-plug does not allow you to freeze the version of a plugin with its commit
|
||||
hash. This is by design. I don't believe a user of a plugin should be looking
|
||||
at its individual commits. Instead, one should be choosing the right version
|
||||
using release tags or versioned branches (e.g. 1.2.3, stable, devel, etc.)
|
||||
|
||||
```vim
|
||||
Plug 'junegunn/vim-easy-align', '2.9.2'
|
||||
```
|
||||
|
||||
If the repository doesn't come with such tags or branches, you should think of
|
||||
it as "unstable" or "in development", and always use its latest revision.
|
||||
|
||||
If you really must choose a certain untagged revision, consider forking the
|
||||
repository.
|
||||
|
||||
### Regarding feature request
|
||||
|
||||
You may submit a request for a new feature by [creating an
|
||||
issue](https://github.com/junegunn/vim-plug/issues). However, please be minded
|
||||
that this is an opinionated software and I want to keep the feature set as small
|
||||
as possible. So I may not agree with you on the necessity of the suggested
|
||||
feature. If that happens, I suggest the following options.
|
||||
|
||||
1. Check out [Vundle](https://github.com/gmarik/vundle) or
|
||||
[NeoBundle](https://github.com/Shougo/neobundle.vim).
|
||||
They offer broader feature sets.
|
||||
2. Create a fork of this project and let it be your own plugin manager.
|
||||
There's no need for us to have a single canonical branch.
|
||||
MIT
|
||||
|
||||
|
||||
34
test/run
34
test/run
@@ -9,13 +9,45 @@ if [ ! -d vader.vim ]; then
|
||||
git clone https://github.com/junegunn/vader.vim.git
|
||||
fi
|
||||
|
||||
rm -rf fzf
|
||||
if [ ! -d fzf-staged ]; then
|
||||
git clone https://github.com/junegunn/fzf.git fzf-staged
|
||||
fi
|
||||
|
||||
make_dirs() {
|
||||
mkdir -p "$1"
|
||||
cd "$1"
|
||||
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
||||
for d in *; do
|
||||
cat > $d/xxx.vim << EOF
|
||||
" echom expand('<sfile>')
|
||||
let g:$2 = get(g:, '$2', [])
|
||||
call add(g:$2, '${1:4}/$d')
|
||||
EOF
|
||||
done
|
||||
cd - > /dev/null
|
||||
}
|
||||
|
||||
make_dirs xxx/ xxx
|
||||
make_dirs xxx/after xxx
|
||||
mkdir xxx/doc
|
||||
cat > xxx/doc/xxx.txt << DOC
|
||||
hello *xxx*
|
||||
DOC
|
||||
|
||||
make_dirs yyy/ yyy
|
||||
make_dirs z1/ z1
|
||||
make_dirs z2/ z2
|
||||
|
||||
cat > /tmp/mini-vimrc << VIMRC
|
||||
set rtp+=vader.vim
|
||||
set shell=/bin/bash
|
||||
source $PLUG_SRC
|
||||
VIMRC
|
||||
|
||||
if [ "$1" = '!' ]; then
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null &&
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! workflow.vader' > /dev/null
|
||||
else
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
Execute (Initialize test environment):
|
||||
Save &rtp, g:plugs, g:plug_home, $MYVIMRC
|
||||
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')
|
||||
@@ -8,8 +11,7 @@ Execute (Initialize test environment):
|
||||
execute 'set rtp^='.plug
|
||||
let basertp = &rtp
|
||||
|
||||
unlet! g:plugs
|
||||
unlet! g:plug_home
|
||||
unlet! g:plugs g:plug_home g:plug_window
|
||||
|
||||
set t_Co=256
|
||||
colo default
|
||||
@@ -24,18 +26,23 @@ Execute (Initialize test environment):
|
||||
g/^$/d
|
||||
endfunction
|
||||
|
||||
let g:vimrc_reloaded = 0
|
||||
let vimrc = tempname()
|
||||
call writefile(['let g:vimrc_reloaded += 1'], vimrc)
|
||||
let $MYVIMRC = vimrc
|
||||
function! AssertExpect(bang, pat, cnt)
|
||||
let op = a:bang ? '==' : '=~'
|
||||
AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
|
||||
endfunction
|
||||
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
|
||||
|
||||
Execute (Print Ruby version):
|
||||
redir => out
|
||||
silent ruby puts RUBY_VERSION
|
||||
redir END
|
||||
Log substitute(out, '\n', '', 'g')
|
||||
|
||||
Execute (plug#end() before plug#begin() should fail):
|
||||
try
|
||||
call plug#end()
|
||||
Assert 0, 'should not reach here'
|
||||
catch
|
||||
Assert stridx(v:exception, 'Call plug#begin() first') >= 0
|
||||
endtry
|
||||
redir => out
|
||||
AssertEqual 0, plug#end()
|
||||
redir END
|
||||
Assert stridx(out, 'Call plug#begin() first') >= 0
|
||||
|
||||
Execute (plug#begin() without path argument):
|
||||
call plug#begin()
|
||||
@@ -45,12 +52,10 @@ Execute (plug#begin() without path argument):
|
||||
Execute (plug#begin() without path argument with empty &rtp):
|
||||
let save_rtp = &rtp
|
||||
set rtp=
|
||||
try
|
||||
call plug#begin()
|
||||
Assert 0, 'should not reach here'
|
||||
catch
|
||||
Assert stridx(v:exception, 'Unable to determine plug home') >= 0, 'Got: '.v:exception
|
||||
endtry
|
||||
redir => out
|
||||
AssertEqual 0, plug#begin()
|
||||
redir END
|
||||
Assert stridx(out, 'Unable to determine plug home') >= 0
|
||||
let &rtp = save_rtp
|
||||
|
||||
Execute (plug#begin(path)):
|
||||
@@ -68,15 +73,21 @@ Execute (Subsequent plug#begin() calls will reuse g:plug_home):
|
||||
|
||||
Execute (Test Plug command):
|
||||
" Git repo with branch
|
||||
Plug 'junegunn/seoul256.vim', 'no-t_co'
|
||||
AssertEqual 'https://git:@github.com/junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
|
||||
Plug 'junegunn/seoul256.vim', 'yes-t_co'
|
||||
AssertEqual 'https://git::@github.com/junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
|
||||
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
|
||||
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
|
||||
|
||||
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
|
||||
AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
|
||||
|
||||
" Git repo with tag
|
||||
Plug 'junegunn/goyo.vim', '1.5.3'
|
||||
AssertEqual 'https://git:@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
|
||||
Plug 'junegunn/goyo.vim', '1.5.2'
|
||||
AssertEqual 'https://git::@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
|
||||
AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
|
||||
AssertEqual '1.5.2', g:plugs['goyo.vim'].branch
|
||||
|
||||
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
|
||||
AssertEqual '1.5.3', g:plugs['goyo.vim'].branch
|
||||
|
||||
" Git URI
|
||||
@@ -87,7 +98,7 @@ Execute (Test Plug command):
|
||||
|
||||
" vim-scripts/
|
||||
Plug 'beauty256'
|
||||
AssertEqual 'https://git:@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
|
||||
AssertEqual 'https://git::@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
|
||||
AssertEqual 'master', g:plugs.beauty256.branch
|
||||
|
||||
AssertEqual 4, len(g:plugs)
|
||||
@@ -103,24 +114,25 @@ Execute (Plug command with dictionary option):
|
||||
|
||||
Execute (PlugStatus before installation):
|
||||
PlugStatus
|
||||
AssertEqual 4, len(filter(getline(1, line('$')), 'v:val =~ "Not found"'))
|
||||
AssertExpect 'Not found', 4
|
||||
q
|
||||
|
||||
Execute (PlugClean before installation):
|
||||
PlugClean
|
||||
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Already clean"'))
|
||||
AssertExpect 'Already clean', 1
|
||||
q
|
||||
|
||||
Execute (plug#end() updates &rtp):
|
||||
call plug#end()
|
||||
Assert len(&rtp) > len(basertp)
|
||||
AssertEqual first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
||||
|
||||
Execute (Yet, plugins are not available):
|
||||
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
|
||||
Execute (PlugInstall):
|
||||
PlugInstall
|
||||
AssertEqual 1, g:vimrc_reloaded
|
||||
q
|
||||
|
||||
Execute (Plugin available after installation):
|
||||
@@ -128,12 +140,13 @@ Execute (Plugin available after installation):
|
||||
|
||||
Execute (PlugClean after installation):
|
||||
PlugClean
|
||||
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Already clean"'))
|
||||
AssertExpect 'Already clean', 1
|
||||
q
|
||||
|
||||
Execute (PlugStatus after installation):
|
||||
PlugStatus
|
||||
AssertEqual 4, len(filter(getline(1, line('$')), 'v:val =~ "OK"'))
|
||||
Log getline(1, '$')
|
||||
AssertExpect 'OK', 4
|
||||
q
|
||||
|
||||
Execute (Change tag of goyo.vim):
|
||||
@@ -153,7 +166,6 @@ Expect:
|
||||
Execute (PlugUpdate to set the right branch):
|
||||
PlugUpdate
|
||||
call PlugStatusSorted()
|
||||
AssertEqual 2, g:vimrc_reloaded
|
||||
|
||||
Expect:
|
||||
- goyo.vim: OK
|
||||
@@ -186,8 +198,8 @@ Execute (PlugStatus):
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
Expected: https://git:@github.com/junegunn.choi/seoul256.vim.git
|
||||
Invalid URI: https://git:@github.com/junegunn/seoul256.vim.git
|
||||
Expected: https://git::@github.com/junegunn.choi/seoul256.vim.git
|
||||
Invalid URI: https://git::@github.com/junegunn/seoul256.vim.git
|
||||
PlugClean required.
|
||||
- vim-emoji: OK
|
||||
Finished. 1 error(s).
|
||||
@@ -204,8 +216,8 @@ Expect:
|
||||
Execute (PlugClean! to remove seoul256.vim):
|
||||
PlugClean!
|
||||
" Three removed, emoji left
|
||||
AssertEqual 3, len(filter(getline(1, line('$')), 'v:val =~ "^- "'))
|
||||
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"'))
|
||||
AssertExpect '^- ', 3
|
||||
AssertExpect 'Removed', 1
|
||||
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
||||
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
q
|
||||
@@ -220,7 +232,7 @@ Execute (PlugStatus):
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
Expected: https://git:@github.com/junegunn/vim-emoji.git
|
||||
Expected: https://git::@github.com/junegunn/vim-emoji.git
|
||||
Invalid URI: https://bitbucket.org/junegunn/vim-emoji.git
|
||||
Not found. Try PlugInstall.
|
||||
PlugClean required.
|
||||
@@ -231,24 +243,22 @@ Expect:
|
||||
|
||||
Execute (PlugClean! to remove vim-emoji):
|
||||
PlugClean!
|
||||
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "^- "'))
|
||||
AssertEqual 1, len(filter(getline(1, line('$')), 'v:val =~ "Removed"'))
|
||||
AssertExpect '^- ', 1
|
||||
AssertExpect 'Removed', 1
|
||||
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
|
||||
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
|
||||
q
|
||||
|
||||
Execute (PlugUpdate to install both again):
|
||||
PlugUpdate
|
||||
AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "^- [^:]*:"'))
|
||||
AssertEqual 3, g:vimrc_reloaded
|
||||
AssertExpect '^- [^:]*:', 2
|
||||
Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found'
|
||||
Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found'
|
||||
q
|
||||
|
||||
Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
|
||||
PlugUpdate
|
||||
AssertEqual 2, len(filter(getline(1, line('$')), 'v:val =~ "Already up-to-date"'))
|
||||
AssertEqual 4, g:vimrc_reloaded
|
||||
AssertExpect 'Already up-to-date', 2
|
||||
normal D
|
||||
AssertEqual 'No updates.', getline(1)
|
||||
q
|
||||
@@ -296,6 +306,13 @@ Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
|
||||
AssertEqual lnum, line('.')
|
||||
AssertEqual 3, col('.')
|
||||
|
||||
" X key to revert the update
|
||||
AssertExpect '^- ', 2
|
||||
execute "normal Xn\<cr>"
|
||||
AssertExpect '^- ', 2
|
||||
execute "normal Xy\<cr>"
|
||||
AssertExpect '^- ', 1
|
||||
|
||||
" q will close preview window as well
|
||||
normal q
|
||||
|
||||
@@ -306,6 +323,7 @@ Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
|
||||
" q should not close preview window if it's already open
|
||||
pedit
|
||||
PlugDiff
|
||||
AssertExpect '^- ', 1
|
||||
execute "normal ]]j\<cr>"
|
||||
normal q
|
||||
|
||||
@@ -319,8 +337,8 @@ Execute (Plug window in a new tab):
|
||||
set buftype=nofile
|
||||
PlugUpdate
|
||||
normal D
|
||||
AssertEqual 'No updates.', getline(1)
|
||||
q
|
||||
AssertExpect '^- ', 1
|
||||
normal q
|
||||
AssertEqual 'new-tab', expand('%')
|
||||
q
|
||||
q
|
||||
@@ -343,7 +361,8 @@ Execute (Trying to execute on-demand commands when plugin is not installed):
|
||||
|
||||
Execute (New set of plugins):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-fnr' " Depends on vim-pseudocl
|
||||
Plug 'junegunn/vim-fnr'
|
||||
Plug 'junegunn/vim-pseudocl'
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
Plug 'junegunn/vim-redis', { 'for': 'redis' }
|
||||
call plug#end()
|
||||
@@ -354,27 +373,36 @@ Execute (Check commands):
|
||||
|
||||
Execute (Partial PlugInstall):
|
||||
PlugInstall vim-fnr vim-easy-align
|
||||
PlugInstall vim-fnr vim-easy-align 1
|
||||
AssertExpect 'vim-fnr', 1
|
||||
q
|
||||
|
||||
Execute (Check dependent plugin):
|
||||
Assert &rtp =~ 'pseudocl', &rtp
|
||||
PlugInstall vim-fnr vim-easy-align 1
|
||||
AssertExpect 'vim-fnr', 1
|
||||
AssertExpect 'vim-easy-align', 1
|
||||
AssertEqual first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
||||
q
|
||||
|
||||
Given (Unaligned code):
|
||||
a=1
|
||||
aa=2
|
||||
|
||||
Execute (Check installed plugins):
|
||||
if has('vim_starting')
|
||||
Log 'Vader is run from commandline'
|
||||
runtime! plugin/**/*.vim
|
||||
endif
|
||||
Assert exists(':FNR'), 'FNR command should be found'
|
||||
Assert exists(':EasyAlign'), 'EasyAlign command should be found'
|
||||
Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
|
||||
|
||||
Assert exists(':EasyAlign'), 'EasyAlign command should be found'
|
||||
%EasyAlign=
|
||||
|
||||
Expect (Aligned code):
|
||||
a = 1
|
||||
aa = 2
|
||||
|
||||
Given (nothing):
|
||||
Given:
|
||||
Execute (Partial PlugUpdate):
|
||||
PlugUpdate vim-redis
|
||||
q
|
||||
@@ -384,13 +412,493 @@ Execute (On-demand loading based on filetypes):
|
||||
set ft=redis
|
||||
Assert exists(':RedisExecute'), 'RedisExecute command is now found'
|
||||
|
||||
Execute (Cleanup):
|
||||
call system('rm -rf '.temp_plugged)
|
||||
**********************************************************************
|
||||
~ Local (unmanaged) plugins
|
||||
**********************************************************************
|
||||
|
||||
unlet g:plugs
|
||||
unlet g:plug_home
|
||||
unlet g:vimrc_reloaded
|
||||
unlet temp_plugged vader plug basertp save_rtp repo lnum
|
||||
delf PlugStatusSorted
|
||||
Execute (Add unmanaged plugin):
|
||||
let fzf = fnamemodify(g:vader_file, ':h') . '/fzf'
|
||||
Log fzf
|
||||
|
||||
call plug#begin()
|
||||
Plug fzf, { 'on': 'SomeCommand' }
|
||||
call plug#end()
|
||||
|
||||
" Check uri field
|
||||
Assert !has_key(g:plugs.fzf, 'uri'), 'Should not have uri field'
|
||||
|
||||
" Check dir field
|
||||
AssertEqual fzf.'/', g:plugs.fzf.dir
|
||||
|
||||
" Trailing slashes and backslashes should be stripped
|
||||
for suffix in ['///', '/\/\/']
|
||||
call plug#begin()
|
||||
Plug fzf.suffix, { 'on': 'SomeCommand' }
|
||||
call plug#end()
|
||||
|
||||
" Check dir field
|
||||
AssertEqual fzf.'/', g:plugs.fzf.dir
|
||||
endfor
|
||||
|
||||
Execute (Plug block for following tests):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug fzf, { 'on': 'SomeCommand' }
|
||||
call plug#end()
|
||||
" Remove plugins from previous tests
|
||||
PlugClean!
|
||||
|
||||
Execute (PlugInstall will only install vim-easy-align):
|
||||
PlugInstall
|
||||
Log getline(1, '$')
|
||||
AssertExpect 'fzf', 0
|
||||
q
|
||||
|
||||
Execute (PlugUpdate will only update vim-easy-align):
|
||||
PlugUpdate
|
||||
Log getline(1, '$')
|
||||
AssertExpect 'fzf', 0
|
||||
q
|
||||
|
||||
Execute (PlugClean should not care about unmanaged plugins):
|
||||
PlugClean
|
||||
Log getline(1, '$')
|
||||
AssertExpect 'fzf', 0
|
||||
q
|
||||
|
||||
Execute (PlugStatus should point out that the plugin is missing):
|
||||
PlugStatus
|
||||
Log getline(1, '$')
|
||||
AssertExpect 'x fzf', 1
|
||||
AssertExpect 'Not found', 1
|
||||
q
|
||||
|
||||
Execute (Deploy unmanaged plugin):
|
||||
Assert !exists(':FZF'), ':FZF command should not exist'
|
||||
call rename('fzf-staged', 'fzf')
|
||||
|
||||
Execute (PlugUpdate still should not care):
|
||||
PlugUpdate
|
||||
Log getline(1, '$')
|
||||
AssertExpect 'fzf', 0
|
||||
q
|
||||
|
||||
Execute (PlugStatus with no error):
|
||||
PlugStatus
|
||||
Log getline(1, '$')
|
||||
AssertExpect 'x fzf', 0
|
||||
AssertExpect 'Not found', 0
|
||||
q
|
||||
|
||||
Execute (Check &rtp after SomeCommand):
|
||||
Log &rtp
|
||||
Assert &rtp !~ 'fzf'
|
||||
silent! SomeCommand
|
||||
Assert &rtp =~ 'fzf'
|
||||
AssertEqual first_rtp, split(&rtp, ',')[0]
|
||||
AssertEqual last_rtp, split(&rtp, ',')[-1]
|
||||
|
||||
Execute (Common parent):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-pseudocl'
|
||||
Plug 'junegunn/vim-fnr'
|
||||
Plug 'junegunn/vim-oblique'
|
||||
call plug#end()
|
||||
|
||||
PlugInstall
|
||||
Log getline(1, '$')
|
||||
AssertExpect! '[===]', 1
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
~ Frozen plugins
|
||||
**********************************************************************
|
||||
|
||||
Execute (Frozen plugin are not installed nor updated):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
|
||||
call plug#end()
|
||||
|
||||
redir => out
|
||||
silent PlugInstall
|
||||
redir END
|
||||
Assert out =~ 'No plugin to install'
|
||||
|
||||
redir => out
|
||||
silent PlugUpdate
|
||||
redir END
|
||||
Assert out =~ 'No plugin to update'
|
||||
|
||||
Execute (But you can still install it if the name is given as the argument):
|
||||
PlugInstall vim-easy-align
|
||||
Log getline(1, '$')
|
||||
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
||||
q
|
||||
|
||||
PlugUpdate vim-easy-align
|
||||
Log getline(1, '$')
|
||||
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
~ Retry
|
||||
**********************************************************************
|
||||
|
||||
Execute (Retry failed tasks):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/aaaaaaaaaaaaaa'
|
||||
call plug#end()
|
||||
|
||||
PlugInstall
|
||||
Log getline(1, '$')
|
||||
AssertExpect 'x aaa', 1
|
||||
AssertExpect '- vim-easy-align', 1
|
||||
normal R
|
||||
Log getline(1, '$')
|
||||
AssertExpect 'x aaa', 1
|
||||
AssertExpect '- vim-easy-align', 0
|
||||
AssertExpect! '[x]', 1
|
||||
q
|
||||
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'junegunn/aaaaaaaaaaaaaa'
|
||||
Plug 'junegunn/bbbbbbbbbbbbbb'
|
||||
Plug 'junegunn/cccccccccccccc'
|
||||
call plug#end()
|
||||
|
||||
" Ruby installer
|
||||
PlugUpdate
|
||||
normal R
|
||||
AssertExpect '- vim-easy-align', 0
|
||||
AssertExpect! '[xxx]', 1
|
||||
q
|
||||
|
||||
" Vim installer
|
||||
PlugUpdate 1
|
||||
normal R
|
||||
AssertExpect '- vim-easy-align', 0
|
||||
AssertExpect! '[xxx]', 1
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
~ Post-update hook (`do` option)
|
||||
**********************************************************************
|
||||
|
||||
Execute (Cleanup):
|
||||
call plug#begin()
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
Execute (On install):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed' }
|
||||
Plug 'junegunn/vim-pseudocl'
|
||||
call plug#end()
|
||||
|
||||
PlugInstall
|
||||
q
|
||||
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed'),
|
||||
\ 'vim-easy-align/installed should exist'
|
||||
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed'),
|
||||
\ 'vim-pseudocl/installed should not exist'
|
||||
|
||||
Execute (On update):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' }
|
||||
call plug#end()
|
||||
|
||||
" Reset for updates
|
||||
call system('cd '.g:plugs['vim-pseudocl'].dir.' && git reset --hard HEAD^')
|
||||
|
||||
PlugUpdate
|
||||
Log getline(1, '$')
|
||||
q
|
||||
|
||||
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated'),
|
||||
\ 'vim-easy-align/updated should not exist'
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/updated'),
|
||||
\ 'vim-pseudocl/updated should exist'
|
||||
|
||||
Execute (When already installed):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed2' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': 'touch installed2' }
|
||||
call plug#end()
|
||||
|
||||
PlugInstall
|
||||
q
|
||||
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
|
||||
\ 'vim-easy-align/installed2 should not exist'
|
||||
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed2'),
|
||||
\ 'vim-pseudocl/installed2 should not exist'
|
||||
|
||||
Execute (PlugInstall!):
|
||||
PlugInstall!
|
||||
q
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
|
||||
\ 'vim-easy-align/installed2 should exist'
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/installed2'),
|
||||
\ 'vim-pseudocl/installed2 should exist'
|
||||
|
||||
Execute (When already updated):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': 'touch updated2' }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated2' }
|
||||
call plug#end()
|
||||
|
||||
PlugUpdate
|
||||
q
|
||||
Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
|
||||
\ 'vim-easy-align/updated2 should not exist'
|
||||
Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/updated2'),
|
||||
\ 'vim-pseudocl/updated2 should not exist'
|
||||
|
||||
Execute (PlugUpdate!):
|
||||
PlugUpdate!
|
||||
q
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
|
||||
\ 'vim-easy-align/updated2 should exist'
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/updated2'),
|
||||
\ 'vim-pseudocl/updated2 should exist'
|
||||
|
||||
Execute (Using Funcref):
|
||||
function! PlugUpdated(info)
|
||||
call system('touch '. a:info.name . a:info.status . a:info.force . len(a:info))
|
||||
endfunction
|
||||
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'do': function('PlugUpdated') }
|
||||
Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
|
||||
call plug#end()
|
||||
|
||||
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
|
||||
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
|
||||
|
||||
PlugUpdate
|
||||
Log getline(1, '$')
|
||||
q
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignupdated03'),
|
||||
\ 'vim-easy-align/vim-easy-alignupdated03 should exist'
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled03'),
|
||||
\ 'vim-pseudocl/vim-pseudoclinstalled03 should exist'
|
||||
|
||||
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
|
||||
PlugInstall!
|
||||
q
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignunchanged13'),
|
||||
\ 'vim-easy-align/vim-easy-alignunchanged13 should exist'
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled13'),
|
||||
\ 'vim-pseudocl/vim-pseudoclinstalled13 should exist'
|
||||
|
||||
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
|
||||
PlugUpdate!
|
||||
q
|
||||
Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignupdated13'),
|
||||
\ 'vim-easy-align/vim-easy-alignupdated13 should exist'
|
||||
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclunchanged13'),
|
||||
\ 'vim-pseudocl/vim-pseudoclunchanged13 should exist'
|
||||
|
||||
**********************************************************************
|
||||
~ Overriding `dir`
|
||||
**********************************************************************
|
||||
|
||||
Execute (Using custom dir):
|
||||
Assert isdirectory(g:plugs['vim-easy-align'].dir)
|
||||
|
||||
call system('rm -rf '.$TMPDIR.'easy-align')
|
||||
call plug#begin()
|
||||
Plug 'junegunn/vim-easy-align', { 'dir': $TMPDIR.'easy-align' }
|
||||
call plug#end()
|
||||
AssertEqual $TMPDIR.'easy-align/', g:plugs['vim-easy-align'].dir
|
||||
|
||||
PlugClean!
|
||||
Assert !isdirectory(g:plugs['vim-easy-align'].dir)
|
||||
q
|
||||
|
||||
PlugInstall
|
||||
q
|
||||
Assert isdirectory(g:plugs['vim-easy-align'].dir)
|
||||
|
||||
**********************************************************************
|
||||
~ On-demand loading load order
|
||||
**********************************************************************
|
||||
Before (Clear global vars):
|
||||
let g:xxx = []
|
||||
set rtp-=$PWD/xxx/
|
||||
set rtp-=$PWD/xxx/after
|
||||
|
||||
Execute (Immediate loading):
|
||||
call plug#begin()
|
||||
Plug '$PWD/xxx'
|
||||
call plug#end()
|
||||
|
||||
" FIXME:
|
||||
" Different result when Vader is run from commandline with `-c` option
|
||||
Log g:xxx
|
||||
if has('vim_starting')
|
||||
AssertEqual ['/ftdetect', 'after/ftdetect'], g:xxx
|
||||
else
|
||||
AssertEqual ['/plugin', 'after/plugin', '/ftdetect', 'after/ftdetect'], g:xxx
|
||||
endif
|
||||
|
||||
Execute (Command-based on-demand loading):
|
||||
call plug#begin()
|
||||
Plug '$PWD/xxx', { 'on': 'XXX' }
|
||||
call plug#end()
|
||||
|
||||
AssertEqual [], g:xxx
|
||||
|
||||
silent! XXX
|
||||
AssertEqual ['/ftdetect', 'after/ftdetect', '/plugin', 'after/plugin'], g:xxx
|
||||
|
||||
setf xxx
|
||||
AssertEqual ['/ftdetect', 'after/ftdetect', '/plugin', 'after/plugin', '/ftplugin', 'after/ftplugin', '/indent', 'after/indent', '/syntax', 'after/syntax'], g:xxx
|
||||
|
||||
Execute (Filetype-based on-demand loading):
|
||||
call plug#begin()
|
||||
Plug '$PWD/xxx', { 'for': 'xxx' }
|
||||
call plug#end()
|
||||
|
||||
AssertEqual ['/ftdetect', 'after/ftdetect'], g:xxx
|
||||
|
||||
setf xxx
|
||||
AssertEqual ['/ftdetect', 'after/ftdetect', '/plugin', 'after/plugin', '/ftplugin', 'after/ftplugin', '/indent', 'after/indent', '/syntax', 'after/syntax'], g:xxx
|
||||
|
||||
Before:
|
||||
|
||||
**********************************************************************
|
||||
~ plug#helptags()
|
||||
**********************************************************************
|
||||
|
||||
Execute (plug#helptags):
|
||||
silent! call delete(expand('$PWD/xxx/doc/tags'))
|
||||
Assert !filereadable(expand('$PWD/xxx/doc/tags'))
|
||||
AssertEqual 1, plug#helptags()
|
||||
Assert filereadable(expand('$PWD/xxx/doc/tags'))
|
||||
|
||||
**********************************************************************
|
||||
~ Manual loading
|
||||
**********************************************************************
|
||||
|
||||
Execute (plug#load - invalid arguments):
|
||||
AssertEqual 0, plug#load()
|
||||
AssertEqual 0, plug#load('non-existent-plugin')
|
||||
AssertEqual 0, plug#load('non-existent-plugin', 'another-non-existent-plugin')
|
||||
AssertEqual 1, plug#load('xxx')
|
||||
AssertEqual 0, plug#load('xxx', 'non-existent-plugin')
|
||||
AssertEqual 0, plug#load('non-existent-plugin', 'xxx')
|
||||
|
||||
Execute (on: []):
|
||||
call plug#begin()
|
||||
Plug 'junegunn/rust.vim', { 'on': [] }
|
||||
call plug#end()
|
||||
PlugInstall
|
||||
q
|
||||
|
||||
Execute (PlugStatus reports (not loaded)):
|
||||
PlugStatus
|
||||
AssertExpect 'not loaded', 1
|
||||
q
|
||||
|
||||
Execute (plug#load to load it):
|
||||
tabnew test.rs
|
||||
" Vader will switch tab to [Vader-workbench] after Log
|
||||
" Log &filetype
|
||||
AssertEqual 1, plug#load('rust.vim')
|
||||
AssertEqual 'rust', &filetype
|
||||
q
|
||||
|
||||
Execute (PlugStatus should not contain (not loaded)):
|
||||
PlugStatus
|
||||
AssertExpect 'not loaded', 0
|
||||
q
|
||||
|
||||
Execute (Load plugin from PlugStatus screen with L key in normal mode):
|
||||
call plug#begin()
|
||||
Plug '$PWD/yyy', { 'on': [] }
|
||||
call plug#end()
|
||||
|
||||
PlugStatus
|
||||
AssertExpect 'not loaded', 1
|
||||
Assert !exists('g:yyy'), 'yyy not loaded'
|
||||
/not loaded
|
||||
normal L
|
||||
AssertExpect 'not loaded', 0
|
||||
Assert exists('g:yyy'), 'yyy loaded'
|
||||
q
|
||||
|
||||
Execute (Load plugin from PlugStatus screen with L key in visual mode):
|
||||
call plug#begin()
|
||||
Plug '$PWD/z1', { 'on': [] }
|
||||
Plug '$PWD/z2', { 'for': [] }
|
||||
call plug#end()
|
||||
|
||||
PlugStatus
|
||||
AssertExpect 'not loaded', 2
|
||||
Assert !exists('g:z1'), 'z1 not loaded'
|
||||
Assert !exists('g:z2'), 'z2 not loaded'
|
||||
normal ggVGL
|
||||
AssertExpect 'not loaded', 0
|
||||
Assert exists('g:z1'), 'z1 loaded'
|
||||
Assert exists('g:z2'), 'z2 loaded'
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
~ g:plug_window
|
||||
**********************************************************************
|
||||
Execute (Open plug window in a new tab):
|
||||
" Without g:plug_window, plug window is open on the left split
|
||||
let tabnr = tabpagenr()
|
||||
PlugStatus
|
||||
AssertEqual tabnr, tabpagenr()
|
||||
AssertEqual 1, winnr()
|
||||
|
||||
" PlugStatus again inside the window should not change the view
|
||||
normal S
|
||||
AssertEqual tabnr, tabpagenr()
|
||||
AssertEqual 1, winnr()
|
||||
q
|
||||
|
||||
" Define g:plug_window so that plug window is open in a new tab
|
||||
let g:plug_window = 'tabnew'
|
||||
PlugStatus
|
||||
AssertNotEqual tabnr, tabpagenr()
|
||||
|
||||
" PlugStatus again inside the window should not change the view
|
||||
let tabnr = tabpagenr()
|
||||
normal S
|
||||
AssertEqual tabnr, tabpagenr()
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
~ g:plug_url_format
|
||||
**********************************************************************
|
||||
Execute (Using g:plug_url_format):
|
||||
call plug#begin()
|
||||
let g:plug_url_format = 'git@bitbucket.org:%s.git'
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
let g:plug_url_format = 'git@bitsocket.org:%s.git'
|
||||
Plug 'beauty256'
|
||||
AssertEqual 'git@bitbucket.org:junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
|
||||
AssertEqual 'git@bitsocket.org:vim-scripts/beauty256.git', g:plugs['beauty256'].uri
|
||||
|
||||
Execute (Cleanup):
|
||||
silent! call system('rm -rf '.temp_plugged)
|
||||
silent! call rename('fzf', '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
|
||||
silent! delf PlugStatusSorted
|
||||
silent! delf AssertExpect
|
||||
silent! delf PlugUpdated
|
||||
silent! delc AssertExpect
|
||||
silent! unmap /
|
||||
silent! unmap ?
|
||||
|
||||
Restore
|
||||
|
||||
|
||||
Reference in New Issue
Block a user