193 Commits
0.4.0 ... 0.7.1

Author SHA1 Message Date
Junegunn Choi
d9b70554e3 Merge pull request #187 from junegunn/python-2.6
Python 2.6 compatibility
2015-03-08 02:40:28 +09:00
Junegunn Choi
3c6ac68947 Python 2.6 compatibility
Tested on
- Vim 7.2.330
- Python 2.6.5
- Ubuntu 10.04
- https://gist.github.com/junegunn/863dcbd78eadece788cd
2015-03-08 02:00:06 +09:00
Junegunn Choi
51dc024b2e Update README (markdown table) 2015-02-27 18:56:30 +09:00
Junegunn Choi
30a2c5cc14 Remove uniq() function from test code 2015-02-25 22:44:18 +09:00
Junegunn Choi
a34b745a21 Fix #184 - Avoid duplicate entries in g:plugs_order 2015-02-25 22:31:39 +09:00
Junegunn Choi
c759170ce2 Merge pull request #179 from starcraftman/master
Linking to wiki.
2015-02-22 22:36:18 +09:00
Jeremy Pallats/starcraft.man
44410a32e3 Linking to wiki. 2015-02-22 08:23:55 -05:00
Junegunn Choi
5698a055c3 Minor refactoring 2015-02-22 11:41:27 +09:00
Junegunn Choi
59748b0680 Fix error on windows when plug home contains spaces (#154)
Also fixes blank command output.
2015-02-22 03:53:24 +09:00
Junegunn Choi
95aa96a884 Interpret the second argument to Plug command as tag option
The older documentation of vim-plug suggested that the second string
parameter to Plug command was for both branches and tags. But we've
realized that tags and branches are not interchangeable (#174), and it
is now recommended that the user explicitly specify whether it's a
branch or a tag. The now-undocumented second parameter is currently for
branches, but I'd like to change it for tags, as the use of tags are
much more common.
2015-02-21 12:26:11 +09:00
Junegunn Choi
bb48508c3e Fix #177 - Check Python version >= 2.7 2015-02-21 03:47:58 +09:00
Junegunn Choi
8a525f165c Merge pull request #165 from starcraftman/new_pr_branch
Python parallel plugin management.
2015-02-19 00:26:40 +09:00
Jeremy Pallats/starcraft.man
e362fd5931 Python parallel plugin management.
* Main differences from ruby are inside Command class, notably it
poll/sleeps on the subprocess to check output & timeout.
* Another difference, interrupt is not instaneous due to checking var.
* Otherwise, I mainly just mirrored code into objects.
* Note that due to GVim freeze, disabling use on Windows
2015-02-18 10:07:35 -05:00
Junegunn Choi
74169f3761 Merge pull request #175 from junegunn/tag-vs-branch
Fix #174 - Error when updating tagged plugins
2015-02-18 17:27:14 +09:00
Junegunn Choi
7e4191baaf Fix update of tagged plugins (#174) 2015-02-18 16:47:32 +09:00
Junegunn Choi
753f7be798 Extend Travis CI build to use vim-nox on Ubuntu 12.04 2015-02-18 16:47:17 +09:00
Junegunn Choi
c74fae9f8e Revert "Use :pgroup option when starting subprocesses"
This reverts commit 308fb9bc94.
2015-02-17 20:59:22 +09:00
Junegunn Choi
fc200da975 Add o key binding for PlugDiff 2015-02-17 14:09:07 +09:00
Junegunn Choi
77f58a3793 Merge pull request #169 from junegunn/ruby-pgroup
Use :pgroup option when starting subprocesses
2015-02-17 11:52:46 +09:00
Junegunn Choi
308fb9bc94 Use :pgroup option when starting subprocesses
This makes it easier and faster to kill spawned git processes.
Repetitive `pgrep` command for collecting PIDs is no longer required.
Unfortunately, :pgroup option is not supported on Ruby 1.8 so we can't
remove the old implementation of `killall`.
2015-02-17 11:43:39 +09:00
Junegunn Choi
4a96db8971 Restore $GIT_TERMINAL_PROMPT in s:update_finish
Fix for asynchronous installer of Neovim
2015-02-15 21:24:33 +09:00
Junegunn Choi
925ec7b325 Merge pull request #168 from junegunn/git-no-prompt
Do not inject `git::` to url when git 2.3.0 or above found
2015-02-15 21:06:38 +09:00
Junegunn Choi
7fec10e088 Remove git::@ from URI if git 2.3.0 or above is found
Related: #161, #133, #109
2015-02-15 18:48:57 +09:00
Junegunn Choi
54fc8a4fc7 Add test case for unescaped spaces in &rtp 2015-02-14 23:18:57 +09:00
Junegunn Choi
9c1cca32f0 Do not escape spaces in &rtp
Related: https://github.com/SirVer/ultisnips/issues/445
2015-02-14 23:11:20 +09:00
Junegunn Choi
f6be60a9a5 Use v:version == 702 && has('patch374')
Thanks to @justinmk
2015-02-13 16:09:01 +09:00
Junegunn Choi
e81e761d43 Fix #166 - v:version >= 703 || has('patch-7.2.374') 2015-02-13 14:20:16 +09:00
Junegunn Choi
fb84e6b11c Fix typo 2015-02-12 11:38:48 +09:00
Junegunn Choi
ef784c17b1 Fix #154 - issues with paths containing spaces 2015-02-12 11:35:05 +09:00
Junegunn Choi
7aeff0ef0d Disable Ruby installer when without patch-7.2.374 (#162) 2015-02-10 12:09:46 +09:00
Junegunn Choi
773b3cadd0 Do not use --progress option on git 1.7.0 or below (#162) 2015-02-10 01:48:54 +09:00
Junegunn Choi
71542dd896 Do not use --progress option when not necessary
Patch suggested by @sangh. Fix #162 and #163.
2015-02-09 12:12:50 +09:00
Junegunn Choi
f825e4ef6e Ignore error when the buffer is not properly initialized (#162) 2015-02-09 12:09:27 +09:00
Junegunn Choi
6e7509e2ef Update PlugClean for Gist plugins
In order to install Gist as a plugin, you have to modify its `dir` to be
the `plugin` subdirectory of the normal path of the plugin if it were an
ordinary pathogen-compatible Vim plugin.

    Plug 'https://gist.github.com/952560a43601cd9898f1.git',
        \ { 'dir': g:plug_home.'/xxx/plugin', 'rtp': '..' }

PlugClean command was incompatible with the above trick, so it was
updated not to remove the parent directory of `dir` of each plugin.
2015-02-08 14:47:19 +09:00
Junegunn Choi
619e42a182 Merge pull request #160 from junegunn/fix-159
Fix #159 - Avoid errors on tcsh and fish
2015-02-08 01:15:49 +09:00
Junegunn Choi
48e8000b6a Use /bin/sh instead of /bin/bash (PlugSnapshot) 2015-02-08 01:08:18 +09:00
Junegunn Choi
79da5b2654 Fix #159 by temporarily setting &shell to sh 2015-02-07 13:36:45 +09:00
Junegunn Choi
61f010ffad Update README - curl --create-dirs 2015-02-01 03:19:00 +09:00
Junegunn Choi
4539bb8fb3 Update README - Pros. 2015-02-01 03:11:58 +09:00
Junegunn Choi
7d40f592af Fix #155 - cd /d on Windows 2015-01-29 19:08:03 +09:00
Junegunn Choi
1c61517164 Merge pull request #152 from michamos/patch-1
Clarify messages after 'PlugUpgrade'
2015-01-26 18:50:51 +09:00
Micha Moskovic
061b326b37 Clarify messages after 'PlugUpgrade' 2015-01-26 10:46:20 +01:00
Junegunn Choi
166426718e Merge pull request #147 from Pyrohh/simplify-nvim-check
Simplify neovim check
2015-01-18 11:38:49 +09:00
Michael Reed
b440603fa9 Simplify neovim check 2015-01-17 16:38:50 -05:00
Junegunn Choi
04fc8f9aba Fix #145 - Merge duplicate on-demand loading triggers 2015-01-17 17:20:37 +09:00
Junegunn Choi
ebe8635043 Merge pull request #143 from junegunn/fix-139
Fix #139 - Use git fetch+merge instead of pull
2015-01-09 09:53:36 +09:00
Junegunn Choi
334e820c4e Add more test cases for #139 2015-01-09 00:56:52 +09:00
Junegunn Choi
0e9fa672f8 Fix #139 - Use git fetch+merge instead of pull 2015-01-08 23:21:32 +09:00
Junegunn Choi
fdf1e53da5 Change test code to use local repositories 2015-01-07 20:14:48 +09:00
Junegunn Choi
470139cd86 Update README 2014-12-18 23:53:32 +09:00
Junegunn Choi
e8cd357060 Fix test failure 2014-12-13 11:51:37 +09:00
Junegunn Choi
3606c294de Merge pull request #135 from threeifbywhiskey/confirmation-convention
Downcase opt-in confirmation options
2014-12-08 23:58:05 +09:00
Dorien Snake
06f903d8af Downcase opt-in confirmation options
There's a fairly widespread convention which recommends indicating the default
confirmation option in uppercase. Granted, the number of applicable instances
in vim-plug is currently only two, but perhaps this'll save users with such an
inclination having to hit Enter just to sate their curiosities.
2014-12-08 08:49:45 -05:00
Junegunn Choi
1f704deb76 Merge branch 'master' of github.com:junegunn/vim-plug 2014-12-08 17:37:46 +09:00
Junegunn Choi
3ebf6361bf Update README 2014-12-08 17:37:26 +09:00
Junegunn Choi
9b99c1f885 Merge pull request #134 from wilywampa/master
Check for full match of command name
2014-12-08 10:02:09 +09:00
Jacob Niehus
53cc8a53d9 Check for full match of command name 2014-12-07 13:19:09 -07:00
Junegunn Choi
2ee153d610 Define s:triggers by default to avoid error after upgrade (#132) 2014-12-05 12:05:57 +09:00
Junegunn Choi
7019171737 Fix #131 - Syntax error 2014-12-04 15:13:37 +09:00
Junegunn Choi
044c3a67c4 Fix #130 - Proper cleanup of on-demand loading triggers 2014-12-04 13:06:13 +09:00
Junegunn Choi
48514768c2 Fix missing progress update (#127)
In the recent versions of NeoVim, jobstart() does not return
monotonically increasing numbers, this caused vim-plug to miss updating
the progress of a task when the job ID for the task is already
reassigned to a new task.
2014-12-02 02:48:25 +09:00
Junegunn Choi
68ad02c5c3 Display "Press 'D'" message only when existing plugins are updated
Fix #123
2014-11-24 03:32:01 +09:00
Junegunn Choi
12bc2ea1da Fix some test code 2014-11-21 01:06:17 +09:00
Junegunn Choi
ade7fb95b1 Fix failing test case 2014-11-08 11:33:11 +09:00
Junegunn Choi
9c55223869 Merge pull request #118 from splinterofchaos/job_data-list
Update: job_data[2] as a list.
2014-11-08 10:28:53 +09:00
Scott Prager
495becf442 Update: job_data[2] is a list. 2014-10-29 01:03:58 -04:00
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
Junegunn Choi
99f6f36b69 Do not print 'D'-message when there was no update (#66)
This commit assumes that the git pull command prints 'Already
up-to-date' when the repository is up-to-date. Let's just hope that it
doesn't change in the future.
2014-09-04 14:10:33 +09:00
Junegunn Choi
3f82808bea Use blackhole register when deleting commit list 2014-09-04 14:09:06 +09:00
Junegunn Choi
7474edf13f Remove unnecessary dot-concatenations
Thanks to @vheon for the tip.
2014-09-04 01:48:27 +09:00
Junegunn Choi
25b0fb7583 Merge pull request #65 from vheon/fix-preview-commit
[PlugDiff] Change directory after wincmd to avoid side-effects on BufEnter/BufLeave
2014-09-04 01:29:57 +09:00
Andrea Cedraro
a868ee4c11 cd to repo root when in preview window on preview commit 2014-09-03 08:47:01 +02:00
Junegunn Choi
49851436ff Use --no-rebase option on git pull (#64) 2014-09-03 02:14:54 +09:00
Junegunn Choi
2f9a94e8c0 Update README 2014-08-26 01:39:12 +09:00
Junegunn Choi
ab3bd3b17c Implement g:plug_url_format (#62) 2014-08-26 01:36:50 +09:00
Junegunn Choi
3572ffde79 Add g:plug_window to README (#57) 2014-08-20 12:38:22 +09:00
Junegunn Choi
18c8b54793 Add test case for g:plug_window (#57) 2014-08-20 12:33:37 +09:00
Junegunn Choi
1752de5b7c Fix indentation 2014-08-20 12:33:37 +09:00
Miles Whittaker
2f3225fc60 User can now specify how plug window opens
Using 'let g:plug_window = "topleft new"' or something similar, the
user can specify how they would like the plug window to open.
2014-08-20 12:33:37 +09:00
Junegunn Choi
1022acad0b Add example for on-demand loading for multiple file types (#59) 2014-08-20 01:27:55 +09:00
Junegunn Choi
68c7fbbf9d Change raw.github.com url (#58)
https://developer.github.com/changes/2014-04-25-user-content-security/
2014-08-19 20:46:27 +09:00
Junegunn Choi
da24f714e0 Use git:: prefix to avoid password prompt on git 1.7 (#56) 2014-08-14 10:04:44 +09:00
Junegunn Choi
c1bbbaf3ef Allow Plug command even when git executable is not found (#52)
- plug#begin() will return 1 even when git executable is not found
    - Commands that require git will not be available
- If you wish to ignore the error message prepend `silent!` to the call
2014-08-11 01:42:19 +09:00
Junegunn Choi
f7ebba7b9e Improve PlugDiff: 'X' key to revert the update 2014-08-10 16:52:26 +09:00
Junegunn Choi
6272f5e289 Improve PlugStatus
- Display load status
- Load plugin with 'L' key

(This commit also allows not loading a plugin with `'for': []`. It used
to load ftdetect files.)
2014-08-10 13:46:46 +09:00
Junegunn Choi
f43067c7a5 Merge pull request #51 from junegunn/public-api
Add plug#helptags and plug#load (#48)
2014-08-09 23:44:59 +09:00
Junegunn Choi
e6cba28997 Fix error messages 2014-08-09 13:11:41 +09:00
Junegunn Choi
f1b8832a13 Add plug#load() (#48) 2014-08-09 12:59:20 +09:00
Junegunn Choi
d0c94a9b08 Add plug#helptags() 2014-08-09 12:58:16 +09:00
Junegunn Choi
3a2e406cd0 Merge pull request #47 from junegunn/fix-upgrade
Do not require reloading of .vimrc after PlugUpgrade
2014-08-05 19:09:17 +09:00
Junegunn Choi
84cdf61730 Do not require reloading of .vimrc after PlugUpgrade 2014-08-05 18:52:19 +09:00
Junegunn Choi
0aeea1db08 Update README.md 2014-08-05 15:32:28 +09:00
Junegunn Choi
8289477d18 Revert "Make sure update/install after PlugUpgrade work"
This reverts commit 19b12e2216.

No luck. The user still have to reload .vimrc anyway. Let's just make it
clear that a restart can be required after PlugUpgrade.
2014-08-05 01:50:03 +09:00
Junegunn Choi
19b12e2216 Make sure update/install after PlugUpgrade work
By not assuming `frozen` property exists. I tried to fix it with
s:upgrade_specs, but it has no effect if the old version of vim-plug
doesn't know about it.
2014-08-05 01:43:42 +09:00
Junegunn Choi
4c9ebe9c31 Add -bar option to commands 2014-08-05 01:31:19 +09:00
Junegunn Choi
74dcd13575 s:upgrade_specs should be called after reloading the source 2014-08-05 01:25:34 +09:00
Junegunn Choi
518f20652f Merge pull request #46 from vheon/fix-multiple-create-directory
Do not try to create g:plug_home more than once
2014-08-05 00:56:26 +09:00
Andrea Cedraro
665ec057d7 Do not try to create g:plug_home more than once 2014-08-04 17:43:34 +02:00
Junegunn Choi
bc212dca77 Merge pull request #45 from junegunn/travis-ci-rubies
Test against multiple versions of Ruby
2014-08-04 16:40:11 +09:00
Junegunn Choi
8da7b50fb2 Test against multiple versions of Ruby
As discussed in junegunn/vim-plug#31
2014-08-04 16:31:05 +09:00
Junegunn Choi
4ae2e879e1 Note on escaping double quotes in inline expression 2014-08-02 14:04:03 +09:00
Junegunn Choi
93628b1c3d Forced run of post-update hooks using bang commands
PlugInstall! / PlugUpdate!
2014-08-02 12:13:52 +09:00
Junegunn Choi
01e126469b Remove duplicate expression and escape helptags directory 2014-08-02 02:52:56 +09:00
Junegunn Choi
a7477f04b7 Update README 2014-08-02 01:12:01 +09:00
Junegunn Choi
0fdb56ba72 Update README 2014-08-02 01:00:59 +09:00
Junegunn Choi
d89949f16c Update README.md 2014-08-01 23:46:50 +09:00
Junegunn Choi
19b8221c14 Update README 2014-08-01 23:37:19 +09:00
Junegunn Choi
336fadd236 Remove FAQ/Troubleshooting section and add link to wiki page 2014-08-01 23:33:26 +09:00
Junegunn Choi
a216e38a59 Merge pull request #44 from FriedSock/test_refactoring
Force use of bash for Vader tests.
2014-08-01 23:26:26 +09:00
Jack Bracewell
d930594686 Force use of bash for Vader tests.
If not using a bash compatible shell (like fish), then this will be
set as the default Vim shell. Leading to half the tests failing with
E484: CAN’T OPEN FILE
2014-08-01 15:16:21 +01:00
Junegunn Choi
f4261711ae Update README 2014-08-01 02:01:31 +09:00
Junegunn Choi
61b77bc8e8 Fix many subtle issues regarding on-demand loading etc.
- On-demand loading
    - Fix loading of unwanted files (e.g. colors/*.vim, syntax/*.vim, etc.)
- Filetyp-based on-demand loading
    - Load `after/ftdetect` as well
    - Make sure indent files are loaded by invoking
      `doautocmd filetypeindent FileType`
- Ensure plugin loaded when it was added after Vim started
- Do not reload $MYVIMRC after installtion/update
    - Instead simply call plug#end()
2014-07-31 16:34:41 +09:00
Junegunn Choi
fe7c7e7b40 Minor tweaks 2014-07-31 03:04:59 +09:00
Junegunn Choi
25afdf138c Refactoring
- Remove dead code
- Extract method
2014-07-31 01:01:59 +09:00
Junegunn Choi
b36fd34da0 Ensure files under after are loaded when first installed 2014-07-31 00:17:21 +09:00
Junegunn Choi
7e55690f19 Update examples 2014-07-30 20:00:21 +09:00
Junegunn Choi
30ef53d832 Remove support for experiemental dependency resolution (#43)
🎉
2014-07-30 19:52:19 +09:00
Junegunn Choi
f58d090bb2 Add dir option: managed plugins outside g:plug_home 2014-07-30 19:20:51 +09:00
Junegunn Choi
eeef77e9c8 Merge branch 'vheon-refactoring' into refactoring 2014-07-29 23:37:47 +09:00
Andrea Cedraro
6af2cd8946 Inline substitute inside s:dirpath() 2014-07-29 14:21:11 +02:00
Junegunn Choi
878cdd5309 Unmap / and ? from vim-oblique after test 2014-07-29 19:18:33 +09:00
Junegunn Choi
9bb2da53a0 Replace s:extract_name with a single fnamemodify call 2014-07-29 19:17:12 +09:00
Junegunn Choi
58c06ed77e Use single-quotes whenever possible for consistency 2014-07-29 19:07:09 +09:00
Junegunn Choi
2e691c6feb Define a separate version of s:is_local_plug for Windows 2014-07-29 10:09:05 +09:00
Junegunn Choi
a18087610a Use fnamemodify instead of split hackery
Simpler and faster
2014-07-29 02:42:53 +09:00
Junegunn Choi
276106d987 Performance tuning: reduce the number of s:parse_options calls 2014-07-29 02:11:59 +09:00
Junegunn Choi
d499fc311a Use dot operator instead of get()
The reason I used get() instead of concise dot operator when accessing
`frozen` and `local` properties of plugin spec was to avoid errors when
a user "PlugUpgrade" from an old version of vim-plug whose g:plugs does
not have those properties. Added the code to patch the old version of
g:plugs so that we can safely use dot operators.
2014-07-29 01:51:32 +09:00
Junegunn Choi
c4b4aa8f07 Code cleanup: reuse s:trim() when possible 2014-07-29 00:19:29 +09:00
Junegunn Choi
d690f8d576 Change error reporting method
As suggested by @vheon:
https://github.com/junegunn/vim-plug/pull/40#issuecomment-50278543
2014-07-28 19:56:59 +09:00
Junegunn Choi
8738341ad0 Performance tuning: reduce the number of globpath calls 2014-07-28 19:45:40 +09:00
Junegunn Choi
5ab2024fbb Performace tuning: inlining some function calls 2014-07-28 19:41:05 +09:00
Junegunn Choi
300176ba9f Avoid echoerr inside catch block 2014-07-28 01:27:30 +09:00
Andrea Cedraro
da7d6bd58b Refactor s:add function 2014-07-27 17:38:57 +02:00
Junegunn Choi
b651558c63 Update README 2014-07-27 12:00:36 +09:00
Junegunn Choi
2d815ad2f0 Escape angle brackets in README 2014-07-27 11:58:12 +09:00
Junegunn Choi
3af4079179 Fix typo 2014-07-27 11:55:06 +09:00
Junegunn Choi
e6a594f1ad Change post-hook function to take a dictionary for more control 2014-07-27 11:28:53 +09:00
Junegunn Choi
e741d02ad0 Fix elapsed time to include the time spent in post-update hook 2014-07-27 11:15:13 +09:00
Junegunn Choi
b2208640d4 Update documentation 2014-07-27 11:06:47 +09:00
Junegunn Choi
aa49c38586 Don't need <Plug> map (#38) 2014-07-27 03:16:44 +09:00
Junegunn Choi
b6b10ac17e Print progress of post-update hooks using :! (#38) 2014-07-27 03:07:37 +09:00
Junegunn Choi
706f7e00ea Merge pull request #39 from vheon/fix-type-parameter-clarity
Replace return value of type() with call to the function
2014-07-27 02:22:31 +09:00
Andrea Cedraro
6ff1031339 Replace return value of type() with named values 2014-07-26 19:14:46 +02:00
Junegunn Choi
0936877399 Don't check for the need for post-update hook when interrupted 2014-07-27 00:42:23 +09:00
Junegunn Choi
d956e16f15 Minor refactoring 2014-07-26 22:58:34 +09:00
Junegunn Choi
f98c8456fa Post-update hook (do option) 2014-07-26 22:49:18 +09:00
9 changed files with 2499 additions and 681 deletions

View File

@@ -1,12 +1,32 @@
language: vim
language: ruby
rvm:
- 1.8.7
- 1.9.2 # Test with vim-nox package on ubuntu
- 1.9.3 # Test against python installer
- 2.0.0
before_script: |
hg clone https://code.google.com/p/vim/
cd vim
./configure --with-features=huge --enable-rubyinterp
make
sudo make install
cd -
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.2 ]; then
sudo apt-get update -y
sudo apt-get install -y vim-nox
sudo ln -s /usr/bin/vim /usr/local/bin/vim
else
hg clone https://code.google.com/p/vim/
cd vim
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.3 ]; then
sudo apt-get update -y
sudo apt-get install -y python2.7-dev
./configure --with-features=huge --enable-pythoninterp
else
./configure --with-features=huge --enable-rubyinterp
fi
make
sudo make install
cd -
fi
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
script: |
test/run !

218
README.md
View File

@@ -1,35 +1,36 @@
![vim-plug](https://raw.github.com/junegunn/vim-plug/master/plug.png)
![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)
<img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="56" alt="vim-plug">
[![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)](https://travis-ci.org/junegunn/vim-plug)
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.
![](https://raw.github.com/junegunn/i/master/vim-plug/installer.gif)
<img src="https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif" height="450">
### Pros.
- Easier to setup
- Parallel installation/update (requires
[+ruby](http://junegunn.kr/2013/09/installing-vim-with-ruby-support/))
- Smallest possible feature set
- Easier to setup: Single file. No boilerplate code required.
- Easier to use: Concise, intuitive syntax
- [Super-fast][40/4] parallel installation/update
(with [+python][py] or [+ruby][rb] or [Neovim][nv])
- On-demand loading for [faster startup time][startup-time]
- Can review and rollback updates
- Branch/tag support
- On-demand loading
- Dependency resolution using `Plugfile` (experimental)
- Post-update hooks
- Support for externally managed plugins
### Cons.
- Everything else
[40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
[py]: https://github.com/junegunn/vim-plug/wiki/python
[rb]: https://github.com/junegunn/vim-plug/wiki/ruby
[nv]: http://neovim.org/
[startup-time]: http://junegunn.kr/images/vim-startup-time.png
### Usage
[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 --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
```
Edit your .vimrc
@@ -51,8 +52,11 @@ Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Plugin options
Plug 'nsf/gocode', { 'tag': 'go.weekly.2012-03-13', 'rtp': 'vim' }
" Locally-managed plugin
Plug '~/.fzf'
" 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()
```
@@ -61,39 +65,49 @@ Reload .vimrc and `:PlugInstall` to install plugins.
### 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 |
| `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 |
| `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 |
### Options for parallel installer
### 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 |
| Flag | Default | Description |
| ------------------- | --------------------------------- | ------------------------------------------------------ |
| `g:plug_threads` | 16 | Default number of threads to use |
| `g:plug_timeout` | 60 | Time limit of each task in seconds (*Ruby & Python*) |
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL |
### 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
- `:PlugDiff`
- `X` - Revert the update
### Example: A small [sensible](https://github.com/tpope/vim-sensible) Vim configuration
@@ -115,75 +129,75 @@ 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
`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.
See [Dependency
Resolution](https://github.com/junegunn/vim-plug/wiki/Dependency-Resolution).
### Post-update hooks
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 'Shougo/vimproc.vim', { 'do': 'make' }
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)
### FAQ/Troubleshooting
#### 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.
- [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*
### License

1825
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'

242
test/regressions.vader Normal file
View File

@@ -0,0 +1,242 @@
**********************************************************************
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 (#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 (#130 Proper cleanup of on-demand loading triggers):
augroup PlugLOD
autocmd!
augroup END
" Cleared on command
call plug#begin('$TMPDIR/plugged')
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
call plug#end()
PlugInstall | q
Assert exists(':EmojiCommand'), 'EmojiCommand not defined'
Assert exists(':EmojiCommand2'), 'EmojiCommand2 not defined'
Assert !empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) not defined'
silent! EmojiCommand
Assert !exists(':EmojiCommand'), 'EmojiCommand defined'
Assert !exists(':EmojiCommand2'), 'EmojiCommand2 defined'
Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
" Cleared on FileType
call plug#begin('$TMPDIR/plugged')
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
call plug#end()
Assert exists(':EmojiCommandExtra'), 'EmojiCommandExtra not defined'
Assert !empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) not defined'
setf emoji
Assert !exists(':EmojiCommandExtra'), 'EmojiCommandExtra defined'
Assert empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) defined'
**********************************************************************
Execute (#131 Syntax error):
call plug#begin('/no-permission')
Plug 'junegunn/vim-emoji'
call plug#end()
redir => out
silent PlugInstall
redir END
Assert out =~ 'Invalid plug directory: /no-permission'
**********************************************************************
Execute (#139-1 Using new remote branch):
" Make sure to remove the clone
call plug#begin('$TMPDIR/plugged')
call plug#end()
PlugClean!
" Install master branch
call plug#begin('$TMPDIR/plugged')
Plug expand('file:///$TMPDIR/new-branch')
call plug#end()
PlugUpdate
unlet! g:foo g:bar g:baz
call plug#load('new-branch')
Assert exists('g:foo'), 'g:foo should be found'
Assert !exists('g:bar'), 'g:bar should not be found'
Assert !exists('g:baz'), 'g:baz should not be found'
" Create a new branch on origin
call system('cd $TMPDIR/new-branch && git checkout -b new &&'
\. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
\. 'git commit -m second')
" We're setting up two plugins so that parallel installer is used
call plug#begin('$TMPDIR/plugged')
Plug 'junegunn/seoul256.vim'
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'new' }
call plug#end()
PlugUpdate
silent %y
Log @"
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
unlet! g:foo g:bar g:baz
call plug#load('new-branch')
Assert exists('g:foo'), 'g:foo should be found'
Assert exists('g:bar'), 'g:bar should be found'
Assert !exists('g:baz'), 'g:baz should not be found'
call PlugStatusSorted()
Expect:
- new-branch: OK
- seoul256.vim: OK
Finished. 0 error(s).
[==]
Execute (#139-2 Using yet another new remote branch):
" Create another branch on origin
call system('cd $TMPDIR/new-branch && git checkout master &&'
\. 'git checkout -b brand-new &&'
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
\. 'git commit -m third')
" Test Vim installer here
call plug#begin('$TMPDIR/plugged')
Plug expand('file:///$TMPDIR/new-branch'), { 'branch': 'brand-new' }
call plug#end()
PlugUpdate
silent %y
Log @"
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
unlet! g:foo g:bar g:baz
call plug#load('new-branch')
Assert exists('g:foo'), 'g:foo should be found'
Assert !exists('g:bar'), 'g:bar should not be found'
Assert exists('g:baz'), 'g:baz should be found'
call PlugStatusSorted()
Expect:
- new-branch: OK
Finished. 0 error(s).
[=]
Execute (#139-3 Should fail when not possible to fast-forward):
" Commit on cloned repo
call system('cd $TMPDIR/plugged/new-branch && git checkout master &&'
\. 'touch foobar && git add foobar && git commit -m foobar')
" Different commit on remote
call system('cd $TMPDIR/new-branch && git checkout master &&'
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
for multi in [0, 1]
call plug#begin('$TMPDIR/plugged')
if multi
Plug 'junegunn/seoul256.vim'
endif
Plug expand('file:///$TMPDIR/new-branch')
call plug#end()
PlugUpdate
silent %y
Assert @" =~ 'Not possible to fast-forward', @"
endfor
**********************************************************************
Execute (#145: Merging on-demand loading triggers - cmd):
unlet! g:xxx g:yyy
call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
Plug '$PLUG_FIXTURES/yyy', { 'on': ['XXX', 'YYY'] }
call plug#end()
silent! XXX
Assert exists('g:xxx'), 'xxx is not loaded'
Assert exists('g:yyy'), 'yyy is not loaded'
Assert !exists(':YYY')
Execute (#145: Merging on-demand loading triggers - map):
unlet! g:xxx g:yyy
call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
call plug#end()
Assert !empty(mapcheck("<Plug>(xxx)"))
Assert !empty(mapcheck("<Plug>(yyy)"))
# FIXME feedkeys() cannot be tested with Vader
call plug#load('xxx', 'yyy')
Assert empty(mapcheck("<Plug>(xxx)"))
Assert empty(mapcheck("<Plug>(yyy)"))
**********************************************************************
Execute (#159: shell=/bin/tcsh):
let org = &shell
try
set shell=/bin/tcsh
call plug#begin('$TMPDIR/plugged')
Plug 'junegunn/seoul256.vim'
call plug#end()
PlugStatus
Log getline(1, '$')
q
AssertEqual '/bin/tcsh', &shell
finally
let &shell = org
endtry
**********************************************************************
Execute (#154: Spaces in &rtp should not be escaped):
call plug#begin('$TMPDIR/plug it')
Plug 'seoul256 vim'
call plug#end()
Log &rtp
Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
**********************************************************************
Execute (#184: Duplicate entries in &rtp):
call plug#begin('$TMPDIR/plugged')
Plug 'plugin1'
\| Plug 'plugin0'
Plug 'plugin2'
\| Plug 'plugin0'
\| Plug 'plugin1'
call plug#end()
Log &rtp
AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0'))

View File

@@ -5,24 +5,91 @@ cd ..
PLUG_SRC=$(pwd)/plug.vim
cd - > /dev/null
if [ ! -d vader.vim ]; then
git clone https://github.com/junegunn/vader.vim.git
fi
export PLUG_FIXTURES=$(pwd)/fixtures
rm -rf fzf
if [ ! -d fzf-staged ]; then
git clone https://github.com/junegunn/fzf.git fzf-staged
fi
clone() {
if [ ! -d $2 ]; then
git clone $1 $2
fi
}
# Clone
cd /tmp
mkdir -p junegunn vim-scripts jg
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
vim-oblique vim-pseudocl vim-redis vim-emoji; do
clone https://github.com/junegunn/${repo}.git junegunn/$repo &
done
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
rm -rf $PLUG_FIXTURES/fzf
clone https://github.com/junegunn/fzf.git $PLUG_FIXTURES/fzf-staged &
wait
(cd junegunn/seoul256.vim &&
git checkout no-t_co && git checkout master) > /dev/null 2>&1
clone junegunn/vim-emoji jg/vim-emoji
cd - > /dev/null
make_dirs() {
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', [])
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
}
init() {
rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2}
rm -rf $TMPDIR/new-branch
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 yyy/after yyy
make_dirs z1/ z1
make_dirs z2/ z2
(
cd $TMPDIR
git init new-branch
cd new-branch
mkdir plugin
echo 'let g:foo = 1' > plugin/foo.vim
git add plugin/foo.vim
git commit -m initial
)
}
cat > /tmp/mini-vimrc << VIMRC
set rtp+=vader.vim
set rtp+=/tmp/junegunn/vader.vim
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 &&
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! workflow.vader' > /dev/null
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
init &&
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
else
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader test.vader'
fi

72
test/test.vader Normal file
View File

@@ -0,0 +1,72 @@
Execute (Initialize test environment):
Save &rtp, g:plugs, g:plug_home, g:plug_window
let first_rtp = split(&rtp, ',')[0]
let last_rtp = split(&rtp, ',')[-1]
let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h')
let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h')
set rtp=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
execute 'set rtp^='.vader
execute 'set rtp^='.plug
let basertp = &rtp
unlet! g:plugs g:plug_home g:plug_window
let g:plug_url_format = 'file:///tmp/%s'
set t_Co=256
colo default
pclose
function! PlugStatusSorted()
PlugStatus
%y
q
normal! P
%sort
g/^$/d
endfunction
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>)
function! EnsureLoaded()
if has('vim_starting')
runtime! plugin/**/*.vim
endif
endfunction
Execute (Print Interpreter Version):
redir => out
if has('ruby')
silent ruby puts 'Ruby: ' + RUBY_VERSION
elseif has('python')
silent python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2])
endif
redir END
Log substitute(out, '\n', '', 'g')
Include: workflow.vader
Include: regressions.vader
Execute (Cleanup):
silent! call system('rm -rf '.temp_plugged)
silent! call system('rm -rf '.temp_plugged)
silent! call rename(fzf, expand('$PLUG_FIXTURES/fzf-staged'))
silent! unlet g:plugs
silent! unlet g:plug_home
silent! unlet g:plug_url_format
silent! unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out tabnr found len
silent! delf PlugStatusSorted
silent! delf AssertExpect
silent! delf PlugUpdated
silent! delf EnsureLoaded
silent! delc AssertExpect
silent! unmap /
silent! unmap ?
Restore

View File

@@ -1,50 +1,8 @@
Execute (Initialize test environment):
Save &rtp, g:plugs, g:plug_home, $MYVIMRC
let first_rtp = split(&rtp, ',')[0]
let last_rtp = split(&rtp, ',')[-1]
let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h')
let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h')
set rtp=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
execute 'set rtp^='.vader
execute 'set rtp^='.plug
let basertp = &rtp
unlet! g:plugs
unlet! g:plug_home
set t_Co=256
colo default
pclose
function! PlugStatusSorted()
PlugStatus
%y
q
normal! P
%sort
g/^$/d
endfunction
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>)
let g:vimrc_reloaded = 0
let vimrc = tempname()
call writefile(['let g:vimrc_reloaded += 1'], vimrc)
let $MYVIMRC = vimrc
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
silent! AssertEqual 0, plug#end()
redir END
Assert stridx(out, 'Call plug#begin() first') >= 0
Execute (plug#begin() without path argument):
call plug#begin()
@@ -54,12 +12,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)):
@@ -76,33 +32,33 @@ Execute (Subsequent plug#begin() calls will reuse g:plug_home):
AssertEqual temp_plugged, g:plug_home
Execute (Test Plug command):
" Git repo with branch
Plug 'junegunn/seoul256.vim', 'yes-t_co'
AssertEqual 'https://git:@github.com/junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
^ Git repo with branch (DEPRECATED. USE BRANCH OPTION)
Plug 'junegunn/seoul256.vim', { 'branch': 'yes-t_co' }
AssertEqual 'file:///tmp/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual '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
^ Git repo with tag (DEPRECATED. USE TAG OPTION)
Plug 'junegunn/goyo.vim', '1.5.2'
AssertEqual 'https://git:@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
AssertEqual 'file:///tmp/junegunn/goyo.vim', 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
AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
AssertEqual '1.5.3', g:plugs['goyo.vim'].branch
AssertEqual '1.5.3', g:plugs['goyo.vim'].tag
" Git URI
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
AssertEqual 'https://bitbucket.org/junegunn/vim-emoji.git', g:plugs['vim-emoji'].uri
Plug 'file:///tmp/jg/vim-emoji'
AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri
AssertEqual 'master', g:plugs['vim-emoji'].branch
AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
" vim-scripts/
Plug 'beauty256'
AssertEqual 'https://git:@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
AssertEqual 'file:///tmp/vim-scripts/beauty256', g:plugs.beauty256.uri
AssertEqual 'master', g:plugs.beauty256.branch
AssertEqual 4, len(g:plugs)
@@ -137,7 +93,6 @@ Execute (Yet, plugins are not available):
Execute (PlugInstall):
PlugInstall
AssertEqual 1, g:vimrc_reloaded
q
Execute (Plugin available after installation):
@@ -154,7 +109,27 @@ Execute (PlugStatus after installation):
AssertExpect 'OK', 4
q
Execute (PlugUpdate - tagged plugin should not fail (#174)):
PlugUpdate goyo.vim
Log getline(1, '$')
AssertExpect '^- goyo.vim', 1
q
Execute (Change tag of goyo.vim):
call plug#begin()
Plug 'junegunn/goyo.vim', { 'tag': '9.9.9' }
call plug#end()
Execute (PlugStatus):
call PlugStatusSorted()
Expect:
Invalid tag: 1.5.3 (expected: 9.9.9). Try PlugUpdate.
Finished. 1 error(s).
[=]
x goyo.vim:
Execute (Remove tag of goyo.vim):
call plug#begin()
Plug 'junegunn/goyo.vim'
call plug#end()
@@ -163,7 +138,7 @@ Execute (PlugStatus):
call PlugStatusSorted()
Expect:
Invalid branch/tag: 1.5.3 (expected: master). Try PlugUpdate.
Invalid branch: HEAD (expected: master). Try PlugUpdate.
Finished. 1 error(s).
[=]
x goyo.vim:
@@ -171,7 +146,6 @@ Expect:
Execute (PlugUpdate to set the right branch):
PlugUpdate
call PlugStatusSorted()
AssertEqual 2, g:vimrc_reloaded
Expect:
- goyo.vim: OK
@@ -181,31 +155,53 @@ Expect:
Execute (Change branch of seoul256.vim):
call plug#begin()
Plug 'junegunn/seoul256.vim'
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
Plug 'file:///tmp/jg/vim-emoji'
call plug#end()
Execute (PlugStatus):
call PlugStatusSorted()
Expect:
Invalid branch/tag: no-t_co (expected: master). Try PlugUpdate.
Invalid branch: no-t_co (expected: master). Try PlugUpdate.
- vim-emoji: OK
Finished. 1 error(s).
[==]
x seoul256.vim:
Execute (PlugUpdate to switch branch, then PlugStatus):
PlugUpdate
call PlugStatusSorted()
Expect:
- seoul256.vim: OK
- vim-emoji: OK
Finished. 0 error(s).
[==]
Execute (Change tag of seoul256.vim):
call plug#begin()
Plug 'junegunn/seoul256.vim', { 'tag': 'no-such-tag' }
call plug#end()
call PlugStatusSorted()
Expect:
Invalid tag: N/A (expected: no-such-tag). Try PlugUpdate.
Finished. 1 error(s).
[=]
x seoul256.vim:
Execute (Change URI of seoul256.vim):
call plug#begin()
Plug 'junegunn.choi/seoul256.vim'
Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
Plug 'file:///tmp/jg/vim-emoji'
call plug#end()
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: file:///tmp/junegunn.choi/seoul256.vim
Invalid URI: file:///tmp/junegunn/seoul256.vim
PlugClean required.
- vim-emoji: OK
Finished. 1 error(s).
@@ -238,8 +234,8 @@ Execute (PlugStatus):
call PlugStatusSorted()
Expect:
Expected: https://git:@github.com/junegunn/vim-emoji.git
Invalid URI: https://bitbucket.org/junegunn/vim-emoji.git
Expected: file:///tmp/junegunn/vim-emoji
Invalid URI: file:///tmp/jg/vim-emoji
Not found. Try PlugInstall.
PlugClean required.
Finished. 2 error(s).
@@ -258,7 +254,6 @@ Execute (PlugClean! to remove vim-emoji):
Execute (PlugUpdate to install both again):
PlugUpdate
AssertExpect '^- [^:]*:', 2
AssertEqual 3, g:vimrc_reloaded
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
@@ -266,7 +261,6 @@ Execute (PlugUpdate to install both again):
Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
PlugUpdate
AssertExpect 'Already up-to-date', 2
AssertEqual 4, g:vimrc_reloaded
normal D
AssertEqual 'No updates.', getline(1)
q
@@ -306,7 +300,8 @@ Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
" ]] motion
execute 'normal $]]'
AssertEqual lnum + 4, line('.')
Assert line('.') >= 4
" 5+ for merge commit
AssertEqual 3, col('.')
" [[ motion
@@ -314,6 +309,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
@@ -324,6 +326,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
@@ -331,16 +334,17 @@ 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
PlugUpdate
normal D
AssertEqual 'No updates.', getline(1)
q
AssertEqual 'new-tab', expand('%')
q
AssertExpect '^- ', 1
normal q
AssertEqual tabnr, tabpagenr()
normal! gt
q
**********************************************************************
@@ -361,7 +365,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()
@@ -372,31 +377,33 @@ Execute (Check commands):
Execute (Partial PlugInstall):
PlugInstall vim-fnr vim-easy-align
AssertExpect 'vim-pseudocl', 1
PlugInstall vim-fnr vim-easy-align 1
AssertExpect 'vim-pseudocl', 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):
call EnsureLoaded()
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
@@ -411,7 +418,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()
@@ -441,6 +448,7 @@ Execute (Plug block for following tests):
call plug#end()
" Remove plugins from previous tests
PlugClean!
q
Execute (PlugInstall will only install vim-easy-align):
PlugInstall
@@ -469,7 +477,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
@@ -507,21 +515,46 @@ 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
redir => output
" 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
Assert output =~ 'No plugin to install'
Assert out =~ 'No plugin to install'
redir => output
redir => out
silent PlugUpdate
redir END
Assert output =~ 'No plugin to update'
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
@@ -576,16 +609,467 @@ Execute (Retry failed tasks):
AssertExpect! '[xxx]', 1
q
**********************************************************************
~ Post-update hook (`do` option)
**********************************************************************
Execute (Cleanup):
call system('rm -rf '.temp_plugged)
call rename('fzf', 'fzf-staged')
call plug#begin()
call plug#end()
PlugClean!
q
unlet g:plugs
unlet g:plug_home
unlet g:vimrc_reloaded
unlet temp_plugged vader plug basertp save_rtp repo lnum fzf
delf PlugStatusSorted
delf AssertExpect
delc AssertExpect
Execute (On install):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 'touch installed' }
Plug 'junegunn/vim-pseudocl'
call plug#end()
silent 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^')
silent 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!):
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'
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!):
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 (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-=$PLUG_FIXTURES/xxx/
set rtp-=$PLUG_FIXTURES/xxx/after
Execute (Immediate loading):
call plug#begin()
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 ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
else
AssertEqual ['xxx/plugin', 'xxx/after/plugin', 'xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
endif
Execute (Command-based on-demand loading):
call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
call plug#end()
AssertEqual [], g:xxx
silent! XXX
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin'], g:xxx
setf xxx
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
Execute (Filetype-based on-demand loading):
call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
call plug#end()
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
setf xxx
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
Before:
**********************************************************************
~ plug#helptags()
**********************************************************************
Execute (plug#helptags):
silent! call delete(expand('$PLUG_FIXTURES/xxx/doc/tags'))
Assert !filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
AssertEqual 1, plug#helptags()
Assert filereadable(expand('$PLUG_FIXTURES/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 '$PLUG_FIXTURES/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 '$PLUG_FIXTURES/z1', { 'on': [] }
Plug '$PLUG_FIXTURES/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
unlet g:plug_window
**********************************************************************
~ g:plug_url_format
**********************************************************************
Execute (Using g:plug_url_format):
let prev_plug_url_format = 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
let g:plug_url_format = prev_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 (PlugSnapshot / #154 issues with paths containing spaces):
call plug#begin('$TMPDIR/plug with spaces')
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/seoul256.vim'
call plug#end()
PlugClean!
PlugInstall
call plug#load('vim-easy-align') " Should properly handle paths with spaces
PlugSnapshot
AssertEqual '#!/bin/sh', getline(1)
AssertEqual '# Generated by vim-plug', getline(2)
AssertEqual 'vim +PlugUpdate +qa', getline(5)
AssertEqual 'PLUG_HOME=$TMPDIR/plug\ with\ spaces', getline(7)
AssertEqual 0, stridx(getline(9), 'cd $PLUG_HOME/seoul256.vim/ && git reset --hard')
AssertEqual 0, stridx(getline(10), 'cd $PLUG_HOME/vim-easy-align/ && git reset --hard')
AssertEqual 'sh', &filetype
execute 'PlugSnapshot' g:plug_home.'/snapshot.sh'
AssertEqual 'sh', &filetype
AssertEqual 'snapshot.sh', fnamemodify(expand('%'), ':t')
q
Restore