48 Commits
0.5.6 ... 0.6.1

Author SHA1 Message Date
Junegunn Choi
425ef39db2 Fix #114 - &rtp should not contain empty path 2014-10-22 13:36:57 +09:00
Junegunn Choi
bd2cb9d2de Install frozen plugin if it's not found (#113) 2014-10-22 13:05:10 +09:00
Junegunn Choi
0263370bd1 Fix #112: Do not suppress messages from ftplugin 2014-10-19 14:45:19 +09:00
Junegunn Choi
4b3fbd1592 Workaround for PlugUpgrade error on Neovim (#111) 2014-10-18 11:26:05 +09:00
Junegunn Choi
396a534a0a Update README
g:plug_timeout and g:plug_retries are only for Ruby installer
2014-10-10 23:18:40 +09:00
Junegunn Choi
a45c3834f8 Merge pull request #103 from junegunn/neuevim
Parallel installer for Neovim
2014-10-10 23:11:40 +09:00
Junegunn Choi
a5c3952380 Sort auto-completion candidates 2014-10-10 17:36:54 +09:00
Junegunn Choi
60bda7322f Improve ]]/[[ movement 2014-10-10 17:35:07 +09:00
Junegunn Choi
05008e7a82 Use s:extract_name instead of matchstr 2014-10-10 17:34:39 +09:00
Junegunn Choi
2889cb4739 Minor refactoring 2014-10-10 15:50:43 +09:00
Junegunn Choi
61b21068ee Update test case (related: #8c915a5) 2014-10-10 10:54:00 +09:00
Junegunn Choi
15da7eb78a Code cleanup 2014-10-10 10:39:49 +09:00
Junegunn Choi
385a1eb350 Detect abnormal process exit using 'Error' line 2014-10-10 10:28:15 +09:00
Junegunn Choi
8c915a5271 Reuse plug window even if it's in another tab 2014-10-10 10:23:00 +09:00
Junegunn Choi
ee9f0e55b8 Use s:lines instead of split 2014-10-10 10:10:52 +09:00
Junegunn Choi
018adb2aef Disable NVim parallel installer on Windows 2014-10-10 10:06:29 +09:00
Junegunn Choi
da47e6ee56 Avoid unnecessary tab/window switch 2014-10-10 04:39:38 +09:00
Junegunn Choi
662274e617 Stabilize Neovim installer
- Abort running jobs when plug windows is reset
- Multi-line error report
- Retain window view
2014-10-10 01:10:34 +09:00
Junegunn Choi
4eeff535fa Parallel installer for Neovim 2014-10-09 19:55:36 +09:00
Junegunn Choi
c3669836d3 Fix Travis CI build 2014-10-02 01:32:23 +09:00
Junegunn Choi
eb38fe3d32 Fix Travis CI build 2014-10-02 01:21:52 +09:00
Junegunn Choi
e7704e6cb3 PlugSnapshot to use unexpanded plug home
/cc @andreicristianpetcu

plug#begin expands its path argument and converts it to the absolute
path by default. However, it makes sense to use the unexpanded form in
case of PlugSnapshot as described in
https://github.com/junegunn/vim-plug/issues/97#issuecomment-57421483

For example, for the following cases,

- call plug#begin('~/.vim/plugged')
- call plug#begin('$HOME/.vim/plugged')

PlugSnapshot will use the exact arguments, `~/.vim/plugged` or
`$HOME/.vim/plugged`, instead of the absolute paths such as
`/home/jg/.vim/plugged`.
2014-10-01 23:14:27 +09:00
Junegunn Choi
e1e04cabd5 Minor refactoring
/cc @vheon
2014-10-01 11:37:58 +09:00
Junegunn Choi
afc20ecff3 Implement PlugSnapshot (#97)
Known issue: After running the script, PlugDiff will show "future"
commits.
2014-10-01 03:10:24 +09:00
Junegunn Choi
38510a8788 Remove unnecessary submodule command after recursive clone 2014-09-29 02:12:33 +09:00
Junegunn Choi
a34b06dd54 Fix Travis-CI build 2014-09-27 15:30:58 +09:00
Junegunn Choi
5d910fc9ea Allow unmanaged plugins inside g:plug_home (#95) 2014-09-27 14:41:57 +09:00
Junegunn Choi
f31477407a Enable syntax only during startup
Related discussion can be found in #83. If the user choose not to use
syntax highlighting, he can disable it by putting `syntax off` after
`plug#end()`. But since `plug#end()` is called by `PlugInstall` or
`PlugUpdate`, it is reenabled on those commands which is not desirable.
This commit fixes the issue by changing `plug#end` to do `syntax enable`
only during Vim startup.
2014-09-23 22:11:31 +09:00
Junegunn Choi
0e907d4f38 Add link to Travis CI page 2014-09-23 15:30:46 +09:00
Junegunn Choi
cb08d6036b Reload plugins after everything's ready 2014-09-23 15:25:05 +09:00
Junegunn Choi
9d63fe6aeb Merge pull request #88 from junegunn/improve-rtp-mgmt
Improve &runtimepath mgmt (fix #85)
2014-09-23 10:14:03 +09:00
Junegunn Choi
0489b5deed Stricter double-comma replacement
To handle paths ending with commas
2014-09-23 10:01:16 +09:00
Junegunn Choi
cac2f9f439 Improve &rtp management (#85)
- Respect the order of `Plug` commands even when some plugins are loaded
  on demand
- Correct the order of `after` directories added to `&rtp`
2014-09-23 00:21:48 +09:00
Junegunn Choi
115a25de79 Suppress error messages from which command 2014-09-19 00:40:27 +09:00
Junegunn Choi
a64b156682 Expand argument to plug#begin (#82) 2014-09-17 19:41:00 +09:00
Junegunn Choi
a9fa8f44e5 Merge pull request #79 from junegunn/U
Add `U` keybinding for updating plugins
2014-09-15 21:12:25 +09:00
Junegunn Choi
d6590fa883 Code cleanup 2014-09-15 21:03:37 +09:00
Junegunn Choi
cabaf7b431 Use blackhole register when deleting lines 2014-09-15 21:02:08 +09:00
Junegunn Choi
6e509db6ff Add U keybinding for updating plugins 2014-09-15 19:12:52 +09:00
Junegunn Choi
7b7778d5ba Remove plugin directory on failure during installation (#75)
If installation process is terminated during `git submodule ...`, the
directory ends up in an inconsistent state. This commit ensures
that the directory is removed on failure.

Fixed Ruby 1.8.7 compatibility.
2014-09-14 13:54:20 +09:00
Junegunn Choi
f3e2d214df Revert "Remove plugin directory on failure during installation (#75)"
This reverts commit 5ec1faefab.
2014-09-14 13:49:00 +09:00
Junegunn Choi
5ec1faefab Remove plugin directory on failure during installation (#75)
If installation process is terminated during `git submodule ...`, the
directory ends up in an inconsistent directory. This commit ensures
that the directory is removed on failure.
2014-09-14 13:41:36 +09:00
Junegunn Choi
6406d73c9a When to use for option 2014-09-10 23:45:22 +09:00
Junegunn Choi
ff4cbe23c0 Throw v:shell_error when system() output is empty 2014-09-10 00:21:39 +09:00
Junegunn Choi
681ca2d43a Refactor PlugUpgrade (#72)
- Remove duplicate code
- Do not create .old file when vim-plug is up-to-date
- Better messages
2014-09-10 00:16:23 +09:00
Junegunn Choi
adb2413f0d syntax enable instead of syntax on 2014-09-05 12:04:28 +09:00
Junegunn Choi
dda21b50bf Merge pull request #67 from stevensons/resolve-symlink
Resolve symlinks in path to plug.vim
2014-09-04 20:12:27 +09:00
Scott Stevenson
537a5321aa Resolve symlinks in path to plug.vim
If `plug.vim` is a symbolic link, `PlugUpgrade` will now download the
latest version to the resolved path rather than overwriting the link.
2014-09-04 10:54:15 +00:00
6 changed files with 808 additions and 290 deletions

View File

@@ -1,5 +1,5 @@
![vim-plug](https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png)
![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)
[![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)](https://travis-ci.org/junegunn/vim-plug)
A minimalist Vim plugin manager.
@@ -11,7 +11,8 @@ A minimalist Vim plugin manager.
- 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))
[+ruby](https://github.com/junegunn/vim-plug/wiki/ruby) or
[Neovim](http://neovim.org/))
- On-demand loading to achieve
[fast startup time](http://junegunn.kr/images/vim-startup-time.png)
- Post-update hooks
@@ -69,34 +70,36 @@ Reload .vimrc and `:PlugInstall` to install plugins.
| `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 |
### `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 install/update plugin unless explicitly given as the argument |
| 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 |
### 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 |
| Flag | Default | Description |
| ------------------- | --------------------------------- | ----------------------------------------------------------- |
| `g:plug_threads` | 16 | Default number of threads to use |
| `g:plug_timeout` | 60 | Time limit of each task in seconds (*for Ruby installer*) |
| `g:plug_retries` | 2 | Number of retries in case of timeout (*for Ruby installer*) |
| `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
- `U` - Update plugins in the selected range
- `q` - Close the window
- `:PlugStatus`
- `L` - Load plugin
@@ -130,6 +133,10 @@ Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
```
`for` option is generally not needed as most plugins for specific file types
usually don't have too much code in `plugin` directory. You might want to
examine the output of `vim --startuptime` before applying the option.
### Post-update hooks
There are some plugins that require extra steps after installation or update.

735
plug.vim

File diff suppressed because it is too large Load Diff

5
test/fixtures/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
fzf*
xxx
yyy
z1
z2

View File

@@ -0,0 +1 @@
echomsg 'ftplugin'

View File

@@ -5,39 +5,51 @@ cd ..
PLUG_SRC=$(pwd)/plug.vim
cd - > /dev/null
export PLUG_FIXTURES=$(pwd)/fixtures
if [ ! -d vader.vim ]; then
git clone https://github.com/junegunn/vader.vim.git
fi
rm -rf fzf
rm -rf $PLUG_FIXTURES/fzf
if [ ! -d fzf-staged ]; then
git clone https://github.com/junegunn/fzf.git fzf-staged
git clone https://github.com/junegunn/fzf.git $PLUG_FIXTURES/fzf-staged
fi
make_dirs() {
mkdir -p "$1"
cd "$1"
mkdir -p "$PLUG_FIXTURES/$1"
cd "$PLUG_FIXTURES/$1"
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
for d in *; do
[ -d $d ] || continue
cat > $d/xxx.vim << EOF
" echom expand('<sfile>')
let g:total_order = get(g:, 'total_order', [])
let g:$2 = get(g:, '$2', [])
call add(g:$2, '${1:4}/$d')
let s:name = join(filter(['$2', '${1:4}', '$d'], '!empty(v:val)'), '/')
call add(g:$2, s:name)
call add(g:total_order, s:name)
EOF
done
cd - > /dev/null
}
make_dirs xxx/ xxx
make_dirs xxx/after xxx
mkdir xxx/doc
cat > xxx/doc/xxx.txt << DOC
init() {
rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2}
make_dirs xxx/ xxx
make_dirs xxx/after xxx
mkdir -p $PLUG_FIXTURES/xxx/doc
cat > $PLUG_FIXTURES/xxx/doc/xxx.txt << DOC
hello *xxx*
DOC
make_dirs yyy/ yyy
make_dirs z1/ z1
make_dirs z2/ z2
make_dirs yyy/ yyy
make_dirs yyy/after yyy
make_dirs z1/ z1
make_dirs z2/ z2
}
cat > /tmp/mini-vimrc << VIMRC
set rtp+=vader.vim
@@ -45,8 +57,11 @@ set shell=/bin/bash
source $PLUG_SRC
VIMRC
[ -z "$TMPDIR" ] && export TMPDIR=/tmp/
init
if [ "$1" = '!' ]; then
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null &&
init &&
/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'

View File

@@ -27,11 +27,17 @@ Execute (Initialize test environment):
endfunction
function! AssertExpect(bang, pat, cnt)
let op = a:bang ? '==' : '=~'
let op = a:bang ? '==#' : '=~#'
AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
endfunction
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
function! EnsureLoaded()
if has('vim_starting')
runtime! plugin/**/*.vim
endif
endfunction
Execute (Print Ruby version):
redir => out
silent ruby puts RUBY_VERSION
@@ -331,7 +337,8 @@ Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
AssertEqual 1, &previewwindow
pclose
Execute (Plug window in a new tab):
Execute (Reuse Plug window in another tab):
let tabnr = tabpagenr()
PlugDiff
tab new new-tab
set buftype=nofile
@@ -339,8 +346,8 @@ Execute (Plug window in a new tab):
normal D
AssertExpect '^- ', 1
normal q
AssertEqual 'new-tab', expand('%')
q
AssertEqual tabnr, tabpagenr()
normal! gt
q
**********************************************************************
@@ -388,10 +395,7 @@ Given (Unaligned code):
aa=2
Execute (Check installed plugins):
if has('vim_starting')
Log 'Vader is run from commandline'
runtime! plugin/**/*.vim
endif
call EnsureLoaded()
Assert exists(':FNR'), 'FNR command should be found'
Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
@@ -417,7 +421,7 @@ Execute (On-demand loading based on filetypes):
**********************************************************************
Execute (Add unmanaged plugin):
let fzf = fnamemodify(g:vader_file, ':h') . '/fzf'
let fzf = expand('$PLUG_FIXTURES/fzf')
Log fzf
call plug#begin()
@@ -475,7 +479,7 @@ Execute (PlugStatus should point out that the plugin is missing):
Execute (Deploy unmanaged plugin):
Assert !exists(':FZF'), ':FZF command should not exist'
call rename('fzf-staged', 'fzf')
call rename(expand('$PLUG_FIXTURES/fzf-staged'), fzf)
Execute (PlugUpdate still should not care):
PlugUpdate
@@ -513,12 +517,37 @@ Execute (Common parent):
**********************************************************************
~ Frozen plugins
**********************************************************************
- We've decided to install plugins that are frozen: see #113
Execute (Frozen plugin are not ~~installed nor~~ updated):
" Remove plugins
call plug#begin()
call plug#end()
PlugClean!
q
Execute (Frozen plugin are not installed nor updated):
" vim-easy-align is not found, so it will be installed even though it's frozen
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
call plug#end()
PlugInstall
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
q
" Remove plugins again
call plug#begin()
call plug#end()
PlugClean!
q
" PlugUpdate will do the same
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
call plug#end()
PlugInstall
AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
q
" Since vim-easy-align already exists, PlugInstall or PlugUpdate will skip it
redir => out
silent PlugInstall
redir END
@@ -728,45 +757,45 @@ Execute (Using custom dir):
**********************************************************************
Before (Clear global vars):
let g:xxx = []
set rtp-=$PWD/xxx/
set rtp-=$PWD/xxx/after
set rtp-=$PLUG_FIXTURES/xxx/
set rtp-=$PLUG_FIXTURES/xxx/after
Execute (Immediate loading):
call plug#begin()
Plug '$PWD/xxx'
Plug '$PLUG_FIXTURES/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
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
else
AssertEqual ['/plugin', 'after/plugin', '/ftdetect', 'after/ftdetect'], g:xxx
AssertEqual ['xxx/plugin', 'xxx/after/plugin', 'xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
endif
Execute (Command-based on-demand loading):
call plug#begin()
Plug '$PWD/xxx', { 'on': 'XXX' }
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
call plug#end()
AssertEqual [], g:xxx
silent! XXX
AssertEqual ['/ftdetect', 'after/ftdetect', '/plugin', 'after/plugin'], g:xxx
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin'], g:xxx
setf xxx
AssertEqual ['/ftdetect', 'after/ftdetect', '/plugin', 'after/plugin', '/ftplugin', 'after/ftplugin', '/indent', 'after/indent', '/syntax', 'after/syntax'], g: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
Execute (Filetype-based on-demand loading):
call plug#begin()
Plug '$PWD/xxx', { 'for': 'xxx' }
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
call plug#end()
AssertEqual ['/ftdetect', 'after/ftdetect'], g:xxx
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
setf xxx
AssertEqual ['/ftdetect', 'after/ftdetect', '/plugin', 'after/plugin', '/ftplugin', 'after/ftplugin', '/indent', 'after/indent', '/syntax', 'after/syntax'], g: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
Before:
@@ -775,10 +804,10 @@ Before:
**********************************************************************
Execute (plug#helptags):
silent! call delete(expand('$PWD/xxx/doc/tags'))
Assert !filereadable(expand('$PWD/xxx/doc/tags'))
silent! call delete(expand('$PLUG_FIXTURES/xxx/doc/tags'))
Assert !filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
AssertEqual 1, plug#helptags()
Assert filereadable(expand('$PWD/xxx/doc/tags'))
Assert filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
**********************************************************************
~ Manual loading
@@ -819,7 +848,7 @@ Execute (PlugStatus should not contain (not loaded)):
Execute (Load plugin from PlugStatus screen with L key in normal mode):
call plug#begin()
Plug '$PWD/yyy', { 'on': [] }
Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
call plug#end()
PlugStatus
@@ -833,8 +862,8 @@ Execute (Load plugin from PlugStatus screen with L key in normal mode):
Execute (Load plugin from PlugStatus screen with L key in visual mode):
call plug#begin()
Plug '$PWD/z1', { 'on': [] }
Plug '$PWD/z2', { 'for': [] }
Plug '$PLUG_FIXTURES/z1', { 'on': [] }
Plug '$PLUG_FIXTURES/z2', { 'for': [] }
call plug#end()
PlugStatus
@@ -873,6 +902,7 @@ Execute (Open plug window in a new tab):
normal S
AssertEqual tabnr, tabpagenr()
q
unlet g:plug_window
**********************************************************************
~ g:plug_url_format
@@ -885,17 +915,202 @@ Execute (Using g:plug_url_format):
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
unlet g:plug_url_format
**********************************************************************
~ U
**********************************************************************
Execute (Plug block):
call plug#begin()
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/vim-emoji'
call plug#end()
Execute (Update plugin with U key in normal mode):
PlugStatus
/emoji
normal U
Log getline(1, '$')
AssertExpect 'Updated', 1
AssertExpect 'vim-emoji', 1
AssertExpect 'vim-easy-align', 0
AssertExpect! '[=]', 1
" From PlugInstall screen
PlugInstall
/easy-align
normal U
AssertExpect 'Updated', 1
AssertExpect 'vim-emoji', 0
AssertExpect 'vim-easy-align', 1
AssertExpect! '[=]', 1
q
Execute (Update plugins with U key in visual mode):
silent! call system('rm -rf '.g:plugs['vim-easy-align'].dir)
PlugStatus
normal VGU
Log getline(1, '$')
AssertExpect 'Updated', 1
AssertExpect 'vim-emoji', 1
AssertExpect 'vim-easy-align', 1
AssertExpect! '[==]', 1
" From PlugUpdate screen
normal VGU
Log getline(1, '$')
AssertExpect 'Updated', 1
AssertExpect 'vim-emoji', 1
AssertExpect 'vim-easy-align', 1
AssertExpect! '[==]', 1
q
**********************************************************************
Execute (plug#begin should expand env vars):
AssertNotEqual '$HOME/.emacs/plugged', expand('$HOME/.emacs/plugged')
call plug#begin('$HOME/.emacs/plugged')
AssertEqual expand('$HOME/.emacs/plugged'), g:plug_home
**********************************************************************
Execute (Plug directory with comma):
call plug#begin(temp_plugged . '/p,l,u,g,g,e,d')
Plug 'junegunn/vim-emoji'
call plug#end()
Log &rtp
PlugInstall
q
let found = filter(split(globpath(&rtp, 'README.md'), '\n'), 'v:val =~ ","')
Log found
AssertEqual 1, len(found)
**********************************************************************
Execute (Strict load order):
let g:total_order = []
call plug#begin()
Plug '$PLUG_FIXTURES/xxx'
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
call plug#end()
call EnsureLoaded()
setf xxx
Log 'Case 1: ' . &rtp
AssertEqual ['yyy/ftdetect', 'yyy/after/ftdetect', 'xxx/ftdetect', 'xxx/after/ftdetect'], g:total_order[0:3]
Assert index(g:total_order, 'xxx/plugin') < index(g:total_order, 'yyy/plugin')
Assert index(g:total_order, 'xxx/after/plugin') < index(g:total_order, 'yyy/after/plugin')
let len = len(split(&rtp, ','))
let g:total_order = []
call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
Plug '$PLUG_FIXTURES/yyy'
call plug#end()
call EnsureLoaded()
set rtp^=manually-prepended
set rtp+=manually-appended
setf xxx
Log 'Case 2: ' . &rtp
AssertEqual 'manually-prepended', split(&rtp, ',')[3]
AssertEqual 'manually-appended', split(&rtp, ',')[-4]
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'yyy/ftdetect', 'yyy/after/ftdetect'], g:total_order[0:3]
Assert index(g:total_order, 'yyy/plugin') < index(g:total_order, 'xxx/plugin')
Assert index(g:total_order, 'yyy/after/plugin') < index(g:total_order, 'xxx/after/plugin')
AssertEqual len + 2, len(split(&rtp, ','))
let g:total_order = []
call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
call plug#end()
call EnsureLoaded()
setf xxx
Log 'Case 3: ' . &rtp
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'yyy/ftdetect', 'yyy/after/ftdetect'], g:total_order[0:3]
Assert index(g:total_order, 'xxx/plugin') < index(g:total_order, 'yyy/plugin')
Assert index(g:total_order, 'xxx/after/plugin') < index(g:total_order, 'yyy/after/plugin')
AssertEqual len + 2, len(split(&rtp, ','))
**********************************************************************
Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home):
call plug#begin('$PLUG_FIXTURES')
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': [] }
Plug '$PLUG_FIXTURES/fzf'
Plug '$PLUG_FIXTURES/xxx'
Plug '$PLUG_FIXTURES/yyy'
call plug#end()
" Remove z1, z2
PlugClean!
AssertExpect '^- ', 2
AssertExpect 'Already clean', 0
PlugClean!
AssertExpect '^- ', 0
AssertExpect 'Already clean', 1
q
**********************************************************************
Execute (#112 On-demand loading should not suppress messages from ftplugin):
call plug#begin('$PLUG_FIXTURES')
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
call plug#end()
redir => out
tabnew a.c
redir END
Assert stridx(out, 'ftplugin') >= 0
* The same applies to plug#load())
redir => out
call plug#load('ftplugin-msg')
redir END
Assert stridx(out, 'ftplugin') >= 0
q
**********************************************************************
Execute (PlugSnapshot):
call plug#begin('$TMPDIR/plugged')
Plug 'junegunn/vim-emoji'
Plug 'junegunn/seoul256.vim'
call plug#end()
PlugInstall
PlugSnapshot
AssertEqual '#!/bin/bash', getline(1)
AssertEqual '# Generated by vim-plug', getline(2)
AssertEqual 'vim +PlugUpdate +qa', getline(5)
AssertEqual 'PLUG_HOME=$TMPDIR/plugged', getline(7)
AssertEqual 0, stridx(getline(9), 'cd $PLUG_HOME/seoul256.vim/ && git reset --hard')
AssertEqual 0, stridx(getline(10), 'cd $PLUG_HOME/vim-emoji/ && git reset --hard')
AssertEqual 'sh', &filetype
execute 'PlugSnapshot' g:plug_home.'/snapshot.sh'
AssertEqual 'sh', &filetype
AssertEqual 'snapshot.sh', fnamemodify(expand('%'), ':t')
q
**********************************************************************
Execute (#114 Should not contain empty path in &rtp):
call plug#begin('$TMPDIR/plugged')
call plug#end()
Log &rtp
Assert &rtp !~ ',,', 'Commas'
Assert &rtp !~ '^,', 'Comma prefix'
Assert &rtp !~ ',$', 'Comma suffix'
Execute (Cleanup):
silent! call system('rm -rf '.temp_plugged)
silent! call rename('fzf', 'fzf-staged')
silent! call system('rm -rf '.temp_plugged)
silent! call rename(fzf, expand('$PLUG_FIXTURES/fzf-staged'))
silent! unlet g:plugs
silent! unlet g:plug_home
silent! unlet g:plug_url_format
silent! unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out tabnr
silent! unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out tabnr found len
silent! delf PlugStatusSorted
silent! delf AssertExpect
silent! delf PlugUpdated
silent! delf EnsureLoaded
silent! delc AssertExpect
silent! unmap /
silent! unmap ?