Compare commits

...

208 Commits

Author SHA1 Message Date
Junegunn Choi
d80f495fab
Allow pressing 'q' to abort the running tasks, then 'R' to retry (#1289)
If you press 'q' while `PlugInstall` or `PlugUpdate` is in progress,
the current version of vim-plug immediately closes its window and aborts
all the running processes.

This commit enhances the 'q' map so that it doesn't close the window,
but instead displays the aborted tasks so that the user can press 'R' to
retry the tasks.

Fix #1285
2024-07-09 20:09:41 +09:00
Junegunn Choi
d863d07832
Add more explanation on plug#end() 2024-06-19 20:05:15 +09:00
Junegunn Choi
b98b66242b
Fix PlugClean when &shell is powershell on Windows (#1283) 2024-06-18 18:02:36 +09:00
Junegunn Choi
db37a8a29a
Update comment in plug.vim 2024-06-01 15:58:29 +09:00
Junegunn Choi
7095372c4b
Add colorscheme example (should be loaded after plug#end()) 2024-06-01 15:40:24 +09:00
Junegunn Choi
3f1daea5bd
Adjust heading levels in README 2024-05-15 03:07:01 +09:00
Junegunn Choi
9b4ecd1bb5
Update documentation (#1280) 2024-05-14 19:06:23 +09:00
Junegunn Choi
c0992146e2
Update README 2024-05-14 17:20:08 +09:00
Junegunn Choi
47ca942ea4
Update README 2024-05-14 16:57:04 +09:00
Junegunn Choi
d977fa3786
Do not remove 'frozen' plugins on PlugClean
Close #1152
2024-03-31 00:53:55 +09:00
Junegunn Choi
24d7ac280f
Remove dead code
Close #1194
2024-03-29 13:02:03 +09:00
Junegunn Choi
2cd7bf673b
README: Fix typo 2024-03-15 23:16:01 +09:00
Junegunn Choi
d54f8d5bbd
README: Use markdown alerts (#1276) 2024-03-15 21:22:16 +09:00
Junegunn Choi
61b6df67b4
Update examples 2024-03-14 19:11:37 +09:00
Junegunn Choi
94b7aa99a9
Update README and vimdoc 2024-03-07 23:41:50 +09:00
DanielApt
03a9bb6d84
Add reload/restart step to usage section (#1255)
Reloading the .vimrc should be part of the usage section, not the example section.
2024-03-07 23:31:28 +09:00
Junegunn Choi
854b081934
Open vim-plug window in a new tab (#1274)
* Open vim-plug window in a new tab not to disrupt the current window layout
* Open preview window on the right to better show the diff

If you prefer the old layout, use the following configuration:

    let g:plug_window = 'vertical topleft new'
    let g:plug_pwindow = 'above 12new'
2024-03-07 01:16:12 +09:00
R. N. West
3049761d47
Add dark mode vim-plug logo and use correct logo version in README (#1267) 2024-03-07 01:14:08 +09:00
Junegunn Choi
ed19478ce2
Keep track of the default branch of the origin (#1272)
Fix #1005

vim-plug will now run `git remote set-head origin -a` on PlugUpdate to
keep track of the default branch of the origin, so that it can still
update a plugin even if its default branch has changed.

This additional command will slow down the update process, but this is
an unavoidable price to pay for the correctness of the task. However,
vim-plug will run checkout and merge commands in parallel, so this
improvement will slightly offset the slowdown.
2024-03-07 00:18:49 +09:00
Junegunn Choi
e2974a3367
Fix PlugClean error when the default branch has changed (#1269)
Fix #1253
2024-03-05 16:13:23 +09:00
Junegunn Choi
2f8f04cf79 Reset &rtp before 'do' to invalidate Neovim cache of loaded Lua modules 2024-02-24 23:07:55 +09:00
Junegunn Choi
3264b81e7a Update plug.vim 2024-02-24 23:07:55 +09:00
Jongwook Choi
64b9f9e3c3 Source lua files (if any) from rtp when loading a plugin
Neovim 0.5.0 allows lua files to be used in runtime files (such as
plugin, ftdetect, etc.) as well as vimscript files. Indeed, some
plugins have `plugin/*.lua` scripts only, but not `plugin/*.vim`;
such plugins cannot be sourced and work properly if it is lazy-loaded.
2024-02-24 23:07:55 +09:00
Junegunn Choi
6154433e22
README: Lambda expression as post-update hook 2024-02-23 01:14:44 +09:00
Junegunn Choi
eee20c7e79
Update README: warp.dev 2024-02-15 14:29:51 +09:00
Junegunn Choi
ade078e362
Update README: warp.dev 2024-02-13 08:45:04 +09:00
Junegunn Choi
6dd068e8d8
Tidy up 2024-02-03 20:05:06 +09:00
Junegunn Choi
e07c18608f
Add Lua configuration example
Close #1258
2024-02-03 20:02:13 +09:00
wsdjeg
ca0ae0a8b1
Update builde status icon (#1238) 2023-04-01 23:59:21 +09:00
Alexis Corporal
034e844590
README: Change scrooloose/nerdtree to preservim/nerdtree (#1226)
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2023-01-19 11:35:13 +09:00
Junegunn Choi
ddce935b16
Revert "Add Sponsor Labels action"
This reverts commit e531dbec2a.
2022-09-13 09:43:33 +09:00
Junegunn Choi
e531dbec2a
Add Sponsor Labels action 2022-09-10 11:28:27 +09:00
Junegunn Choi
b6739f358b
Update ISSUE_TEMPLATE: Require plug block contents 2022-09-06 11:06:26 +09:00
Eduardo Leggiero
f308ef394e
Update username of NERDTree plugin (#1208) 2022-09-05 09:34:39 +09:00
Stefan Muenzel
d94d234548
Add .gitignore (#1204) 2022-08-17 20:25:08 +09:00
Junegunn Choi
d6cb65753f
Explicitly address the side-effects of plug#end() in the example
Close #1182
2022-08-01 09:17:35 +09:00
Junegunn Choi
87a160a1c3
Create FUNDING.yml 2022-07-30 19:54:42 +09:00
Junegunn Choi
8fdabfba0b
PlugDiff: Press enter on the name of a plugin to see the full diff
Close #1174
2022-05-03 23:10:00 +09:00
Karl Yngve Lervåg
be55ec46b5
Check the actual value g:did_load_filetypes (#1176)
This resolves the issue described in #1175.
2022-04-21 22:54:02 +09:00
Junegunn Choi
93ab590978
Include plugins with 'commit' values in PlugSnapshot output
Fix #1167
2022-04-04 11:52:45 +09:00
Junegunn Choi
e300178a0e
Change the default plugin directory for Neovim
And suggest users to call plug#begin() without an argument to avoid
confusion.
2022-01-03 23:05:08 +09:00
Shawn Hatori
f085751ca1
README: Clarify recommended plugins directory for Windows Vim (#1151) 2022-01-03 22:47:53 +09:00
Jaehwang Jerry Jung
68488fd7a3
Fix unexpected cursor movement on on-demand imap loading (#1147)
`i_CTRL-O` may change the cursor position in an unexpected way.
For example, when `autoindent` is set, the user will expect that
`i  asdf<CR><C-O>` will place the cursor right below `a`.
However, `<C-O>` moves the cursor to the first column of line 2.

Expected:
```
  asdf
  █
```
Actual:
```
  asdf
█
```

Therefore, it's desirable to use `i_CTRL-\_CTRL-O`, the variant of
`i_CTRL-O` that does not move the cursor.
2021-12-06 14:26:19 +09:00
Junegunn Choi
93a115718f
Migrate to GitHub Actions
Close #1128

TODO:
- Neovim stale/unstable
  - https://github.com/junegunn/vim-plug/runs/4422576984?check_suite_focus=true#step:3:238
- Vim 7.4
  - Ruby parallel installer
  - Python parallel installer
2021-12-05 23:42:23 +09:00
Gibson Fahnestock
c9971346bb
Set --origin=origin for git clone commands (#1117)
Otherwise if the user has set a `git config clone.defaultRemoteName
foo`, then vim-plug will fail to detect the latest upstream changes as
the remote will be incorrect, and will repeatedly state that the plugin
repo needs to be cleaned.
2021-08-31 17:14:37 +09:00
Matúš Ferech
66e038d443
Add --create-dirs option to flatpak installation instrictions (#1126) 2021-08-29 17:20:58 -04:00
Gerald
fc2813ef44
Recognize pwsh(.exe) as PowerShell (#1090)
Fix #1065
2021-04-30 16:29:04 +09:00
Rosen Stoyanov
cffcfe150b
Add GV.vim-style q mapping (#827)
* Add GV.vim-style q mapping

* Fix test cases

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2021-02-08 16:23:21 +09:00
mattn
8b45742540
Disable credential.helper for git fetch (#1046) 2020-12-14 14:30:44 +09:00
Dylan
5430b6213a
XDG_DATA_HOME respecting powershell script (#1042)
This version supports Powershell 5.1 (shipped in the latest install of Windows 10)
2020-12-03 22:46:45 +09:00
Junegunn Choi
2f4e28161e
Set empty credential.helper only when git 2.0 or above is available
Fix #1031
2020-11-03 22:55:17 +09:00
Subhaditya Nath
ab940f624a
Fix syntax matches (#1028)
Previously, the highlight of the `------------` line below the `Last Update:`
changed from `plugH2` on the whole line to `plugDash` on the first `-`
when the cursor moved over it and went below it. This commit updates the
`syn match` commands a bit to correct that issue.

Close #1027
2020-10-23 00:05:18 +09:00
mattn
c44422460e
Disable credential-helper (#1026) 2020-10-20 20:48:58 +09:00
Junegunn Choi
d16273e072
Code cleanup 2020-09-08 22:39:56 +09:00
mattn
b17f477585
Reduce the number of git processes for faster operation (#937)
* Make git operation faster

When using many plugins, vim-plug may spawn many git processes for them.

* get revision
* get branch
* get remote.origin.url

This is too heavy. especially on Windows. This change get revision, branch,
remote origin url directly from .git directory.

This idea is borrowed from @k-takata's commit for minpac.

Executing external programs is slow especially on Windows.
Read the information directly from .git directory.

* Copied from devel branch of minpac

* Avoid errors

* Show errors

* Use empty()

* Use empty string instead of v:null

* Check spec.branch is empty

* Use branch

* Fix branch and revision

* Remove l: and use s:trim

* Fix and simplify s:git_get_remote_origin_url

* Do not cut off commit hash for correctness

Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
2020-09-08 22:13:21 +09:00
Junegunn Choi
4a3e85e878
Test Neovim on Bionic
https://github.com/neovim/neovim/pull/12802
2020-09-08 17:27:20 +09:00
Junegunn Choi
a9bf5bd722 "non-master branch" -> "non-default branch" 2020-08-30 02:05:50 +09:00
Junegunn Choi
e8892a9bef Update test cases 2020-08-30 02:05:50 +09:00
Junegunn Choi
49be3a8ca9 Use branch name of origin if not specified 2020-08-30 02:05:50 +09:00
Junegunn Choi
95ef5e8d5f PlugDiff should be able to find pending updates
# We need the name of the default branch of origin
  git checkout some-tag-or-commit
  git log ..origin/master
2020-08-30 02:05:50 +09:00
Junegunn Choi
6fa6475fee User-specified branch name should not be empty 2020-08-30 02:05:50 +09:00
Yasuhiro Matsumoto
588467903b Use branch 2020-08-30 02:05:50 +09:00
Yasuhiro Matsumoto
5706f70f8f Add missing function 2020-08-30 02:05:50 +09:00
Yasuhiro Matsumoto
4a3c5e7ac2 Support non-master default branch 2020-08-30 02:05:50 +09:00
David Barnett
d53d5a976f
Add |:Plug| tag in help docs (#951) 2020-08-29 10:43:05 +09:00
timm bangma
13ea184015
Update README.md (Powershell Install One-Liner) (#1003)
A tidy one liner for the powershell install command. 
Much like the unix one 😄
2020-08-08 18:25:59 -04:00
Raphael Martin Schindler
457bebcd30
Fix typos (#1001)
Add missing 'the' in some phrases and sentences.
Use "Easy", not "Easier", because there are no comparisons in the same sentence or phrase.
2020-08-02 11:52:56 -04:00
Jan Edmund Lazo
b2133cf2ec
Support Windows shell without extension (#997)
Close https://github.com/junegunn/vim-plug/issues/995

Vim supports omitting file extensions for its option.
I omitted the file extension in Neovim's documentation for powershell.
2020-07-20 07:59:29 -04:00
Jan Edmund Lazo
c319036396
Fix #961 tests for Vim 7.4 (#990)
Use build stages to group related jobs (Vim, Neovim, Vim 7.4).
Use "silent" to avoid hit-enter prompt when redirecting output.
Always run async and sync tests to debug runtime errors. 
Vim 7.4.0052 (Ubuntu Trusty) does not allow dynamic keys in inline dictionary.

https://docs.travis-ci.com/user/build-stages/
2020-07-06 01:07:42 -04:00
Wolf Honore
3aa3b5a4e8
Report when PlugClean fails to remove a directory (#985) 2020-06-25 20:56:47 +09:00
Junegunn Choi
01aab60ade
Fix PowerShell instruction for Neovim
Close #976
2020-06-08 23:48:55 +09:00
Jan Edmund Lazo
6583b99032
:Plug throws error for invalid option (#961)
":Plug" performs a quick type check for most options so that the user can check which plugin has invalid configuration on startup. This does not prevent errors, resulting from modiying "g:plugs" after running "plug#end()". Plugin repo is added to the error message for convenience. Most users should expect no noticeable difference in startup time.

Close: #930
Related: #936
2020-06-03 07:34:44 -04:00
Gianluca Recchia
71c41fccf5
Comply with the XDG protocol in the README (#966) 2020-05-06 19:57:50 +09:00
Stefano
8846bc6af1
Add Flatpak installation instructions to README.md (#846)
Tested with https://flathub.org/apps/details/io.neovim.nvim
2020-05-05 21:54:46 -04:00
Harshad Srinivasan
0862a76fdd
Updated readme (#967)
Co-authored-by: Harshad Srinivasan <harshad.srinivasan@lmi3d.com>
2020-05-05 21:28:53 -04:00
Junegunn Choi
54d837fa54
Load plugin before running funcref hook
Fix #964
Fix https://github.com/junegunn/fzf.vim/issues/1008
2020-05-03 16:59:22 +09:00
Jan Edmund Lazo
e718868e85
Use list type for command in s:spawn() (#959)
This allows Neovim to bypass the shell and run git directly.
Vim still needs the shell because of how commands are collapsed on Windows and because setting the job's working directory via "cwd" does not work.

Refactored s:clone_opt to a list to make this possible.
2020-04-11 10:49:47 -04:00
Jan Edmund Lazo
668bc0fd2a
Support list type command for s:system to reduce batchfiles on Windows (#956)
* s:system supports list type for command

Objective is to reduce batchfiles on Windows.
List type gives more flexibility on s:system()
on how to pass the shell command to the builtin system().
If system() supports list type for command
and there is no working directory, run it directly on system().
Targets Neovim only.
Else, convert the list to an escaped command
so that the user's shell can execute it.
Neovim's system() does not support working directory system()
so consider refactoring s:system to use a synchronous job.

* Do not escape simple shell arguments

Regexp taken from vim-fugitive s:shellesc().

* Set shellredir on Windows

Prep to use list type for command  passed to s:system() within s:spawn()

* Internalize shellredir for s:spawn

s:spawn needs to redirect stderr to stdout for jobs callbacks
but s:system (for old Vim versions) sets shellredir if needed.

* Leverage job api for cwd and stderr

Vim/Neovim support stderr redirection and support error callbacks.
Vim 8 and Neovim can set a job's working directory via 'cwd' key
but it cannot be used as is on Vim because CI fails for the Vim release in Ubuntu Bionic and the latest Vim release.
2020-04-10 15:40:28 -04:00
Henré Botha
c3b6b7c297 Clarify error message (#931)
The existing error message printed when plug#end() is called without
calling plug#begin() doesn't make the dependence on plug#begin()
obvious; I had to go digging in the vim-plug code to discover what I'd
done wrong. This attempts to clarify the error a bit, to make it more
obvious to a user.
2020-01-27 22:48:16 +09:00
Jan Edmund Lazo
2f5f74e5e6
Validate last buffer line of g:plug_window (#927)
Close #926

This fix shouldn't be necessary
because vim-plug's buffer should always have 4 lines
but a buffer can be modified in some cases
before nvim 0.4.0 and vim v8.1.1360.
2020-01-05 19:59:59 -05:00
Jan Edmund Lazo
b2aa5724c0
Use iconv() only if +iconv is enabled. (#921)
TODO: Avoid iconv() for commands using ascii only.
2019-12-27 22:35:49 -05:00
Jan Edmund Lazo
359ce90b9b
Encode batchfile in current codepage. (#913)
Changing chcp breaks cmd.exe if switching from multi-byte to 65001.
cmd.exe depends on codepage to parse batchfile
so batchfile cannot have unicode characters.
Target powershell if unicode support is required.

User should fix their terminal font to display unicode characters.
Terminal programs can only use Wide String APIs.
For Vim, this requires +multi_byte feature and `set encoding=utf-8`
in the user's vimrc.
Neovim always defaults to `set encoding=utf-8`.

https://dev.to/mattn/please-stop-hack-chcp-65001-27db
2019-12-11 08:28:49 -05:00
Jan Edmund Lazo
e6ed2e5658
Do not show git signatures in diff window (#918)
git v2.10.0 adds "log.showSignature" config
so that "git log --show-signature" runs by default.
Changing the commit format via "--pretty" does not prevent the signature
from appearing.
Only "--no-show-signature" prevents this.

Close #728
2019-12-09 23:26:56 -05:00
Jan Edmund Lazo
897ce5e2fa
Set/unset shellslash on jobstart (#917) 2019-12-07 01:05:57 -05:00
Jan Edmund Lazo
d2f8ca2dbc
Detect shellslash on Windows (#916)
Warn user if shellslash and shell are incompatible.

Set/unset shellslash for file functions on Windows. Based on 16fc6862a8/plugin/fzf.vim (L30-L107)

Support shellescape for git-bash
Windows user may not set shellslash but wish to use git-bash.
This requires custom shellescape for sh,bash shells
because builtin shellescape() depends on shellslash.
Tested on Vim
2019-12-05 19:34:41 -05:00
Jan Edmund Lazo
93b702512d
Fix shellescaping for git refs and batchfile on Windows (#909)
It was using s:esc() which escapes spaces with a backslash.
This does not work on Windows.

&shell could be escaped on because of spaces.
See patch-8.0.1455 and related 8.1.x patches that address this
for $SHELL on Unix and git-bash on Windows.

Related #852, #908 
Close #890
2019-12-01 21:01:17 -05:00
Jan Edmund Lazo
68fef9c2fd
Delete batchfile only if it exists (#901)
Close #900
2019-11-03 21:10:37 -05:00
Daniel Hahler
eee50c55bf Use s:path with s:rtp always (#694)
Having a trailing slash with &rtp entries is problematic when removing
them later: if loading on demand is used, s:reorg_rtp might fail to
remove the previous runtime paths.

Test case has been using maktaba (which triggers unsetting s:middle in
s:reorg_rtp), but because of the trailing slashes being used, the
previous rtp entries were not removed.
2019-10-20 21:52:29 -04:00
Jan Edmund Lazo
96046c01c3
Detect WSL (Neovim only) (#887)
`has('wsl')` works since Neovim v0.3.0 (5d2dd2ebe2)

Fix: https://github.com/junegunn/vim-plug/issues/821
2019-10-14 13:38:26 -04:00
Jan Edmund Lazo
fcfd5b7e1f
Use chcp only if sed is in PATH (#891)
chcp parsing is fragile because of the system locale. There's no convenient way to parse out the codepage value without regex just by relying on cmd.exe builtins and default binaries in PATH.

Vim can be used to parse chcp output but it requires an additional `system` per `s:system` and `chcp` can change within the same console so caching the value won't work on the terminal.

Powershell supports regex but it has a long startup even with `-NoProfile` so running it when `&shell` is not powershell slows down `:PlugInstall` more.
2019-10-14 07:55:41 -04:00
Jan Edmund Lazo
849b76be90
Fix chcp parsing for the current codepage (#888)
Relying on delimiters or token positions is fragile.
Last value of 'chcp' output is always a number.
2019-10-03 21:19:11 -04:00
Roman Frołow
ff97806e50 Add path for Neovim on Windows (#789)
Neovim provides `stdpath` to abstract the directory paths that it uses based on the OS. It respects `XDG` specification on Linux and uses `%LOCALAPPDATA%` on Windows. 

1. Use `stdpath('data') . '/plugged'` for plugin directory.
2. Use `stdpath('config')` for user-config directory. This is `~/.config/nvim/` on Linux and `%LOCALAPPDATA%\nvim\` on Windows.
2019-09-28 20:30:50 -04:00
gh4w
68b31a4a66 output of chcp was not parsed correctly (#886)
* output of chcp was not parsed correctly

On Windows, when wrapping a batch command with the function s:wrap_cmds(),
when calling 'chcp' to get the current code page, the code assumed that
the output was in the format "active code page: XXX" (where XXX is the
code page), whereas the actual output is localized (for instance, in
French, the output would be: "page de code active: XXX").
The parsing of the output relied on that, and this failed for a
message different from "active code page" (i.e., English).

This patch changes the parsing to split the output of chcp on the colon
instead of spaces. Assuming that the output is always in the format
"<localized message>: XXX", regardless of the locale, hopefully, this is
a bit more robust.
2019-09-28 20:10:13 -04:00
Junegunn Choi
46f843aafe
Add collaborators section 2019-09-03 10:52:29 +09:00
Jan Edmund Lazo
ebd534c88b
Travis: use default image for osx (#871)
Fix https://travis-ci.org/junegunn/vim-plug/jobs/573145961#L211-L217
2019-08-17 16:51:07 -04:00
Jan Edmund Lazo
3b29e1e6e2 Travis: add macOS 10.14 (#870) 2019-08-18 00:44:24 +09:00
Jan Edmund Lazo
307b0f244d travis: add ubuntu bionic,xenial (#867)
Travis defaults to it since this year.
Ubuntu trusty reached EOL since April 2019.
Ubuntu bionic provides Vim 8.

Simplify OS install with Travis' apt addon
so that only Vim nightly will be compiled from source.

Ubuntu 14.04.6 provides ruby v.1.9.3, not 1.8.x or older.
Use it to test the ruby provider for backward compatibility.

Signed-off-by: Jan Edmund Lazo <jan.lazo@mail.utoronto.ca>
2019-08-17 12:46:08 +09:00
Jan Edmund Lazo
8a44109329 Fix Windows support for Unix shells and powershell (#860)
Excerpt from `:h shell-powershell`:

  To use powershell (on Windows):

    set shell=powershell shellquote=( shellpipe=\| shellxquote=
    set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command
    set shellredir=\|\ Out-File\ -Encoding\ UTF8
2019-08-16 17:55:17 +09:00
Minsoo Kim
0b32d2d23e Update YCM path: Valloric -> ycm-core (#869) 2019-08-13 23:15:51 +09:00
Jan Edmund Lazo
226d6abeb2 Don't override shell on Windows (#856)
Assume that the user set the shell options correctly
before running vim-plug so that the user can use bash or powershell
as their shell.

Close #815
2019-07-16 09:06:27 +09:00
Harry Moreno
fddbcb8f1a Change PlugClean description (#853)
Be more clear about uninstalling plugin directories.
2019-07-09 16:16:02 +09:00
Jan Edmund Lazo
f1ad2d864a Escape batchfile path on Windows (#850)
Close #832
2019-06-17 23:00:59 +02:00
Junegunn Choi
08e78d8a5e
Avoid downward search when using finddir
Close #750
2019-05-29 18:29:11 +09:00
Junegunn Choi
518a3566c3
Escape arguments to git command during PlugUpgrade
Fix #832
2019-04-11 17:53:13 +09:00
Daniel Hahler
d1c19a6fa9 Travis: rename vim72 to vim74 (#723) 2019-02-22 11:14:16 +09:00
Nate Fischer
734d9a11b5 Use 'rtp' option to filter diff (#798)
Previously, `:PlugDiff` would show every new commit to a plugin's git
repo. This makes sense for the general case, but makes less sense when a
plugin lives in a subdirectory of the repo (and is configured with the
'rtp' option). This makes it difficult to determine which commits relate
to the plugin and which are unrelated.

This changes `:PlugDiff` to filter out any commits outside of the 'rtp'
folder.

Some consequences:

 * This does not change the `:PlugUpdate` UI. This means `:PlugUpdate`
   may pull down non-plugin commits, display that it has updated the
   plugin, and then `:PlugDiff` will show no updates (since such commits
   fall out of the 'rtp' path).
 * It also means there's no UI to revert non-plugin updates, as they
   don't show up in `:PlugDiff`.
2018-11-04 03:00:00 +09:00
Junegunn Choi
b6050d6f03
Allow cloning into an empty directory (#782)
Close #766

We can rely on git to check if the destination directory is empty.
2018-09-12 13:45:38 +09:00
Junegunn Choi
7f8fdd0444
Ignore useless use of on-demand loading (#786) 2018-09-12 13:40:33 +09:00
Samuel D. Leslie
8ed2617ba0 Add support for parallel fetching of Git submodules (#784)
Git v2.8 introduced support for parallel fetching of submodules. This
can result in a substantial performance boost when performing a "git
submodule update" in a repository with many submodules, potentially
further magnified when updating submodules recursively.

This commit introduces a check on the Git version to see if it supports
parallel submodule fetching. If it does, we add the '--jobs=N' argument
to our call to "git submodule update", where N is g:plug_threads or the
vim-plug default of 16.
2018-09-06 14:48:54 +09:00
Árni Dagur
0a255ee62d Clear colorcolumn in vim-plug buffer (#779) 2018-08-08 10:52:00 +09:00
dohq
e0ca037a4f has('win32') is enough for detecting Windows (#765) 2018-06-20 18:18:50 +09:00
Junegunn Choi
f80eed7379
Add <plug>(plug-preview) map (#769)
This allows you to override the default behavior of `o' or `<cr>'
binding in PlugDiff window.

e.g.
    " Move to preview window
    autocmd! FileType vim-plug nmap <buffer> o <plug>(plug-preview)<c-w>P

Close #749
Close #768
2018-06-20 18:09:06 +09:00
WADA Takashi
fef4e434ba Fix Windows batch file format (#755)
`writefile()` always output LF without CR each lines.
But batch file on Windows needs CR and LF, at end of lines.

And if the path of home directory contains non-ASCII
characters like Japanese username (e.g. `C:\Users\太郎`),
batch file without CR can't be executed correctly.
2018-05-12 11:21:17 +09:00
Daniel Hahler
e6a775e0df Fix handling of changed up-to-date msg from Git (#724)
The msg was changed from 'Already up-to-date' to 'Already up to date'.
2018-03-04 13:43:13 +09:00
Junegunn Choi
96375cb7d3
Update README and add vim help file
Close #705
2017-11-27 00:58:29 +09:00
Junegunn Choi
2f4dc4d482
Add link to automatic installation instructions
Close #711
2017-11-27 00:15:46 +09:00
Daniel Hahler
9813d5ead5 Display not-loaded status with all plugins that have a dir (#547) 2017-10-15 18:12:15 +09:00
Junegunn Choi
ddc67fc136
Fix helptags generation for plugins with custom rtp
Close #684
2017-09-25 00:00:03 +09:00
Junegunn Choi
cd44b03db2
Remove extra quotes in PlugDiff output (#680) 2017-09-20 11:28:52 +09:00
Jan Edmund Lazo
4f95bce2f4 Fix PlugDiff for Windows (#681)
Close #680
2017-09-20 11:02:54 +09:00
Jan Edmund Lazo
7f96c98b0a Prepend 'silent' to ':!' to avoid hit-enter prompt (#678)
Close #606

Fix for GVim on Windows.
2017-09-19 13:53:35 +09:00
Jan Edmund Lazo
05c8983d1a Port fzf#shellescape (#676)
Close #635
Close #668
Close #539

Use a temporary batchfile for :!, system(), and jobs and run it in cmd.exe.
This bypasses Vim/Neovim issues in Windows and reduces the need to set more options.
Also, s:shellesc_cmd works in a batchfile only.

Set shellredir for system() in Windows
$SHELL sets the default value of 'shell' (see :h 'shell').
This affects shellredir but cmd.exe requires '>%s 2>&1'.
2017-09-19 10:37:22 +09:00
Junegunn Choi
b93975f794 Fix Travis CI build (dist: trusty) (#670) 2017-09-10 03:38:38 +09:00
Junegunn Choi
88cc9d7868 Create LICENSE 2017-07-10 13:21:14 +09:00
Andrew Pennebaker
cd39fa6133 Hard-wrap installation instructions for Windows (#649)
Long snippets are sometimes difficult to fully select in a Web browser.
Hard wrapping snippets to make them easier to grab.
2017-07-01 00:26:04 +09:00
Junegunn Choi
449b4f1ed6
Disallow using standard Vim plugin directory as plug home
Close #646
2017-06-27 17:44:12 +09:00
Junegunn Choi
802b100415
Extend plug#load to process a list of names instead of varargs
Allows `call plug#load(keys(g:plugs))` for manually loading all plugins
at once. Close #638.
2017-06-06 16:17:31 +09:00
Junegunn Choi
06992bcfb9 Update installation instruction for Neovim on Windows (#634)
Close #633
2017-05-19 03:17:46 +09:00
Junegunn Choi
f7e6a86807
Deprecate implicit vim-scripts expansion
vim-scripts.org is no longer maintained.

Close #625
2017-05-01 21:31:57 +09:00
Daniel Hahler
61ffb61615 Travis: VADER_OUTPUT_FILE=/dev/stderr for neovim (#618) 2017-04-17 02:47:15 +09:00
Daniel Hahler
9dcab48628 Load plugins only once in plug#load (#616)
When loading 'deoplete.nvim' for the 2nd time during InsertEnter
manually, the `s:dobufread` (or `s:lod` itself) prevents it to work
properly - likely because the plugin gets resourced.

Maybe there could be a way to force this (and reload plugins always),
but by default it seems to make sense to skip already loaded plugins.
2017-04-17 02:46:02 +09:00
Andrew Nowak
1d3c88292b Fix invalid diagnosis of PlugStatus with wildcard tags (#619) 2017-04-14 10:13:49 +09:00
Justin M. Keyes
580f0a559c nvim: Enable job-control nvim 0.2+ (#617)
Closes #583
References https://github.com/neovim/neovim/pull/6497
2017-04-12 11:10:09 +09:00
Junegunn Choi
46ae29985d
Proper escaping of tag patterns
Close #610
2017-04-04 17:45:37 +09:00
Christian Rondeau
7f4e6cb843 Fix crlf in clones under cygwin (#608)
Close #497
2017-03-13 01:09:25 +09:00
Junegunn Choi
769192d3d0
Append -- to git checkout commands
Checking out a branch or tag may not succeed if there is a path entry
with the same name. This commit appends -- to git checkout commands to
clarify that we're not referring to a file or a directory.

Close #602
2017-02-26 03:35:45 +09:00
Junegunn Choi
e3252aae2c
Commit hash in PlugDiff output can be longer than 7 characters
Close #597
2017-02-17 13:33:32 +09:00
Junegunn Choi
f551a71688 Add plugin to &rtp before running post-update hook with : prefix
Close #593
2017-02-11 23:27:52 +09:00
Junegunn Choi
e80a93d5d0
Fix Ruby installer on macOS system Vim
- Do not use io/console
- Interrupting threads crashes Vim, so don't do it

Close #592
Related #537, #538
2017-02-11 11:17:47 +09:00
Junegunn Choi
d1ac3cdd1f
Do not use nomodeline when triggering BufRead
Close #587
2017-02-03 13:29:05 +09:00
Nikita Slepogin
359a65230e Fix job_start with spaces in path in Windows (#588)
Close #586 
Close #565
2017-01-31 21:19:48 +09:00
Junegunn Choi
5e6bd469ac
Update README 2017-01-30 02:20:36 +09:00
Junegunn Choi
8c1aff151d
Update README 2017-01-30 02:19:53 +09:00
Junegunn Choi
d6bda025f1
Fix Vim 8 installer on Windows when path contains spaces
Close #565
2017-01-29 18:23:05 +09:00
Junegunn Choi
5fc9eab788
Add --sync flag to Plug{Install,Update}
Installer is not synchronous when started on VimEnter since
has('vim_starting') returns 0 in that case. We needed a way to make the
installer synchronous.

Related: #574
2017-01-04 02:00:00 +09:00
Junegunn Choi
93ffcb36de
Commit preview should work with non-POSIX-compliant &shell
Close #572
2017-01-02 13:06:51 +09:00
Daniel Hahler
d5e9f91c7b Travis CI: sudo: false (#561) 2017-01-01 12:08:09 +09:00
Daniel Hahler
0b1343b582 test/run: shellcheck fixes (#562) 2016-12-30 11:29:00 +09:00
Junegunn Choi
f916aabfbe
Update documentation
/cc @accolade
2016-12-19 01:59:24 +09:00
Junegunn Choi
b50f9bb16b
More description on plug#end
Related: #379
2016-12-18 12:12:57 +09:00
Junegunn Choi
8180692f81
Update usage examples
vim-plug has no support for dependencies. Remove comment that has been
a source of confusion. #544
2016-12-18 12:06:19 +09:00
Junegunn Choi
a4aac4cf56
Do not check Ruby interface when parallel update is not needed
In case Ruby interface is completely broken that simply running
`:ruby require 'thread'` crashes Vim.

Close #564
2016-12-13 12:26:13 +09:00
Marco Hinz
5bccd9bc98 Neovim: use "dict" when referring to "self" (#566) 2016-12-13 12:25:46 +09:00
Daniel Hahler
1540764563 git_validate: better error with checkout being ahead/diverged (#546) 2016-12-11 21:43:44 +09:00
Daniel Hahler
b9022d9046 test/workflow.vader: minor Assert improvement (#563) 2016-12-11 21:25:33 +09:00
Junegunn Choi
c53ecd3acd
Update installation instruction for Neovim
Suggest directories conforming to XDG Base Directory Specification.

Close #559
2016-12-10 18:25:21 +09:00
Junegunn Choi
ca0b726f46 Merge pull request #558 from HiPhish/nospell
Do not check spelling in vim-plug buffers
2016-12-04 01:03:05 +09:00
HiPhish
942f994844 Do not check spelling in vim-plug buffers 2016-12-03 12:30:51 +01:00
Junegunn Choi
6ad18f5fb8
Ignore trailing ! in proxy command name
Close #557
2016-11-26 12:22:55 +09:00
Junegunn Choi
46ddb4af2d
Set the default completion type of proxy command to "file"
Though we do not know the completion type of a command until the command
is loaded, setting it to file seems like the best thing we can do.
2016-11-10 12:03:37 +09:00
Junegunn Choi
54683aa2c7 Merge pull request #552 from midchildan/fix-git-version
Fix git version detection
2016-11-04 00:38:09 +09:00
midchildan
8f38888fad
Fix git version detection. 2016-11-03 22:38:45 +09:00
Junegunn Choi
abbbe914f0
Remove unnecessary operations 2016-10-29 04:46:58 +09:00
Junegunn Choi
1f4e3eb063
No need for filetype off unless g:did_load_filetypes exists
Reference: https://github.com/tpope/vim-pathogen/pull/26
2016-10-28 00:13:12 +09:00
Junegunn Choi
2fa2761b99 Merge pull request #545 from srstevenson/set-nolist
Set nolist in vim-plug buffers
2016-10-27 12:48:26 +09:00
Scott Stevenson
078f32142d
Set nolist in vim-plug buffers 2016-10-26 22:30:41 +01:00
Junegunn Choi
49c6b781e0
Do not prepend COUNT"REGISTER when feeding keys in insert mode
Close #543
2016-10-25 23:12:05 +09:00
Junegunn Choi
f4427b97f1 Merge pull request #541 from junegunn/vim8
Asynchronous +job installer on Vim 8
2016-10-19 08:10:20 +09:00
Junegunn Choi
6287ba88d5
Fix installer output
- Same output format across different installers
- Avoid unnecessary construction of result string
- Fix multi-line error logging when exit_cb is called before out_cb
2016-10-18 14:30:48 +09:00
Junegunn Choi
1bbb7a55e3
Update Vim 8 requirement
https://github.com/junegunn/vim-plug/issues/498#issuecomment-254239466
2016-10-18 00:32:27 +09:00
Junegunn Choi
d1022e948e
Address out-of-order invocation of out_cb and exit_cb 2016-10-18 00:31:36 +09:00
Junegunn Choi
b94607b172
Update README: +job 2016-10-17 18:00:20 +09:00
Junegunn Choi
6bff19c2a9
Set out_mode to raw for progress report 2016-10-17 17:52:13 +09:00
Junegunn Choi
759103d074
Refactor job callbacks with partial 2016-10-17 17:51:42 +09:00
Yasuhiro Matsumoto
b32169ff30
Use job_start on vim
Close #498
Close #534
2016-10-17 16:16:03 +09:00
Junegunn Choi
3f7344d2cc
Set up Travis CI build for Neovim 2016-10-17 15:34:20 +09:00
Junegunn Choi
7928057108
Make Neovim installer synchronous during startup
Close #104

This allows for `nvim +PlugUpdate +qa` without Python.
2016-10-17 12:34:09 +09:00
Junegunn Choi
c66e264d41 Fix Ruby installer on Vim 8.0.0036 (#538)
This could be a bug of Vim, but the new method should be safer in the
long run though it doesn't work on Ruby 1.8.
2016-10-17 12:22:20 +09:00
Junegunn Choi
01e4e9170a
Update git URI validation in Ruby and Python installers
Contd. #530
2016-10-14 13:44:56 +09:00
Junegunn Choi
0662b5f4cc Fix Travis CI failure 2016-10-09 05:17:34 +09:00
Junegunn Choi
a2f1ea481d
Reuse existing plug window
Close #532
2016-10-09 04:48:53 +09:00
Junegunn Choi
7bad3e7802 Merge pull request #531 from junegunn/fix-530
Improve git URI validation
2016-10-08 23:48:52 +09:00
Junegunn Choi
6575bd65b1
Improve git URI validation
Close #530
2016-10-08 23:32:48 +09:00
Junegunn Choi
5d8c4bfc1f
Print exception from post-update hook with : prefix 2016-10-08 23:22:06 +09:00
Junegunn Choi
c0a83826f9
Print warning message when plug window is closed 2016-10-08 23:06:24 +09:00
Junegunn Choi
6454158846 Merge pull request #522 from jmatth/fix-visualhostkey
Fixing E684 when VisualHostKey is enabled for ssh
2016-09-16 14:12:41 +09:00
Josh Matthews
1f206db965 Fixing E684 when VisualHostKey is enabled for ssh
Having VisualHostKey enabled for ssh can cause lines containing a single
"^M" character to appear in the git output, which causes E684 to be
thrown if not filtered out.
2016-09-15 16:35:11 -04:00
Junegunn Choi
f4381fb748
Fix loading on c-operator
Close #518
2016-09-11 12:04:08 +09:00
Junegunn Choi
561518fd8c
Print post-processing error in multi-line paragraph
Related #510
2016-08-15 00:46:10 +09:00
Junegunn Choi
b44ea685aa Merge pull request #508 from mhinz/silence-deletions
Silence :delete commands
2016-08-01 09:52:29 +09:00
Marco Hinz
9df0580eff
Silence :delete commands
Add :silence to all :delete commands to avoid filling up the message history
with "1 line less" messages, in case 'report' is set to 0.
2016-07-31 22:50:50 +02:00
Junegunn Choi
e15598fe45 Add g:plug_pwindow for customizing preview window layout
Close #504
2016-07-23 18:36:30 +09:00
Junegunn Choi
326cb71a2a
No period in echo message 2016-07-23 18:07:12 +09:00
Junegunn Choi
c9a7ca1e9e
Define d operator for selectively removing invalid directories
Fix #503
2016-07-23 18:02:00 +09:00
Junegunn Choi
5695fb8474
Do not proceed if $GIT_DIR or $GIT_WORK_TREE is found
Close #506
2016-07-23 10:13:25 +09:00
Junegunn Choi
f68a4fddae
Update example: youcompleteme#Enable is no longer needed
Close #501
2016-07-15 12:18:21 +09:00
Junegunn Choi
17996cedce
Support { 'do': ':VimCommand' } notation
Close #450
2016-07-13 23:01:41 +09:00
Junegunn Choi
460fbe82e0
Ignore inconsistencies between g:plugs and g:plugs_order
https://github.com/junegunn/vim-plug/issues/469#issuecomment-226965736
2016-06-19 11:18:20 +09:00
Junegunn Choi
05a1620bb1
Put cursor inside the installer window after post-update hook
https://github.com/chrisbra/unicode.vim/issues/16
2016-06-16 22:17:21 +09:00
Junegunn Choi
cb5bed0e35
Always set register in map-based ODL 2016-05-31 15:27:27 +09:00
Junegunn Choi
44893a1901
Fix #491 - Lazy-loading with omaps 2016-05-31 12:44:48 +09:00
Junegunn Choi
765a2d21d3
Do not trigger BufRead if not necessary
Close #490
2016-05-23 22:22:43 +09:00
Junegunn Choi
eb25f320a0
Fix travis CI build 2016-05-23 13:15:57 +09:00
Junegunn Choi
7c7ef8cf2f
Trigger BufRead when a plugin is loaded by on condition
Close #489
2016-05-23 13:11:06 +09:00
Junegunn Choi
a8b09617f9
Clarify that function call requires call
Close #487
2016-05-23 01:12:09 +09:00
Junegunn Choi
bf1e0fb8eb
Do not use Ruby older than 1.8.7
Close #482
2016-05-13 02:06:00 +09:00
Junegunn Choi
656ccef8dc Switch &shell during submodule update
Fix #481
2016-04-29 13:39:17 +09:00
Junegunn Choi
41de3c713c
Export Plug command as plug# function
https://github.com/junegunn/vim-plug/issues/477#issuecomment-212746298

One can directly use it to redefine Plug command:

    function! s:plug_with_default(...)
      call plug#(a:1, extend(get(g:, 'plug_opts', {}), get(a:000, 1, {})))
    endfunction
    command! -nargs=+ Plug call s:plug_with_default(<args>)
2016-04-22 02:50:04 +09:00
15 changed files with 2438 additions and 602 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
github: junegunn

View File

@ -10,7 +10,12 @@ Explain the problem here ...
------------------------------
<!-- Put the contents of `:version` below -->
<!-- Paste your Plug block (from `call plug#begin()` to `call plug#end()`) -->
```
```
<!-- Paste the contents of `:version` below -->
```
```
@ -24,7 +29,7 @@ Explain the problem here ...
- OS:
- [ ] All/Other
- [ ] Linux
- [ ] OS X
- [ ] macOS
- [ ] Windows
- Vim:
- [ ] Terminal Vim

52
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,52 @@
---
name: Test vim-plug
on:
push:
branches: [master, devel]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
vim:
- vim
# FIXME: (core dumped) https://github.com/junegunn/vim-plug/runs/4422576984?check_suite_focus=true#step:3:238
# - neovim-stable
# - neovim-unstable
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install packages and test
env:
ENV: ${{ matrix.vim }}
run: |
export DEPS=~/deps
export PATH=~/deps/bin:$PATH
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
case "$ENV" in
vim)
sudo apt-get install vim
;;
neovim-*)
sudo add-apt-repository ppa:neovim-ppa/${ENV/neovim-/}
sudo apt-get update
sudo apt-get install neovim
mkdir -p $DEPS/bin
echo 'nvim "$@"' > $DEPS/bin/vim
chmod +x $DEPS/bin/vim
export VADER_OUTPUT_FILE=/dev/stderr
;;
esac
test/run !

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
doc/tags

View File

@ -1,49 +1,69 @@
language: ruby
sudo: false
language: minimal
env:
global:
- DEPS=$HOME/deps
- PATH=$DEPS/bin:$PATH
matrix:
jobs:
include:
- env: ENV=nox
rvm: 1.8.7
addons: { apt: { packages: [vim-nox] } }
- env: ENV=python
rvm: 1.8.7
addons: { apt: { packages: [python2.7-dev] } }
- env: ENV=python3
rvm: 1.8.7
addons: { apt: { packages: [python3-dev] } }
- env: ENV=ruby
rvm: 1.8.7
- env: ENV=ruby
rvm: 2.0.0
- env: ENV=vim80-bionic
dist: bionic
stage: vim8
- env: ENV=vim-nightly
dist: trusty
stage: vim8
- env: ENV=neovim-stable
dist: bionic
addons: {apt: {packages: [neovim], sources: [{sourceline: 'ppa:neovim-ppa/stable'}]}}
stage: neovim
- env: ENV=neovim-nightly
dist: bionic
addons: {apt: {packages: [neovim], sources: [{sourceline: 'ppa:neovim-ppa/unstable'}]}}
stage: neovim
- env: ENV=vim74-trusty-python
dist: trusty
stage: vim74
- env: ENV=vim74-xenial-python3
dist: xenial
stage: vim74
- env: ENV=vim74-trusty-ruby
dist: trusty
addons: {apt: {packages: [vim-nox]}}
stage: vim74
- env: ENV=vim74-xenial-ruby
dist: xenial
addons: {apt: {packages: [vim-nox]}}
stage: vim74
- env: ENV=osx-highsierra
os: osx
osx_image: xcode9.4
stage: vim8
install: |
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
if [ "$ENV" == "nox" ]; then
mkdir -p ${DEPS}/bin
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
return
fi
C_OPTS="--prefix=$DEPS --with-features=huge --disable-gui "
case "$ENV" in
python)
C_OPTS+=--enable-pythoninterp
vim-*)
;;
python3)
C_OPTS+=--enable-python3interp
neovim-*)
mkdir -p ${DEPS}/bin
ln -s /usr/bin/nvim ${DEPS}/bin/vim
export VADER_OUTPUT_FILE=/dev/stderr
return
;;
ruby)
C_OPTS+=--enable-rubyinterp
vim74-* | vim80-*)
mkdir -p ${DEPS}/bin
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
return
;;
*)
return
;;
esac
git clone --depth 1 https://github.com/vim/vim
cd vim
export PATH=/usr/bin:$PATH
./configure $C_OPTS
make
make install

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Junegunn Choi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

479
README.md
View File

@ -1,16 +1,44 @@
<img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="75" alt="vim-plug">[![travis-ci](https://travis-ci.org/junegunn/vim-plug.svg?branch=master)](https://travis-ci.org/junegunn/vim-plug)
===
<div align="center">
<sup>Special thanks to:</sup>
<br>
<br>
<a href="https://warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=vimplug_20240209">
<div>
<img src="https://raw.githubusercontent.com/junegunn/i/master/warp.png" width="300" alt="Warp">
</div>
<b>Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.</b>
<div>
<sup>Visit warp.dev to learn more.</sup>
</div>
</a>
<br>
<hr>
</div>
<br>
<h1 title="vim-plug">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./plug-dark.png">
<img src="./plug.png" height="75" alt="vim-plug">
</picture>
<a href="https://github.com/junegunn/vim-plug/actions/workflows/test.yml?query=branch%3Amaster">
<img src="https://img.shields.io/github/actions/workflow/status/junegunn/vim-plug/test.yml?branch=master">
</a>
</h1>
A minimalist Vim plugin manager.
<img src="https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif" height="450">
### Pros.
## Pros.
- Easier to setup: Single file. No boilerplate code required.
- Easier to use: Concise, intuitive syntax
- Minimalist design
- Just one file with no dependencies. Super easy to set up.
- Concise, intuitive syntax that you can learn within minutes. No boilerplate code required.
- No feature bloat
- Extremely stable with flawless backward compatibility
- Works perfectly with all versions of Vim since 2006 and all versions of Neovim ever released
- [Super-fast][40/4] parallel installation/update
(with any of `+python`, `+python3`, `+ruby`, or [Neovim][nv])
- Creates shallow clones to minimize disk space usage and download time
- On-demand loading for [faster startup time][startup-time]
- Can review and rollback updates
@ -19,120 +47,256 @@ A minimalist Vim plugin manager.
- Support for externally managed plugins
[40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
[nv]: http://neovim.org/
[startup-time]: http://junegunn.kr/images/vim-startup-time.png
[startup-time]: https://github.com/junegunn/vim-startuptime-benchmark#result
### Installation
## Installation
[Download plug.vim](https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim)
and put it in the "autoload" directory.
###### Unix
<details>
<summary>Click to see the instructions</summary>
### Vim
#### Unix
```sh
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
```
###### Neovim
You can automate the process by putting the command in your Vim configuration
file as suggested [here][auto].
[auto]: https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
#### Windows (PowerShell)
```powershell
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
ni $HOME/vimfiles/autoload/plug.vim -Force
```
### Neovim
#### Unix, Linux
```sh
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
```
#### Linux (Flatpak)
```sh
curl -fLo ~/.var/app/io.neovim.nvim/data/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
```
###### Windows (PowerShell)
#### Windows (PowerShell)
```powershell
md ~\vimfiles\autoload
$uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
(New-Object Net.WebClient).DownloadFile($uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\vimfiles\autoload\plug.vim"))
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
ni "$(@($env:XDG_DATA_HOME, $env:LOCALAPPDATA)[$null -eq $env:XDG_DATA_HOME])/nvim-data/site/autoload/plug.vim" -Force
```
</details>
## Usage
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neovim)
1. Begin the section with `call plug#begin()`
1. List the plugins with `Plug` commands
1. End the section with `call plug#end()`
For example,
```vim
call plug#begin()
" List your plugins here
Plug 'tpope/vim-sensible'
call plug#end()
```
Reload the file or restart Vim, then you can,
* `:PlugInstall` to install the plugins
* `:PlugUpdate` to install or update the plugins
* `:PlugDiff` to review the changes from the last update
* `:PlugClean` to remove plugins no longer in the list
> [!NOTE]
> That's basically all you need to know to get started. The rest of the
> document is for advanced users who want to know more about the features and
> options.
> [!TIP]
> `plug#end()` automatically executes `filetype plugin indent on` and `syntax
> enable`. We believe this is a good default for most users, but if you don't
> want this behavior, you can revert the settings after the call.
>
> ```vim
> call plug#end()
> filetype indent off " Disable file-type-specific indentation
> syntax off " Disable syntax highlighting
> ```
### Getting Help
- See the [requirements] page for debugging information & tested configurations.
- See the [FAQ] for common problems and questions.
- Create an [issue](https://github.com/junegunn/vim-plug/issues/new).
- See [tutorial] page to learn more about the basics of vim-plug
- See [tips] and [FAQ] pages for common problems and questions
[tutorial]: https://github.com/junegunn/vim-plug/wiki/tutorial
[tips]: https://github.com/junegunn/vim-plug/wiki/tips
[FAQ]: https://github.com/junegunn/vim-plug/wiki/faq
[requirements]: https://github.com/junegunn/vim-plug/wiki/requirements
### Usage
## Examples
Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neovim):
The following examples demonstrate the additional features of vim-plug.
1. Begin the section with `plug#begin()`
1. List the plugins with `Plug` commands
1. `plug#end()` to update `&runtimepath` and initialize plugin system
#### Example
### Vim script example
```vim
call plug#begin('~/.vim/plugged')
call plug#begin()
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" - Vim (Windows): '~/vimfiles/plugged'
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" Shorthand notation for GitHub; translates to https://github.com/junegunn/seoul256.vim.git
Plug 'junegunn/seoul256.vim'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Group dependencies, vim-snippets depends on ultisnips
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
Plug 'https://github.com/junegunn/vim-easy-align.git'
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Using a non-default branch
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
" Plugin outside ~/.vim/plugged with post-update hook
" Use 'dir' option to install plugin in a non-default directory
Plug 'junegunn/fzf', { 'dir': '~/.fzf' }
" Post-update hook: run a shell command after installing or updating the plugin
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Post-update hook can be a lambda expression
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
" If the vim plugin is in a subdirectory, use 'rtp' option to specify its path
Plug 'nsf/gocode', { 'rtp': 'vim' }
" On-demand loading: loaded when the specified command is executed
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
" On-demand loading: loaded when a file with a specific file type is opened
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'
" Add plugins to &runtimepath
" Call plug#end to update &runtimepath and initialize the plugin system.
" - It automatically executes `filetype plugin indent on` and `syntax enable`
call plug#end()
" You can revert the settings after the call like so:
" filetype indent off " Disable file-type-specific indentation
" syntax off " Disable syntax highlighting
" Color schemes should be loaded after plug#end().
" We prepend it with 'silent!' to ignore errors when it's not yet installed.
silent! colorscheme seoul256
```
Reload .vimrc and `:PlugInstall` to install plugins.
### Lua example for Neovim
### Commands
In Neovim, you can write your configuration in a Lua script file named
`init.lua`. The following code is the Lua script equivalent to the Vim script
example above.
```lua
local vim = vim
local Plug = vim.fn['plug#']
vim.call('plug#begin')
-- Shorthand notation for GitHub; translates to https://github.com/junegunn/seoul256.vim.git
Plug('junegunn/seoul256.vim')
-- Any valid git URL is allowed
Plug('https://github.com/junegunn/vim-easy-align.git')
-- Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug('fatih/vim-go', { ['tag'] = '*' })
-- Using a non-default branch
Plug('neoclide/coc.nvim', { ['branch'] = 'release' })
-- Use 'dir' option to install plugin in a non-default directory
Plug('junegunn/fzf', { ['dir'] = '~/.fzf' })
-- Post-update hook: run a shell command after installing or updating the plugin
Plug('junegunn/fzf', { ['dir'] = '~/.fzf', ['do'] = './install --all' })
-- Post-update hook can be a lambda expression
Plug('junegunn/fzf', { ['do'] = function()
vim.fn['fzf#install']()
end })
-- If the vim plugin is in a subdirectory, use 'rtp' option to specify its path
Plug('nsf/gocode', { ['rtp'] = 'vim' })
-- On-demand loading: loaded when the specified command is executed
Plug('preservim/nerdtree', { ['on'] = 'NERDTreeToggle' })
-- On-demand loading: loaded when a file with a specific file type is opened
Plug('tpope/vim-fireplace', { ['for'] = 'clojure' })
-- Unmanaged plugin (manually installed and updated)
Plug('~/my-prototype-plugin')
vim.call('plug#end')
-- Color schemes should be loaded after plug#end().
-- We prepend it with 'silent!' to ignore errors when it's not yet installed.
vim.cmd('silent! colorscheme seoul256')
```
## 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) |
| `PlugClean[!]` | Remove unlisted plugins (bang version will clean without prompt) |
| `PlugUpgrade` | Upgrade vim-plug itself |
| `PlugStatus` | Check the status of plugins |
| `PlugDiff` | Examine changes from the previous update and the pending changes |
| `PlugSnapshot[!] [output path]` | Generate script for restoring the current snapshot of the plugins |
### `Plug` options
## `Plug` options
| Option | Description |
| ----------------------- | ------------------------------------------------ |
| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
| `rtp` | Subdirectory that contains Vim plugin |
| `dir` | Custom directory for the plugin |
| `as` | Use different name for the plugin |
| `do` | Post-update hook (string or funcref) |
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
| `for` | On-demand loading: File types |
| `frozen` | Do not update unless explicitly specified |
| Option | Description |
| ----------------------- | ----------------------------------------------------------- |
| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
| `rtp` | Subdirectory that contains Vim plugin |
| `dir` | Custom directory for the plugin |
| `as` | Use different name for the plugin |
| `do` | Post-update hook (string or funcref) |
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
| `for` | On-demand loading: File types |
| `frozen` | Do not remove and do not update unless explicitly specified |
### Global options
## Global options
| Flag | Default | Description |
| ------------------- | --------------------------------- | ------------------------------------------------------ |
@ -140,35 +304,100 @@ Reload .vimrc and `:PlugInstall` to install plugins.
| `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_shallow` | 1 | Use shallow clone |
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
| `g:plug_window` | `-tabnew` | Command to open plug window |
| `g:plug_pwindow` | `vertical rightbelow new` | Command to open preview window in `PlugDiff` |
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands) |
### Keybindings
## Keybindings
- `D` - `PlugDiff`
- `S` - `PlugStatus`
- `R` - Retry failed update or installation tasks
- `U` - Update plugins in the selected range
- `q` - Close the window
- `q` - Abort the running tasks or close the window
- `:PlugStatus`
- `L` - Load plugin
- `:PlugDiff`
- `X` - Revert the update
### Example: A small [sensible](https://github.com/tpope/vim-sensible) Vim configuration
## Post-update hooks
There are some plugins that require extra steps after installation or update.
In that case, use the `do` option to describe the task to be performed.
```vim
call plug#begin()
Plug 'tpope/vim-sensible'
call plug#end()
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
```
### On-demand loading of plugins
If the value starts with `:`, it will be recognized as a Vim command.
```vim
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
```
To call a Vim function, you can pass a lambda expression like so:
```vim
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
```
If you need more control, you can pass a reference to a Vim function that
takes a dictionary 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.py
endif
endfunction
Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
```
A post-update hook is 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!`.
> [!TIP]
> Make sure to escape BARs and double-quotes when you write the `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 Vim script expression) as follows:
>
> ```vim
> let g:fzf_install = 'yes | ./install'
> Plug 'junegunn/fzf', { 'do': g:fzf_install }
> ```
### `PlugInstall!` and `PlugUpdate!`
The installer takes the following steps when installing/updating a plugin:
1. `git clone` or `git fetch` from its origin
2. Check out branch, tag, or commit and optionally `git merge` remote branch
3. If the plugin was updated (or installed for the first time)
1. Update submodules
2. Execute post-update hooks
The commands with the `!` suffix ensure that all steps are run unconditionally.
## On-demand loading of plugins
```vim
" NERD tree will be loaded on the first invocation of NERDTreeToggle command
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
" Multiple commands
Plug 'junegunn/vim-github-dashboard', { 'on': ['GHDashboard', 'GHActivity'] }
@ -182,83 +411,53 @@ Plug 'kovisoft/paredit', { 'for': ['clojure', 'scheme'] }
" On-demand loading on both conditions
Plug 'junegunn/vader.vim', { 'on': 'Vader', 'for': 'vader' }
" Code to execute when the plugin is loaded on demand
Plug 'Valloric/YouCompleteMe', { 'for': 'cpp' }
autocmd! User YouCompleteMe if !has('vim_starting') | call youcompleteme#Enable() | endif
" Code to execute when the plugin is lazily loaded on demand
Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
autocmd! User goyo.vim echom 'Goyo is now loaded!'
```
`for` option is generally not needed as most plugins for specific file types
usually don't have too much code in `plugin` directory. You might want to
examine the output of `vim --startuptime` before applying the option.
> [!NOTE]
> #### Should I set up on-demand loading?
>
> You probably don't need to.
>
> A properly implemented Vim plugin should already load lazily without any
> help from a plugin manager (`:help autoload`). So there are few cases where
> these options actually make much sense. Making a plugin load faster is
> the responsibility of the plugin developer, not the user. If you find
> a plugin that takes too long to load, consider opening an issue on the
> plugin's issue tracker.
>
> Let me give you a perspective. The time it takes to load a plugin is usually
> less than 2 or 3ms on modern computers. So unless you use a very large
> number of plugins, you are unlikely to save more than 50ms. If you have
> spent an hour carefully setting up the options to shave off 50ms, you
> will have to start Vim 72,000 times just to break even. You should ask
> yourself if that's a good investment of your time.
>
> Make sure that you're tackling the right problem by breaking down the
> startup time of Vim using `--startuptime`.
>
> ```sh
> vim --startuptime /tmp/log
> ```
>
> On-demand loading should only be used as a last resort. It is basically
> a hacky workaround and is not always guaranteed to work.
### Post-update hooks
> [!TIP]
> You can pass an empty list to `on` or `for` option to disable the loading
> of the plugin. You can manually load the plugin using `plug#load(NAMES...)`
> function.
>
> See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually
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.py' }
```
## Collaborators
If you need more control, you can pass a reference to a Vim function that
takes a single argument.
- [Jan Edmund Lazo](https://github.com/janlazo) - Windows support
- [Jeremy Pallats](https://github.com/starcraftman) - Python installer
```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.py
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 }
```
### `PlugInstall!` and `PlugUpdate!`
The installer takes the following steps when installing/updating a plugin:
1. `git clone` or `git fetch` from its origin
2. Check out branch, tag, or commit and optionally `git merge` remote branch
3. If the plugin was updated (or installed for the first time)
1. Update submodules
2. Execute post-update hooks
The commands with `!` suffix ensure that all steps are run unconditionally.
### Articles
- [Writing my own Vim plugin manager](http://junegunn.kr/2013/09/writing-my-own-vim-plugin-manager)
- [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
## License
MIT

428
doc/plug.txt Normal file
View File

@ -0,0 +1,428 @@
plug.txt plug Last change: Jun 1 2024
PLUG - TABLE OF CONTENTS *plug* *plug-toc*
==============================================================================
vim-plug |vim-plug|
Pros. |plug-pros|
Installation |plug-installation|
Usage |plug-usage|
Getting Help |plug-getting-help|
Examples |plug-examples|
Vim script example |plug-vim-script-example|
Lua example for Neovim |plug-lua-example-for-neovim|
Commands |plug-commands|
Plug options |plug-options|
Global options |plug-global-options|
Keybindings |plug-keybindings|
Post-update hooks |plug-post-update-hooks|
PlugInstall! and PlugUpdate! |pluginstall-and-plugupdate|
On-demand loading of plugins |plug-on-demand-loading-of-plugins|
Collaborators |plug-collaborators|
License |plug-license|
VIM-PLUG *vim-plug*
==============================================================================
A minimalist Vim plugin manager.
PROS. *plug-pros*
==============================================================================
- Minimalist design
- Just one file with no dependencies. Super easy to set up.
- Concise, intuitive syntax that you can learn within minutes. No
boilerplate code required.
- No feature bloat
- Extremely stable with flawless backward compatibility
- Works perfectly with all versions of Vim since 2006 and all versions of
Neovim ever released
- {Super-fast}{1} parallel installation/update
- Creates shallow clones to minimize disk space usage and download time
- On-demand loading for {faster startup time}{2}
- Can review and rollback updates
- Branch/tag/commit support
- Post-update hooks
- Support for externally managed plugins
{1} https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
{2} https://github.com/junegunn/vim-startuptime-benchmark#result
INSTALLATION *plug-installation*
==============================================================================
{Download plug.vim}{3} and put it in the "autoload" directory.
{3} https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
USAGE *plug-usage*
==============================================================================
Add a vim-plug section to your `~/.vimrc` (or `init.vim` for Neovim)
*plug#begin* *plug#end*
1. Begin the section with `callplug#begin()`
2. List the plugins with `Plug` commands
3. End the section with `callplug#end()`
For example,
>
call plug#begin()
" List your plugins here
Plug 'tpope/vim-sensible'
call plug#end()
<
Reload the file or restart Vim, then you can,
*:PlugInstall* *:PlugUpdate* *:PlugDiff*
- `:PlugInstall` to install the plugins
- `:PlugUpdate` to install or update the plugins
- `:PlugDiff` to review the changes from the last update
[!NOTE] That's basically all you need to know to get started. The rest of the
document is for advanced users who want to know more about the features and
options.
< Getting Help >______________________________________________________________~
*plug-getting-help*
- See {tutorial}{4} page to learn more about the basics of vim-plug
- See {tips}{5} and {FAQ}{6} pages for common problems and questions
{4} https://github.com/junegunn/vim-plug/wiki/tutorial
{5} https://github.com/junegunn/vim-plug/wiki/tips
{6} https://github.com/junegunn/vim-plug/wiki/faq
EXAMPLES *plug-examples*
==============================================================================
The following examples demonstrate the additional features of vim-plug.
< Vim script example >________________________________________________________~
*plug-vim-script-example*
>
call plug#begin()
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" - Vim (Windows): '~/vimfiles/plugged'
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes
" Shorthand notation for GitHub; translates to https://github.com/junegunn/seoul256.vim.git
Plug 'junegunn/seoul256.vim'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-easy-align.git'
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Using a non-default branch
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
" Use 'dir' option to install plugin in a non-default directory
Plug 'junegunn/fzf', { 'dir': '~/.fzf' }
" Post-update hook: run a shell command after installing or updating the plugin
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Post-update hook can be a lambda expression
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
" If the vim plugin is in a subdirectory, use 'rtp' option to specify its path
Plug 'nsf/gocode', { 'rtp': 'vim' }
" On-demand loading: loaded when the specified command is executed
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
" On-demand loading: loaded when a file with a specific file type is opened
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin'
" Call plug#end to update &runtimepath and initialize the plugin system.
" - It automatically executes `filetype plugin indent on` and `syntax enable`
call plug#end()
" You can revert the settings after the call like so:
" filetype indent off " Disable file-type-specific indentation
" syntax off " Disable syntax highlighting
" Color schemes should be loaded after plug#end().
" We prepend it with 'silent!' to ignore errors when it's not yet installed.
silent! colorscheme seoul256
<
< Lua example for Neovim >____________________________________________________~
*plug-lua-example-for-neovim*
In Neovim, you can write your configuration in a Lua script file named
`init.lua`. The following code is the Lua script equivalent to the Vim script
example above.
>
local vim = vim
local Plug = vim.fn['plug#']
vim.call('plug#begin')
-- Shorthand notation for GitHub; translates to https://github.com/junegunn/seoul256.vim.git
Plug('junegunn/seoul256.vim')
-- Any valid git URL is allowed
Plug('https://github.com/junegunn/vim-easy-align.git')
-- Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug('fatih/vim-go', { ['tag'] = '*' })
-- Using a non-default branch
Plug('neoclide/coc.nvim', { ['branch'] = 'release' })
-- Use 'dir' option to install plugin in a non-default directory
Plug('junegunn/fzf', { ['dir'] = '~/.fzf' })
-- Post-update hook: run a shell command after installing or updating the plugin
Plug('junegunn/fzf', { ['dir'] = '~/.fzf', ['do'] = './install --all' })
-- Post-update hook can be a lambda expression
Plug('junegunn/fzf', { ['do'] = function()
vim.fn['fzf#install']()
end })
-- If the vim plugin is in a subdirectory, use 'rtp' option to specify its path
Plug('nsf/gocode', { ['rtp'] = 'vim' })
-- On-demand loading: loaded when the specified command is executed
Plug('preservim/nerdtree', { ['on'] = 'NERDTreeToggle' })
-- On-demand loading: loaded when a file with a specific file type is opened
Plug('tpope/vim-fireplace', { ['for'] = 'clojure' })
-- Unmanaged plugin (manually installed and updated)
Plug('~/my-prototype-plugin')
vim.call('plug#end')
-- Color schemes should be loaded after plug#end().
-- We prepend it with 'silent!' to ignore errors when it's not yet installed.
vim.cmd('silent! colorscheme seoul256')
<
COMMANDS *plug-commands*
==============================================================================
-------------------------------------+------------------------------------------------------------------
Command | Description ~
-------------------------------------+------------------------------------------------------------------
`PlugInstall [name ...] [#threads]` | Install plugins
`PlugUpdate [name ...] [#threads]` | Install or update plugins
`PlugClean[!]` | Remove unlisted plugins (bang version will clean without prompt)
`PlugUpgrade` | Upgrade vim-plug itself
`PlugStatus` | Check the status of plugins
`PlugDiff` | Examine changes from the previous update and the pending changes
`PlugSnapshot[!] [output path]` | Generate script for restoring the current snapshot of the plugins
-------------------------------------+------------------------------------------------------------------
PLUG OPTIONS *plug-options*
==============================================================================
*<Plug>-mappings*
------------------------+------------------------------------------------------------
Option | Description ~
------------------------+------------------------------------------------------------
`branch` / `tag` / `commit` | Branch/tag/commit of the repository to use
`rtp` | Subdirectory that contains Vim plugin
`dir` | Custom directory for the plugin
`as` | Use different name for the plugin
`do` | Post-update hook (string or funcref)
`on` | On-demand loading: Commands or <Plug>-mappings
`for` | On-demand loading: File types
`frozen` | Do not remove and do not update unless explicitly specified
------------------------+------------------------------------------------------------
GLOBAL OPTIONS *plug-global-options*
==============================================================================
*g:plug_threads* *g:plug_timeout* *g:plug_retries* *g:plug_shallow* *g:plug_window*
*g:plug_pwindow* *g:plug_url_format*
--------------------+-----------------------------------+-----------------------------------------------------------------------------------
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_shallow` | 1 | Use shallow clone
`g:plug_window` | `-tabnew` | Command to open plug window
`g:plug_pwindow` | `vertical rightbelow new` | Command to open preview window in `PlugDiff`
`g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands)
--------------------+-----------------------------------+-----------------------------------------------------------------------------------
KEYBINDINGS *plug-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
POST-UPDATE HOOKS *plug-post-update-hooks*
==============================================================================
There are some plugins that require extra steps after installation or update.
In that case, use the `do` option to describe the task to be performed.
>
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
<
If the value starts with `:`, it will be recognized as a Vim command.
>
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
<
To call a Vim function, you can pass a lambda expression like so:
>
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
<
If you need more control, you can pass a reference to a Vim function that
takes a dictionary argument.
>
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.py
endif
endfunction
Plug 'ycm-core/YouCompleteMe', { 'do': function('BuildYCM') }
<
A post-update hook is 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!`.
[!TIP] Make sure to escape BARs and double-quotes when you write the `do`
option inline as they are mistakenly recognized as command separator or the
start of the trailing comment.
>
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
<
But you can avoid the escaping if you extract the inline specification using a
variable (or any Vim script expression) as follows:
>
let g:fzf_install = 'yes | ./install'
Plug 'junegunn/fzf', { 'do': g:fzf_install }
<
< PlugInstall! and PlugUpdate! >______________________________________________~
*pluginstall-and-plugupdate*
The installer takes the following steps when installing/updating a plugin:
1. `git clone` or `git fetch` from its origin
2. Check out branch, tag, or commit and optionally `git merge` remote branch
3. If the plugin was updated (or installed for the first time)
1. Update submodules
2. Execute post-update hooks
The commands with the `!` suffix ensure that all steps are run
unconditionally.
ON-DEMAND LOADING OF PLUGINS *plug-on-demand-loading-of-plugins*
==============================================================================
>
" NERD tree will be loaded on the first invocation of NERDTreeToggle command
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
" Multiple commands
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' }
" Code to execute when the plugin is lazily loaded on demand
Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
autocmd! User goyo.vim echom 'Goyo is now loaded!'
<
[!NOTE] #### Should I set up on-demand loading?
You probably don't need to.
A properly implemented Vim plugin should already load lazily without any help
from a plugin manager (`:helpautoload`). So there are few cases where these
options actually make much sense. Making a plugin load faster is the
responsibility of the plugin developer, not the user. If you find a plugin
that takes too long to load, consider opening an issue on the plugin's issue
tracker.
Let me give you a perspective. The time it takes to load a plugin is usually
less than 2 or 3ms on modern computers. So unless you use a very large number
of plugins, you are unlikely to save more than 50ms. If you have spent an hour
carefully setting up the options to shave off 50ms, you will have to start Vim
72,000 times just to break even. You should ask yourself if that's a good
investment of your time.
Make sure that you're tackling the right problem by breaking down the startup
time of Vim using `--startuptime`.
>
vim --startuptime /tmp/log
<
On-demand loading should only be used as a last resort. It is basically a
hacky workaround and is not always guaranteed to work.
*plug#load*
[!TIP] You can pass an empty list to `on` or `for` option to disable the
loading of the plugin. You can manually load the plugin using
`plug#load(NAMES...)` function.
See https://github.com/junegunn/vim-plug/wiki/tips#loading-plugins-manually
COLLABORATORS *plug-collaborators*
==============================================================================
- {Jan Edmund Lazo}{7} - Windows support
- {Jeremy Pallats}{8} - Python installer
{7} https://github.com/janlazo
{8} https://github.com/starcraftman
LICENSE *plug-license*
==============================================================================
MIT
==============================================================================
vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:

BIN
plug-dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

1232
plug.vim

File diff suppressed because it is too large Load Diff

41
test/functional.vader Normal file
View File

@ -0,0 +1,41 @@
Execute (plug#shellescape() works without optional arguments):
if has('unix')
AssertEqual "''", plug#shellescape("")
AssertEqual "'foo'\\'''", plug#shellescape("foo'")
endif
Execute (plug#shellescape() ignores invalid optional argument):
if has('unix')
AssertEqual "''", plug#shellescape("", '')
AssertEqual "'foo'\\'''", plug#shellescape("foo'", [])
endif
Execute (plug#shellescape() depends on the shell):
AssertEqual "'foo'\\'''", plug#shellescape("foo'", {'shell': 'sh'})
AssertEqual '^"foo''^"', plug#shellescape("foo'", {'shell': 'cmd.exe'})
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'powershell'})
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'powershell.exe'})
AssertEqual "'foo'''", plug#shellescape("foo'", {'shell': 'pwsh'})
Execute (plug#shellescape() supports non-trivial cmd.exe escaping):
" batchfile
AssertEqual '^"^^%%PATH^^%%^"', plug#shellescape("^%PATH^%", {
\ 'shell': 'cmd.exe',
\ })
AssertEqual '^"^^%%PATH^^%%^"', plug#shellescape("^%PATH^%", {
\ 'shell': 'cmd.exe',
\ 'script': 1,
\ })
" command prompt
AssertEqual '^"^^^%PATH^^^%^"', plug#shellescape("^%PATH^%", {
\ 'shell': 'cmd.exe',
\ 'script': 0,
\ }),
Execute (plug#shellescape() supports non-trivial powershell.exe escaping):
AssertEqual '''\"Foo\\''''\\Bar\"''', plug#shellescape('"Foo\''\Bar"', {
\ 'shell': 'powershell',
\ }),
AssertEqual '''\"Foo\\''''\\Bar\"''', plug#shellescape('"Foo\''\Bar"', {
\ 'shell': 'powershell.exe',
\ }),

View File

@ -1,5 +1,6 @@
**********************************************************************
Execute (#112 On-demand loading should not suppress messages from ftplugin):
call ResetPlug()
call plug#begin('$PLUG_FIXTURES')
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
call plug#end()
@ -7,19 +8,20 @@ Execute (#112 On-demand loading should not suppress messages from ftplugin):
redir => out
tabnew a.c
redir END
Assert stridx(out, 'ftplugin') >= 0
Assert stridx(out, 'ftplugin-c') >= 0, 'Unexpected output (1): '.out
* The same applies to plug#load())
call ResetPlug()
redir => out
call plug#load('ftplugin-msg')
redir END
Assert stridx(out, 'ftplugin') >= 0
Assert stridx(out, 'ftplugin-c') >= 0, 'Unexpected output (2): '.out
q
**********************************************************************
Execute (#114 Should not contain empty path in &rtp):
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
call plug#end()
Log &rtp
@ -35,10 +37,11 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
" Cleared on command
call ReloadPlug()
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
call plug#end()
PlugInstall | q
call mkdir(g:plugs['vim-emoji'].dir.'/after/plugin', 'p')
Assert exists(':EmojiCommand'), 'EmojiCommand not defined'
Assert exists(':EmojiCommand2'), 'EmojiCommand2 not defined'
@ -52,7 +55,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers):
" Cleared on FileType
call ReloadPlug()
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
call plug#end()
@ -78,31 +81,32 @@ Execute (#131 Syntax error):
**********************************************************************
Execute (#139-1 Using new remote branch):
" Make sure to remove the clone
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
call plug#end()
PlugClean!
" Install master branch
call plug#begin('/tmp/plugged')
Plug expand('file:////tmp/new-branch')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug expand('file:////tmp/vim-plug-test/new-branch')
call plug#end()
PlugUpdate
unlet! g:foo g:bar g:baz
call ResetPlug()
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'
Assert exists('g:foo'), 'g:foo should be found (1)'
Assert !exists('g:bar'), 'g:bar should not be found (1)'
Assert !exists('g:baz'), 'g:baz should not be found (1)'
" Create a new branch on origin
call system('cd /tmp/new-branch && git checkout -b new &&'
call system('cd /tmp/vim-plug-test/new-branch && git checkout -b new &&'
\. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&'
\. 'git commit -m second')
" We're setting up two plugins so that parallel installer is used
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/seoul256.vim'
Plug expand('file:////tmp/new-branch'), { 'branch': 'new' }
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'new' }
call plug#end()
PlugUpdate
silent %y
@ -110,10 +114,11 @@ Execute (#139-1 Using new remote branch):
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
unlet! g:foo g:bar g:baz
call ResetPlug()
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'
Assert exists('g:foo'), 'g:foo should be found (2)'
Assert exists('g:bar'), 'g:bar should be found (2)'
Assert !exists('g:baz'), 'g:baz should not be found (2)'
call PlugStatusSorted()
@ -125,14 +130,14 @@ Expect:
Execute (#139-2 Using yet another new remote branch):
" Create another branch on origin
call system('cd /tmp/new-branch && git checkout master &&'
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
\. 'git checkout -b brand-new &&'
\. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&'
\. 'git commit -m third')
" Test Vim installer here
call plug#begin('/tmp/plugged')
Plug expand('file:////tmp/new-branch'), { 'branch': 'brand-new' }
call plug#begin('/tmp/vim-plug-test/plugged')
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'brand-new' }
call plug#end()
PlugUpdate
silent %y
@ -140,6 +145,7 @@ Execute (#139-2 Using yet another new remote branch):
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
unlet! g:foo g:bar g:baz
call ResetPlug()
call plug#load('new-branch')
Assert exists('g:foo'), 'g:foo should be found'
Assert !exists('g:bar'), 'g:bar should not be found'
@ -154,19 +160,19 @@ Expect:
Execute (#139-3 Should fail when not possible to fast-forward):
" Commit on cloned repo
call system('cd /tmp/plugged/new-branch && git checkout master &&'
call system('cd /tmp/vim-plug-test/plugged/new-branch && git checkout master &&'
\. 'touch foobar && git add foobar && git commit -m foobar')
" Different commit on remote
call system('cd /tmp/new-branch && git checkout master &&'
call system('cd /tmp/vim-plug-test/new-branch && git checkout master &&'
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
for multi in [0, 1]
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
if multi
Plug 'junegunn/seoul256.vim'
endif
Plug expand('file:////tmp/new-branch')
Plug expand('file:////tmp/vim-plug-test/new-branch')
call plug#end()
PlugUpdate
silent %y
@ -210,7 +216,7 @@ Execute (#159: shell=/bin/tcsh):
let org = &shell
try
set shell=/bin/tcsh
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/seoul256.vim'
call plug#end()
@ -224,21 +230,21 @@ Execute (#159: shell=/bin/tcsh):
**********************************************************************
Execute (#154: Spaces in &rtp should not be escaped):
call plug#begin('/tmp/plug it')
Plug 'seoul256 vim'
call plug#begin('/tmp/vim-plug-test/plug it')
Plug 'foo/seoul256 vim'
call plug#end()
Log &rtp
Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
**********************************************************************
Execute (#184: Duplicate entries in &rtp):
call plug#begin('/tmp/plugged')
Plug 'plugin1'
\| Plug 'plugin0'
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'foo/plugin1'
\| Plug 'foo/plugin0'
Plug 'plugin2'
\| Plug 'plugin0'
\| Plug 'plugin1'
Plug 'foo/plugin2'
\| Plug 'foo/plugin0'
\| Plug 'foo/plugin1'
call plug#end()
Log &rtp
@ -250,7 +256,7 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
silent! delc EasyAlign
call ReloadPlug()
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
call plug#end()
PlugInstall | q
@ -259,19 +265,19 @@ Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
%EasyAlign=
Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
call plug#end()
Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
**********************************************************************
Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
call plug#end()
PlugClean!
" Shallow clone. We should have at least 2 plugins to enable parallel installer.
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/seoul256.vim'
call plug#end()
@ -279,7 +285,7 @@ Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
Assert filereadable(g:plugs['vim-easy-align'].dir.'/.git/shallow')
" Now unshallowed
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.0' }
Plug 'junegunn/seoul256.vim'
call plug#end()
@ -289,16 +295,81 @@ Execute (#350: Ruby installer failed to unshallow tagged plugin on update):
**********************************************************************
Execute (#474: Load ftdetect files in filetypedetect augroup):
call plug#begin('/tmp/plugged')
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/rust.vim', { 'for': 'rust', 'commit': '115d321d383eb96d438466c56cc871fcc1bd0faa' }
call plug#end()
PlugInstall!
q
tabnew /tmp/any.rs
tabnew /tmp/vim-plug-test/any.rs
AssertEqual 'rust', &filetype
Log &filetype
filetype detect
AssertEqual 'rust', &filetype
Log &filetype
bd
**********************************************************************
Execute (#489/#587 On-demand loading with 'on' option should trigger BufRead autocmd w/o nomodeline):
call plug#begin('$PLUG_FIXTURES')
Plug 'foo/ftplugin-msg', { 'on': 'XXX' }
call plug#end()
tabnew a.java
call setline(1, '// vim: set filetype=lava:')
redir => out
silent! XXX
redir END
Assert stridx(out, 'ftplugin-java') >= 0
AssertEqual 'lava', &filetype
q!
**********************************************************************
Execute (Cursor moved to another window during post-update hook):
function! DoSplit(...)
new
call setline(1, 'empty')
endfunction
call plug#begin('/tmp/vim-plug-test/plugged')
Plug 'junegunn/rust.vim', { 'do': function('DoSplit') }
call plug#end()
PlugInstall!
AssertEqual 1, line('$')
AssertEqual 'empty', getline(1)
q!
q
**********************************************************************
Execute (#593 Add plugin to &rtp before running post-update hook with : prefix):
call ReloadPlug()
call plug#begin()
Plug 'junegunn/vim-pseudocl', { 'on': 'XXX', 'do': ':let g:bar = pseudocl#complete#extract_words(''a b'')' }
call plug#end()
PlugInstall!
AssertEqual ['a', 'b'], g:bar
**********************************************************************
Execute (#602 Confusion with branch name and path name):
call plug#begin()
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'plugin' }
call plug#end()
PlugUpdate
call PlugStatusSorted()
Expect:
- new-branch: OK
Finished. 0 error(s).
[=]
**********************************************************************
Execute (PlugStatus showed error with wildcard tag):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'tag': '*' }
call plug#end()
PlugUpdate
call PlugStatusSorted()
Expect:
- vim-easy-align: OK
Finished. 0 error(s).
[=]

View File

@ -1,25 +1,32 @@
#!/bin/bash
cd $(dirname "${BASH_SOURCE[0]}")
# Privileged mode, ignores $CDPATH etc.
set -p
set -eu
cd "$(dirname "${BASH_SOURCE[0]}")"
export BASE="$PWD"
export PLUG_SRC="$PWD/../plug.vim"
export PLUG_FIXTURES="$PWD/fixtures"
mkdir -p "$PLUG_FIXTURES"
export TEMP=/tmp/vim-plug-test
rm -rf "$TEMP"
mkdir -p "$TEMP"
cat > /tmp/mini-vimrc << VIMRC
set rtp+=/tmp/junegunn/vader.vim
cat > $TEMP/mini-vimrc << VIMRC
set rtp+=$TEMP/junegunn/vader.vim
set shell=/bin/bash
VIMRC
clone() {
if [ ! -d $2 ]; then
git clone $1 $2
if [ ! -d "$2" ]; then
git clone "$1" "$2"
fi
}
clone_repos() (
cd /tmp
cd $TEMP
mkdir -p junegunn vim-scripts jg
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
vim-oblique vim-pseudocl vim-redis vim-emoji; do
@ -41,8 +48,8 @@ make_dirs() (
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
[ -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', [])
@ -55,7 +62,7 @@ EOF
gitinit() (
cd "$PLUG_FIXTURES/$1"
git init
git init -b master
git commit -m 'commit' --allow-empty
)
@ -70,30 +77,42 @@ DOC
make_dirs yyy/ yyy
make_dirs yyy/after yyy
mkdir -p "$PLUG_FIXTURES/yyy/rtp/doc"
cat > "$PLUG_FIXTURES/yyy/rtp/doc/yyy.txt" << DOC
hello *yyy*
DOC
gitinit yyy
make_dirs z1/ z1
make_dirs z2/ z2
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
echo "echomsg 'ftplugin'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
mkdir -p "$PLUG_FIXTURES"/ftplugin-msg/{plugin,ftplugin}
echo "echomsg 'ftplugin-c'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
echo "echomsg 'ftplugin-java'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/java.vim"
rm -rf /tmp/new-branch
cd /tmp
git init new-branch
chmod +w "$PLUG_FIXTURES/cant-delete/autoload" || rm -rf "$PLUG_FIXTURES/cant-delete"
mkdir -p "$PLUG_FIXTURES/cant-delete/autoload"
touch "$PLUG_FIXTURES/cant-delete/autoload/cant-delete.vim"
chmod -w "$PLUG_FIXTURES/cant-delete/autoload"
rm -rf $TEMP/new-branch
cd $TEMP
git init new-branch -b master
cd new-branch
mkdir plugin
echo 'let g:foo = 1' > plugin/foo.vim
git add plugin/foo.vim
git commit -m initial
git checkout -b plugin
git checkout master
cd "$BASE"
}
select_vim() {
local vim=/usr/bin/vim
if [ -n "$DEPS" ] && [ -e "${DEPS}/bin/vim" ]; then
if [ -n "${DEPS:-}" ] && [ -e "${DEPS}/bin/vim" ]; then
vim="${DEPS}/bin/vim"
elif [ -e "/usr/local/bin/vim" ]; then
vim=/usr/local/bin/vim
@ -105,13 +124,14 @@ clone_repos
prepare
git --version
VIM=$(select_vim)
echo "Selected Vim: $VIM"
if [ "$1" = '!' ]; then
$VIM -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
prepare &&
$VIM -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
vim=$(select_vim)
echo "Selected Vim: $vim"
if [ "${1:-}" = '!' ]; then
FAIL=0
$vim -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null || FAIL=1
prepare
$vim -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null || FAIL=1
test $FAIL -eq 0
else
$VIM -Nu /tmp/mini-vimrc -c 'Vader test.vader'
$vim -Nu $TEMP/mini-vimrc -c 'Vader test.vader'
fi

View File

@ -2,7 +2,7 @@ Execute (Initialize test environment):
Save &rtp, g:plugs, g:plug_home, g:plug_window
unlet! g:plugs g:plug_home g:plug_window
let g:plug_url_format = 'file:///tmp/%s'
let g:plug_url_format = 'file:///tmp/vim-plug-test/%s'
let g:base_rtp = &rtp
let g:first_rtp = split(&rtp, ',')[0]
let g:last_rtp = split(&rtp, ',')[-1]
@ -14,8 +14,11 @@ Execute (Initialize test environment):
" Temporarily patch plug.vim
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
call writefile(extend(readfile($PLUG_TMP),
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_TMP)
let patch =
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction',
\ 'function! CompareURI(a, b)', 'return s:compare_git_uri(a:a, a:b)', 'endfunction']
call writefile(extend(readfile($PLUG_TMP), patch), $PLUG_TMP)
set t_Co=256
colo default
@ -30,9 +33,10 @@ Execute (Initialize test environment):
g/^$/d
endfunction
function! AssertExpect(bang, pat, cnt)
function! AssertExpect(bang, pat, cnt, ...)
let op = a:bang ? '==#' : '=~#'
AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
let args = [a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))] + a:000
call call('vader#assert#equal', args)
endfunction
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
@ -69,17 +73,20 @@ Execute (Initialize test environment):
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])
elseif has('python3')
silent python3 import sys; svi = sys.version_info; print('Python: {}.{}.{}'.format(svi[0], svi[1], svi[2]))
silent! ruby puts 'Ruby: ' + RUBY_VERSION
endif
if has('python')
silent! python import sys; svi = sys.version_info; print 'Python: {}.{}.{}'.format(svi[0], svi[1], svi[2])
endif
if has('python3')
silent! python3 import sys; svi = sys.version_info; print('Python: {}.{}.{}'.format(svi[0], svi[1], svi[2]))
endif
redir END
Log substitute(out, '\n', '', 'g')
Log split(out, '\n')
Include: workflow.vader
Include: regressions.vader
Include: functional.vader
Execute (Cleanup):
silent! call RmRf(g:temp_plugged)

View File

@ -2,7 +2,7 @@ Execute (plug#end() before plug#begin() should fail):
redir => out
silent! AssertEqual 0, plug#end()
redir END
Assert stridx(out, 'Call plug#begin() first') >= 0
Assert stridx(out, 'plug#end() called without calling plug#begin() first') >= 0
Execute (plug#begin() without path argument):
call plug#begin()
@ -19,6 +19,13 @@ Execute (plug#begin() without path argument with empty &rtp):
let &rtp = save_rtp
unlet save_rtp
Execute (Standard runtime path is not allowed):
redir => out
silent! AssertEqual 0, plug#begin(split(&rtp, ',')[0].'/plugin')
redir END
Log out
Assert stridx(out, 'Invalid plug home') >= 0
Execute (plug#begin(path)):
call plug#begin(g:temp_plugged.'/')
Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home'
@ -34,7 +41,7 @@ Execute (Subsequent plug#begin() calls will reuse g:plug_home):
Execute (Test Plug command):
^ Git repo with branch (DEPRECATED. USE BRANCH OPTION)
Plug 'junegunn/seoul256.vim', { 'branch': 'yes-t_co' }
AssertEqual 'file:///tmp/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
AssertEqual 'file:///tmp/vim-plug-test/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
@ -42,29 +49,62 @@ Execute (Test Plug command):
AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
^ Git repo with tag (DEPRECATED. USE TAG OPTION)
redir => out
silent Plug 'foo/bar.vim', ''
redir END
Assert out =~ 'Invalid argument for "tag" option of :Plug (expected: string)'
Plug 'junegunn/goyo.vim', '1.5.2'
AssertEqual 'file:///tmp/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
AssertEqual 'file:///tmp/vim-plug-test/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
redir => out
silent Plug 'foo/bar.vim', {'tag': ''}
redir END
Assert out =~ 'Invalid argument for "tag" option of :Plug (expected: string)'
Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
AssertEqual '1.5.3', g:plugs['goyo.vim'].tag
" Git URI
Plug 'file:///tmp/jg/vim-emoji'
AssertEqual 'file:///tmp/jg/vim-emoji', g:plugs['vim-emoji'].uri
AssertEqual 'master', g:plugs['vim-emoji'].branch
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
AssertEqual 'file:///tmp/vim-plug-test/jg/vim-emoji', g:plugs['vim-emoji'].uri
AssertEqual '', g:plugs['vim-emoji'].branch
AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
" vim-scripts/
Plug 'beauty256'
AssertEqual 'file:///tmp/vim-scripts/beauty256', g:plugs.beauty256.uri
AssertEqual 'master', g:plugs.beauty256.branch
Plug 'vim-scripts/beauty256'
AssertEqual 'file:///tmp/vim-plug-test/vim-scripts/beauty256', g:plugs.beauty256.uri
AssertEqual '', g:plugs.beauty256.branch
AssertEqual 4, len(g:plugs)
redir => out
Plug 'beauty256'
redir END
Assert out =~ 'Invalid argument: beauty256'
Execute (Plug command with dictionary option):
Log string(g:plugs)
for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as']
let opts = {}
let opts[opt] = ''
redir => out
silent Plug 'foo/bar.vim', opts
redir END
Assert out =~ 'Invalid argument for "'.opt.'" option of :Plug (expected: string)'
endfor
for opt in ['on', 'for']
let opts = {}
let opts[opt] = ''
redir => out
silent Plug 'foo/bar.vim', opts
redir END
Assert out =~ 'Invalid argument for "'.opt.'" option of :Plug (expected: string or list)'
endfor
redir => out
silent Plug 'foo/bar.vim', {'do': ''}
redir END
Assert out =~ 'Invalid argument for "do" option of :Plug (expected: string or funcref)'
Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
AssertEqual '././', g:plugs['seoul256.vim'].rtp
@ -84,7 +124,7 @@ Execute (PlugClean before installation):
Execute (plug#end() updates &rtp):
" Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
" Plug 'file:///tmp/jg/vim-emoji'
" Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
" Plug 'beauty256'
" Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
call plug#end()
@ -159,7 +199,7 @@ Expect:
Execute (Change branch of seoul256.vim):
call plug#begin()
Plug 'junegunn/seoul256.vim'
Plug 'file:///tmp/jg/vim-emoji'
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
call plug#end()
Execute (PlugStatus):
@ -197,25 +237,25 @@ Expect:
Execute (Change URI of seoul256.vim):
call plug#begin()
Plug 'junegunn.choi/seoul256.vim'
Plug 'file:///tmp/jg/vim-emoji'
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
call plug#end()
Execute (PlugStatus):
call PlugStatusSorted()
Expect:
Expected: file:///tmp/junegunn.choi/seoul256.vim
Invalid URI: file:///tmp/junegunn/seoul256.vim
Expected: file:///tmp/vim-plug-test/junegunn.choi/seoul256.vim
Invalid URI: file:///tmp/vim-plug-test/junegunn/seoul256.vim
PlugClean required.
- vim-emoji: OK
Finished. 1 error(s).
[==]
x seoul256.vim:
Execute (Corrected the URI but diverged from master):
Execute (Corrected the URI but ahead of upstream):
call plug#begin()
Plug 'junegunn/seoul256.vim'
Plug 'file:///tmp/jg/vim-emoji'
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
call plug#end()
for _ in range(3)
call system(printf('cd "%s" && git commit --allow-empty -m "dummy"', g:plugs['seoul256.vim'].dir))
@ -223,8 +263,8 @@ Execute (Corrected the URI but diverged from master):
call PlugStatusSorted()
Expect:
Diverged from origin/master by 3 commit(s).
Reinstall after PlugClean.
Ahead of origin/master by 3 commit(s).
Cannot update until local changes are pushed.
- vim-emoji: OK
Finished. 1 error(s).
[==]
@ -237,11 +277,44 @@ Expect:
# q
# PGdd
Execute (PlugClean! to remove seoul256.vim):
Execute (PlugClean! keeps seoul256.vim):
PlugClean!
" Three removed, emoji left
AssertEqual 'Removed.', getline(4)
AssertExpect '^- ', 3
" Two removed, emoji and seoul256 left
AssertEqual 'Removed 2 directories.', getline(4)
AssertExpect '^\~ ', 2
AssertExpect 'Diverged', 0
Assert !empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
q
Execute (Make seoul256 to be diverged):
call plug#begin()
Plug 'junegunn/seoul256.vim'
Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
call plug#end()
call system(printf(join([
\ 'cd "%s"',
\ 'git fetch --unshallow',
\ 'git reset "@{u}~1"',
\ 'git commit --allow-empty -m "diverged1"',
\ 'git commit --allow-empty -m "diverged2"'], ' && '),
\ g:plugs['seoul256.vim'].dir))
Assert empty(v:shell_error), 'Got shell error: '.v:shell_error
call PlugStatusSorted()
Expect:
Backup local changes and run PlugClean and PlugUpdate to reinstall it.
Diverged from origin/master (2 commit(s) ahead and 1 commit(s) behind!
- vim-emoji: OK
Finished. 1 error(s).
[==]
x seoul256.vim:
Execute (PlugClean! removes seoul256.vim):
PlugClean!
" One removed, emoji left
AssertEqual 'Removed 1 directories.', getline(4)
AssertExpect '^\~ ', 1
AssertExpect 'Diverged', 1
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
@ -257,8 +330,8 @@ Execute (PlugStatus):
call PlugStatusSorted()
Expect:
Expected: file:///tmp/junegunn/vim-emoji
Invalid URI: file:///tmp/jg/vim-emoji
Expected: file:///tmp/vim-plug-test/junegunn/vim-emoji
Invalid URI: file:///tmp/vim-plug-test/jg/vim-emoji
Not found. Try PlugInstall.
PlugClean required.
Finished. 2 error(s).
@ -268,10 +341,10 @@ Expect:
Execute (PlugClean! to remove vim-emoji):
PlugClean!
AssertExpect '^- ', 1
AssertEqual 'Removed.', getline(4)
Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
AssertExpect '^\~ ', 1
AssertEqual 'Removed 1 directories.', getline(4)
Assert empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim was removed'
Assert empty(globpath(&rtp, 'autoload/emoji.vim')), 'emoji was removed'
q
Execute (PlugUpdate to install both again):
@ -283,7 +356,7 @@ 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
AssertExpect 'Already up.to.date', 2, 'Expected 2 times "Already up-to-date", but got: '.string(getline(1, '$'))
normal D
AssertEqual '0 plugin(s) updated.', getline(1)
q
@ -298,9 +371,12 @@ Execute (PlugDiff - 'No updates.'):
q
Execute (New commits on remote, PlugUpdate, then PlugDiff):
let g:plug_window = 'vertical topleft new'
let g:plug_pwindow = 'above 12new'
for repo in ['seoul256.vim', 'vim-emoji']
for _ in range(2)
call system(printf('cd /tmp/junegunn/%s && git commit --allow-empty -m "update"', repo))
call system(printf('cd /tmp/vim-plug-test/junegunn/%s && git commit --allow-empty -m "update"', repo))
endfor
endfor
unlet repo
@ -309,6 +385,7 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
" Now we have updates
normal D
AssertEqual '2 plugin(s) updated.', getline(1)
AssertThrows execute('/gpg')
" Preview commit
silent! wincmd P
@ -319,14 +396,29 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
let lnum = line('.')
AssertEqual 3, col('.')
" Open full diff (empty)
execute "normal \<cr>"
wincmd P
AssertEqual 1, &previewwindow
AssertEqual 'git', &filetype
AssertEqual [''], getline(1, '$')
pclose
" Open commit preview
execute "normal j\<cr>"
wincmd P
AssertEqual 1, &previewwindow
AssertEqual 'git', &filetype
" Back to plug window
wincmd p
" Close preview window
pclose
" Open and go to preview window with a custom mapping
nmap <buffer> <c-o> <plug>(plug-preview)<c-w>P
execute "normal \<c-o>"
AssertEqual 1, &previewwindow, 'Should be on preview window'
normal q
AssertEqual 0, &previewwindow, 'Should not be on preview window'
" ]] motion
execute 'normal $]]'
@ -347,13 +439,17 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
execute "normal Xy\<cr>"
AssertExpect '^- ', 1
" q will close preview window as well
" q will only close preview window
normal q
" We no longer have preview window
silent! wincmd P
AssertEqual 0, &previewwindow
" And we're still on main vim-plug window
AssertEqual 'vim-plug', &filetype
normal q
" q should not close preview window if it's already open
pedit
PlugDiff
@ -365,6 +461,50 @@ Execute (New commits on remote, PlugUpdate, then PlugDiff):
AssertEqual 1, &previewwindow
pclose
unlet g:plug_window g:plug_pwindow
Execute (Test g:plug_pwindow):
let g:plug_pwindow = 'below 5new'
PlugDiff
AssertExpect '^- ', 1
execute "normal ]]jo"
AssertEqual 0, &previewwindow
AssertEqual 1, winnr()
wincmd P
AssertEqual 1, &previewwindow
AssertEqual 2, winnr()
AssertEqual 5, winheight('.')
wincmd p
" Close preview window
normal q
" Close main window
normal q
unlet g:plug_pwindow
Execute (#572 - Commit preview should work with non-POSIX-compliant &shell):
" Invalid shell
let shell = &shell
set shell=shellfish
try
" Preview commit should still work
PlugDiff
execute "normal ]]jo"
wincmd P
Log getline(1, '$')
Assert getline(1) =~ 'commit', 'Preview window is empty'
AssertEqual 'shellfish', &shell
finally
" Restore &shell
let &shell = shell
unlet shell
pclose
q
endtry
Execute (Reuse Plug window in another tab):
let tabnr = tabpagenr()
PlugDiff
@ -448,6 +588,51 @@ Execute (PlugDiff):
Assert !empty(mapcheck("\<cr>"))
q
Execute (Do not show diff for commits outside of rtp):
call plug#begin()
call plug#end()
PlugClean!
call plug#begin()
Plug 'file://'.expand('$PLUG_FIXTURES').'/xxx'
Plug 'file://'.expand('$PLUG_FIXTURES').'/yyy', { 'rtp': 'rtp' }
call plug#end()
PlugInstall
Log getline(1, '$')
call system('cd "$PLUG_FIXTURES/xxx" && git commit --allow-empty -m update-xxx && git tag -f xxx')
call system('cd "$PLUG_FIXTURES/yyy" && git commit --allow-empty -m update-yyy && git tag -f yyy')
let g:plugs.yyy.tag = 'yyy'
PlugUpdate
Log getline(1, '$')
PlugDiff
" 1 plugin(s) updated.
" [==]
"
" Last update:
" ------------
"
" - xxx:
" * 7faa9b2 update-xxx (0 seconds ago)
"
" Pending updates:
" ----------------
"
" N/A
"
Log getline(1, '$')
AssertEqual 14, line('$')
AssertEqual '1 plugin(s) updated.', getline(1)
AssertEqual '[==]', getline(2)
AssertEqual 'Last update:', getline(4)
AssertEqual '- xxx:', getline(7)
Assert !empty(mapcheck('o'))
Assert !empty(mapcheck('X'))
Assert !empty(mapcheck("\<cr>"))
q
**********************************************************************
~ On-demand loading / Partial installation/update ~
**********************************************************************
@ -455,7 +640,7 @@ Execute (PlugDiff):
Execute (Trying to execute on-demand commands when plugin is not installed):
call ReloadPlug()
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] }
Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign!'] }
call plug#end()
Assert exists(':EasyAlign')
@ -596,7 +781,7 @@ Execute (PlugStatus should point out that the plugin is missing):
Execute (Deploy unmanaged plugin):
Assert !exists(':FZF'), ':FZF command should not exist'
call RmRf(fzf)
Log system(printf('cp -r "/tmp/fzf" "%s"', fzf))
Log system(printf('cp -r "/tmp/vim-plug-test/fzf" "%s"', fzf))
Execute (PlugUpdate still should not care):
PlugUpdate
@ -619,6 +804,14 @@ Execute (Check &rtp after SomeCommand):
AssertEqual g:first_rtp, split(&rtp, ',')[0]
AssertEqual g:last_rtp, split(&rtp, ',')[-1]
Execute (PlugClean should not care about frozen plugins):
call plug#begin()
Plug 'xxx/vim-easy-align', { 'frozen': 1 }
call plug#end()
PlugClean
AssertExpect 'Already clean', 1
q
Execute (Common parent):
call plug#begin()
Plug 'junegunn/vim-pseudocl'
@ -769,7 +962,7 @@ Execute (On update):
call plug#end()
" New commits on remote
call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
silent PlugUpdate
Log getline(1, '$')
@ -803,7 +996,8 @@ Execute (PlugInstall!):
Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
\ 'vim-easy-align/installed2 should exist'
AssertEqual '7f8cd78cb1fe52185b98b16a3749811f0cc508af', GitCommit('vim-pseudocl')
AssertEqual 'no-t_co', GitBranch('seoul256.vim')
" Was updated to the default branch of origin by previous PlugUpdate
AssertEqual 'master', GitBranch('seoul256.vim')
AssertEqual '1.5.3', GitTag('goyo.vim')
Execute (When submodules are not initialized):
@ -841,7 +1035,12 @@ Execute (PlugUpdate!):
Execute (When submodules are not initialized):
call system(printf('cd %s && git submodule deinit subsubmodule', g:plugs['subsubmodule'].dir))
^ #481 submodule update should use standard shell
let sh = &shell
set sh=/bin/echo
silent PlugUpdate!
let &shell = sh
unlet sh
q
AssertEqual ' ', system(printf('cd %s && git submodule status', g:plugs['subsubmodule'].dir))[0],
\ 'subsubmodule/subsubmodule should be initialized'
@ -856,7 +1055,7 @@ Execute (Using Funcref):
Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
call plug#end()
call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
call system('cd /tmp/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
call RmRf(g:plugs['vim-pseudocl'].dir)
@ -897,9 +1096,10 @@ Execute (Post-update hook output; success and failure):
Execute (Post-update hook output; invalid type or funcref):
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'do': 1 }
Plug 'junegunn/vim-easy-align', { 'do': ':echo 1' }
Plug 'junegunn/vim-pseudocl', { 'do': function('call') }
call plug#end()
let g:plugs['vim-easy-align'].do = 1
silent PlugInstall! 1
AssertEqual 'x Post-update hook for vim-pseudocl ... Vim(call):E119: Not enough arguments for function: call', getline(5)
@ -916,8 +1116,8 @@ Execute (Should not run when failed to update):
call system(printf('cd %s && git remote set-url origin xxx', g:plugs['vim-easy-align'].dir))
" New commits on remote
call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
call system('cd /tmp/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
silent PlugUpdate
Log getline(1, '$')
@ -928,18 +1128,52 @@ Execute (Should not run when failed to update):
Assert filereadable(g:plugs['vim-pseudocl'].dir.'/not-failed'),
\ 'vim-pseudocl/not-failed should exist'
Execute (Vim command with : prefix):
call plug#begin()
Plug 'junegunn/vim-pseudocl', { 'do': ':call setline(2, 12345)' }
call plug#end()
PlugInstall!
Log getline(1, '$')
AssertEqual '12345', getline(2)
q
Execute (Vim command with : prefix closing the window):
call plug#begin()
Plug 'junegunn/vim-pseudocl', { 'do': ':close' }
call plug#end()
redir => out
PlugInstall!
redir END
Assert out =~ 'vim-plug was terminated'
Assert out =~ 'of vim-pseudocl'
Execute (Invalid vim command in post-update hook):
call plug#begin()
Plug 'junegunn/vim-pseudocl', { 'do': ':nosuchcommand' }
call plug#end()
PlugInstall!
Log getline(1, '$')
AssertExpect! 'x Post-update hook for vim-pseudocl ... Vim:E492: Not an editor command: nosuchcommand', 1
q
**********************************************************************
~ Overriding `dir`
**********************************************************************
Execute (Using custom dir):
call plug#begin()
Plug 'junegunn/vim-easy-align'
call plug#end()
Assert isdirectory(g:plugs['vim-easy-align'].dir)
call RmRf('/tmp/easy-align')
call RmRf('/tmp/vim-plug-test/easy-align')
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/easy-align' }
Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/vim-plug-test/easy-align' }
call plug#end()
AssertEqual '/tmp/easy-align/', g:plugs['vim-easy-align'].dir
AssertEqual '/tmp/vim-plug-test/easy-align/', g:plugs['vim-easy-align'].dir
PlugClean!
Assert !isdirectory(g:plugs['vim-easy-align'].dir)
@ -1009,16 +1243,28 @@ Before:
**********************************************************************
Execute (plug#helptags):
call plug#begin()
Plug '$PLUG_FIXTURES/xxx'
Plug '$PLUG_FIXTURES/yyy', { 'rtp': 'rtp' }
call plug#end()
silent! call delete(expand('$PLUG_FIXTURES/xxx/doc/tags'))
silent! call delete(expand('$PLUG_FIXTURES/yyy/rtp/doc/tags'))
Assert !filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
Assert !filereadable(expand('$PLUG_FIXTURES/yyy/rtp/doc/tags'))
AssertEqual 1, plug#helptags()
Assert filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
Assert filereadable(expand('$PLUG_FIXTURES/yyy/rtp/doc/tags'))
**********************************************************************
~ Manual loading
**********************************************************************
Execute (plug#load - invalid arguments):
call ResetPlug()
call plug#begin()
Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
Plug '$PLUG_FIXTURES/yyy', { 'for': 'yyy' }
call plug#end()
AssertEqual 0, plug#load()
AssertEqual 0, plug#load('non-existent-plugin')
AssertEqual 0, plug#load('non-existent-plugin', 'another-non-existent-plugin')
@ -1026,6 +1272,12 @@ Execute (plug#load - invalid arguments):
AssertEqual 0, plug#load('xxx', 'non-existent-plugin')
AssertEqual 0, plug#load('non-existent-plugin', 'xxx')
Execute (plug#load - list argument (#638)):
redir => out
call plug#load(keys(g:plugs))
redir END
AssertEqual '', out
Execute (on: []):
call plug#begin()
Plug 'junegunn/rust.vim', { 'on': [] }
@ -1120,7 +1372,7 @@ Execute (Using g:plug_url_format):
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'
Plug 'vim-scripts/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
@ -1251,15 +1503,16 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home
Plug '$PLUG_FIXTURES/fzf'
Plug '$PLUG_FIXTURES/xxx'
Plug '$PLUG_FIXTURES/yyy'
Plug '$PLUG_FIXTURES/cant-delete'
call plug#end()
" Remove z1, z2
PlugClean!
AssertExpect '^- ', 2
AssertExpect '^\~ ', 2
AssertExpect 'Already clean', 0
PlugClean!
AssertExpect '^- ', 0
AssertExpect '^\~ ', 0
AssertExpect 'Already clean', 1
q
@ -1363,8 +1616,9 @@ Execute (Commit hash support):
call plug#end()
PlugUpdate
Log getline(1, '$')
AssertEqual 'x goyo.vim: error: pathspec ''ffffffff'' did not match any file(s) known to git.', getline(5)
AssertEqual 0, stridx(getline(6), '- vim-emoji: HEAD is now at 9db7fcf...')
AssertEqual 'x goyo.vim:', getline(5)
AssertEqual ' fatal: invalid reference: ffffffff', getline(6)
AssertEqual 0, stridx(getline(7), '- vim-emoji: HEAD is now at 9db7fcf')
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
@ -1388,10 +1642,12 @@ Execute (Commit hash support):
Assert empty(mapcheck('X'))
Assert !empty(mapcheck("\<cr>"))
" Nor in PlugSnapshot output
" The exact hash values in PlugSnapshot output
PlugSnapshot
Log getline(1, '$')
AssertEqual 8, line('$')
AssertEqual "silent! let g:plugs['goyo.vim'].commit = 'ffffffff'", getline(6)
AssertEqual "silent! let g:plugs['vim-emoji'].commit = '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a'", getline(7)
AssertEqual 10, line('$')
q
Execute (Commit hash support - cleared):
@ -1419,10 +1675,10 @@ Execute (#371 - 'as' option):
Assert g:plugs.yogo.dir =~# '/yogo/$'
call plug#begin()
Plug 'junegunn/goyo.vim', {'as': 'yogo', 'dir': '/tmp/gogo'}
Plug 'junegunn/goyo.vim', {'as': 'yogo', 'dir': '/tmp/vim-plug-test/gogo'}
call plug#end()
AssertEqual ['yogo'], sort(keys(g:plugs))
AssertEqual '/tmp/gogo/', g:plugs.yogo.dir
AssertEqual '/tmp/vim-plug-test/gogo/', g:plugs.yogo.dir
Execute (#427 - Tag option with wildcard (requires git 1.9.2 or above)):
if str2nr(split(split(system('git --version'))[-1], '\.')[0]) < 2
@ -1437,3 +1693,95 @@ Execute (#427 - Tag option with wildcard (requires git 1.9.2 or above)):
q
AssertEqual '2.9.7', GitTag('vim-easy-align')
endif
Execute (#530 - Comparison of compatible git URIs):
" .git suffix
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com/junegunn/vim-plug')
" user@
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://user@github.com/junegunn/vim-plug.git')
" git::@
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://git::@github.com/junegunn/vim-plug.git')
" https and ssh
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'git@github.com:junegunn/vim-plug.git')
" file://
Assert CompareURI('file:///tmp/vim-plug', '/tmp/vim-plug')
Assert CompareURI('file:///tmp/vim-plug', '/tmp/vim-plug/')
Execute (#530 - Comparison of incompatible git URIs):
" Different hostname
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://bitbucket.com/junegunn/vim-plug.git')
" Different repository
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com/junegunn/emacs-plug.git')
" Different port
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com:12345/junegunn/vim-plug.git')
Execute (#532 - Reuse plug window):
let g:plug_window = 'vertical topleft new'
let g:plug_pwindow = 'above 12new'
call plug#begin()
Plug 'junegunn/goyo.vim'
call plug#end()
PlugInstall
call system(printf('cd "%s" && git commit --allow-empty -m "dummy"', g:plugs['goyo.vim'].dir))
PlugDiff
AssertEqual 1, winnr(), 'Current window is #1 after PlugDiff (but is '.winnr().')'
AssertEqual 2, winnr('$'), 'Two windows after PlugDiff (but got '.winnr('$').')'
" Open preview window
execute "normal ]]jo"
AssertEqual 2, winnr(), 'Current window is #2 after opening preview (but is '.winnr().')'
AssertEqual 3, winnr('$'), 'Three windows with preview (but got '.winnr('$').')'
" Move plug window to the right
wincmd L
AssertEqual 3, winnr(), 'Current window is #3 after moving window (but is '.winnr().')'
AssertEqual 3, winnr('$'), 'Three windows after moving window (but got '.winnr('$').')'
" Reuse plug window. Preview window is closed.
PlugStatus
AssertEqual 2, winnr(), 'Current window is #2 after PlugStatus (but is '.winnr().')'
AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')'
q
unlet g:plug_window g:plug_pwindow
Execute (#766 - Allow cloning into an empty directory):
let d = '/tmp/vim-plug-test/goyo-already'
call system('rm -rf ' . d)
call mkdir(d)
call plug#begin()
Plug 'junegunn/goyo.vim', { 'dir': d }
call plug#end()
PlugInstall
AssertExpect! '[=]', 1
q
unlet d
Execute (#982 - PlugClean should report when directories cannot be removed):
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()
" Fail to remove cant-delete
PlugClean!
AssertEqual 'Removed 0 directories. Failed to remove 1 directories.', getline(4)
AssertExpect '^x ', 1
q
" Delete tmp but fail to remove cant-delete
call mkdir(expand('$PLUG_FIXTURES/tmp'))
PlugClean!
AssertEqual 'Removed 1 directories. Failed to remove 1 directories.', getline(4)
AssertExpect '^x ', 1
AssertExpect '^\~ ', 1
q