mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-06 17:14:26 +08:00
Compare commits
273 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
240dc9cbb6 | ||
|
|
f85d4d774b | ||
|
|
50cd5e5819 | ||
|
|
099057da65 | ||
|
|
8e0fcf88c0 | ||
|
|
025f314144 | ||
|
|
48fba1454b | ||
|
|
2ed1f27aa2 | ||
|
|
7760f1c22b | ||
|
|
0bd23f5b47 | ||
|
|
0227c78910 | ||
|
|
8a72305371 | ||
|
|
018b48e071 | ||
|
|
7ace0c42db | ||
|
|
179fa7bb82 | ||
|
|
76bce26ab8 | ||
|
|
36e4364b81 | ||
|
|
76ec644114 | ||
|
|
9e0a082a3d | ||
|
|
9bee42ca0a | ||
|
|
18313fa43e | ||
|
|
32eb4f5cbe | ||
|
|
96824ccd14 | ||
|
|
ef4549d2d1 | ||
|
|
d738da2ddb | ||
|
|
d17d10dccb | ||
|
|
6677e8bffd | ||
|
|
80ca4ebf54 | ||
|
|
8f1df15cc3 | ||
|
|
2218b8fe20 | ||
|
|
c632c1fd6a | ||
|
|
42300e0c4d | ||
|
|
13de76383d | ||
|
|
481a400ba4 | ||
|
|
02710070a1 | ||
|
|
e04f93b162 | ||
|
|
923f3fb3d5 | ||
|
|
6a7efea26b | ||
|
|
0e3e1cab75 | ||
|
|
27354c826e | ||
|
|
650927980d | ||
|
|
047fbba4cd | ||
|
|
fa5ece81f7 | ||
|
|
e1b7f1ae85 | ||
|
|
cf1f644aa8 | ||
|
|
8da3942484 | ||
|
|
cbaf4f3088 | ||
|
|
a06687b4ed | ||
|
|
9abd50facd | ||
|
|
b3226fbbf6 | ||
|
|
d0120cfb45 | ||
|
|
d9b70554e3 | ||
|
|
3c6ac68947 | ||
|
|
51dc024b2e | ||
|
|
30a2c5cc14 | ||
|
|
a34b745a21 | ||
|
|
c759170ce2 | ||
|
|
44410a32e3 | ||
|
|
5698a055c3 | ||
|
|
59748b0680 | ||
|
|
95aa96a884 | ||
|
|
bb48508c3e | ||
|
|
8a525f165c | ||
|
|
e362fd5931 | ||
|
|
74169f3761 | ||
|
|
7e4191baaf | ||
|
|
753f7be798 | ||
|
|
c74fae9f8e | ||
|
|
fc200da975 | ||
|
|
77f58a3793 | ||
|
|
308fb9bc94 | ||
|
|
4a96db8971 | ||
|
|
925ec7b325 | ||
|
|
7fec10e088 | ||
|
|
54fc8a4fc7 | ||
|
|
9c1cca32f0 | ||
|
|
f6be60a9a5 | ||
|
|
e81e761d43 | ||
|
|
fb84e6b11c | ||
|
|
ef784c17b1 | ||
|
|
7aeff0ef0d | ||
|
|
773b3cadd0 | ||
|
|
71542dd896 | ||
|
|
f825e4ef6e | ||
|
|
6e7509e2ef | ||
|
|
619e42a182 | ||
|
|
48e8000b6a | ||
|
|
79da5b2654 | ||
|
|
61f010ffad | ||
|
|
4539bb8fb3 | ||
|
|
7d40f592af | ||
|
|
1c61517164 | ||
|
|
061b326b37 | ||
|
|
166426718e | ||
|
|
b440603fa9 | ||
|
|
04fc8f9aba | ||
|
|
ebe8635043 | ||
|
|
334e820c4e | ||
|
|
0e9fa672f8 | ||
|
|
fdf1e53da5 | ||
|
|
470139cd86 | ||
|
|
e8cd357060 | ||
|
|
3606c294de | ||
|
|
06f903d8af | ||
|
|
1f704deb76 | ||
|
|
3ebf6361bf | ||
|
|
9b99c1f885 | ||
|
|
53cc8a53d9 | ||
|
|
2ee153d610 | ||
|
|
7019171737 | ||
|
|
044c3a67c4 | ||
|
|
48514768c2 | ||
|
|
68ad02c5c3 | ||
|
|
12bc2ea1da | ||
|
|
ade7fb95b1 | ||
|
|
9c55223869 | ||
|
|
495becf442 | ||
|
|
425ef39db2 | ||
|
|
bd2cb9d2de | ||
|
|
0263370bd1 | ||
|
|
4b3fbd1592 | ||
|
|
396a534a0a | ||
|
|
a45c3834f8 | ||
|
|
a5c3952380 | ||
|
|
60bda7322f | ||
|
|
05008e7a82 | ||
|
|
2889cb4739 | ||
|
|
61b21068ee | ||
|
|
15da7eb78a | ||
|
|
385a1eb350 | ||
|
|
8c915a5271 | ||
|
|
ee9f0e55b8 | ||
|
|
018adb2aef | ||
|
|
da47e6ee56 | ||
|
|
662274e617 | ||
|
|
4eeff535fa | ||
|
|
c3669836d3 | ||
|
|
eb38fe3d32 | ||
|
|
e7704e6cb3 | ||
|
|
e1e04cabd5 | ||
|
|
afc20ecff3 | ||
|
|
38510a8788 | ||
|
|
a34b06dd54 | ||
|
|
5d910fc9ea | ||
|
|
f31477407a | ||
|
|
0e907d4f38 | ||
|
|
cb08d6036b | ||
|
|
9d63fe6aeb | ||
|
|
0489b5deed | ||
|
|
cac2f9f439 | ||
|
|
115a25de79 | ||
|
|
a64b156682 | ||
|
|
a9fa8f44e5 | ||
|
|
d6590fa883 | ||
|
|
cabaf7b431 | ||
|
|
6e509db6ff | ||
|
|
7b7778d5ba | ||
|
|
f3e2d214df | ||
|
|
5ec1faefab | ||
|
|
6406d73c9a | ||
|
|
ff4cbe23c0 | ||
|
|
681ca2d43a | ||
|
|
adb2413f0d | ||
|
|
dda21b50bf | ||
|
|
537a5321aa | ||
|
|
99f6f36b69 | ||
|
|
3f82808bea | ||
|
|
7474edf13f | ||
|
|
25b0fb7583 | ||
|
|
a868ee4c11 | ||
|
|
49851436ff | ||
|
|
2f9a94e8c0 | ||
|
|
ab3bd3b17c | ||
|
|
3572ffde79 | ||
|
|
18c8b54793 | ||
|
|
1752de5b7c | ||
|
|
2f3225fc60 | ||
|
|
1022acad0b | ||
|
|
68c7fbbf9d | ||
|
|
da24f714e0 | ||
|
|
c1bbbaf3ef | ||
|
|
f7ebba7b9e | ||
|
|
6272f5e289 | ||
|
|
f43067c7a5 | ||
|
|
e6cba28997 | ||
|
|
f1b8832a13 | ||
|
|
d0c94a9b08 | ||
|
|
3a2e406cd0 | ||
|
|
84cdf61730 | ||
|
|
0aeea1db08 | ||
|
|
8289477d18 | ||
|
|
19b12e2216 | ||
|
|
4c9ebe9c31 | ||
|
|
74dcd13575 | ||
|
|
518f20652f | ||
|
|
665ec057d7 | ||
|
|
bc212dca77 | ||
|
|
8da7b50fb2 | ||
|
|
4ae2e879e1 | ||
|
|
93628b1c3d | ||
|
|
01e126469b | ||
|
|
a7477f04b7 | ||
|
|
0fdb56ba72 | ||
|
|
d89949f16c | ||
|
|
19b8221c14 | ||
|
|
336fadd236 | ||
|
|
a216e38a59 | ||
|
|
d930594686 | ||
|
|
f4261711ae | ||
|
|
61b77bc8e8 | ||
|
|
fe7c7e7b40 | ||
|
|
25afdf138c | ||
|
|
b36fd34da0 | ||
|
|
7e55690f19 | ||
|
|
30ef53d832 | ||
|
|
f58d090bb2 | ||
|
|
eeef77e9c8 | ||
|
|
6af2cd8946 | ||
|
|
878cdd5309 | ||
|
|
9bb2da53a0 | ||
|
|
58c06ed77e | ||
|
|
2e691c6feb | ||
|
|
a18087610a | ||
|
|
276106d987 | ||
|
|
d499fc311a | ||
|
|
c4b4aa8f07 | ||
|
|
d690f8d576 | ||
|
|
8738341ad0 | ||
|
|
5ab2024fbb | ||
|
|
300176ba9f | ||
|
|
da7d6bd58b | ||
|
|
b651558c63 | ||
|
|
2d815ad2f0 | ||
|
|
3af4079179 | ||
|
|
e6a594f1ad | ||
|
|
e741d02ad0 | ||
|
|
b2208640d4 | ||
|
|
aa49c38586 | ||
|
|
b6b10ac17e | ||
|
|
706f7e00ea | ||
|
|
6ff1031339 | ||
|
|
0936877399 | ||
|
|
d956e16f15 | ||
|
|
f98c8456fa | ||
|
|
5b2c03d3a8 | ||
|
|
0b31be49cf | ||
|
|
74fa6ab9df | ||
|
|
0d7e20c984 | ||
|
|
e2714fb56e | ||
|
|
3b83a22ea4 | ||
|
|
cd418369bc | ||
|
|
279a334c8b | ||
|
|
9132e9d50d | ||
|
|
3323163e04 | ||
|
|
e4671eaf9e | ||
|
|
9afa356fb3 | ||
|
|
e04f696682 | ||
|
|
4cb5fd04a6 | ||
|
|
c16743e8fc | ||
|
|
46a6e8441f | ||
|
|
466d1839b3 | ||
|
|
c3cf35abb5 | ||
|
|
344f80aedb | ||
|
|
dae0540a11 | ||
|
|
af89938633 | ||
|
|
35c5f2830b | ||
|
|
60b907c87f | ||
|
|
9ceb9caa09 | ||
|
|
42a42e7e71 | ||
|
|
8885b1086f | ||
|
|
90c07f269c | ||
|
|
f1c5157e35 | ||
|
|
7f1ec7b12b |
37
.travis.yml
37
.travis.yml
@@ -1,12 +1,35 @@
|
||||
language: vim
|
||||
language: ruby
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.2 # Test with vim-nox package on ubuntu
|
||||
- 1.9.3 # Test against python installer
|
||||
- 2.0.0
|
||||
- 2.1.0 # Test against python3 installer
|
||||
|
||||
before_script: |
|
||||
hg clone https://code.google.com/p/vim/
|
||||
cd vim
|
||||
./configure --with-features=huge --enable-rubyinterp
|
||||
make
|
||||
sudo make install
|
||||
cd -
|
||||
sudo apt-get update -y
|
||||
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.2 ]; then
|
||||
sudo apt-get install -y vim-nox
|
||||
sudo ln -s /usr/bin/vim /usr/local/bin/vim
|
||||
else
|
||||
git clone --depth 1 https://github.com/vim/vim
|
||||
cd vim
|
||||
if [ $(ruby -e 'puts RUBY_VERSION') = 1.9.3 ]; then
|
||||
sudo apt-get install -y python2.7-dev
|
||||
./configure --with-features=huge --enable-pythoninterp
|
||||
elif [ $(ruby -e 'puts RUBY_VERSION') = 2.1.0 ]; then
|
||||
sudo apt-get install -y python3-dev
|
||||
./configure --with-features=huge --enable-python3interp
|
||||
else
|
||||
./configure --with-features=huge --enable-rubyinterp
|
||||
fi
|
||||
make
|
||||
sudo make install
|
||||
cd -
|
||||
fi
|
||||
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
|
||||
script: |
|
||||
test/run !
|
||||
|
||||
255
README.md
255
README.md
@@ -1,35 +1,35 @@
|
||||

|
||||

|
||||
<img src="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.png" height="75" alt="vim-plug">[](https://travis-ci.org/junegunn/vim-plug)
|
||||
===
|
||||
|
||||
A single-file Vim plugin manager.
|
||||
A minimalist Vim plugin manager.
|
||||
|
||||
Somewhere between [Pathogen](https://github.com/tpope/vim-pathogen) and
|
||||
[Vundle](https://github.com/gmarik/vundle), but with faster parallel installer.
|
||||
|
||||

|
||||
<img src="https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif" height="450">
|
||||
|
||||
### Pros.
|
||||
|
||||
- Easier to setup
|
||||
- Parallel installation/update (requires
|
||||
[+ruby](http://junegunn.kr/2013/09/installing-vim-with-ruby-support/))
|
||||
- Smallest possible feature set
|
||||
- Easier to setup: Single file. No boilerplate code required.
|
||||
- Easier to use: Concise, intuitive syntax
|
||||
- [Super-fast][40/4] parallel installation/update
|
||||
(with 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
|
||||
- Branch/tag support
|
||||
- On-demand loading
|
||||
- Dependency resolution using `Plugfile` (experimental)
|
||||
- Post-update hooks
|
||||
- Support for externally managed plugins
|
||||
|
||||
### Cons.
|
||||
|
||||
- Everything else
|
||||
[40/4]: https://raw.githubusercontent.com/junegunn/i/master/vim-plug/40-in-4.gif
|
||||
[nv]: http://neovim.org/
|
||||
[startup-time]: http://junegunn.kr/images/vim-startup-time.png
|
||||
|
||||
### Usage
|
||||
|
||||
[Download plug.vim](https://raw.github.com/junegunn/vim-plug/master/plug.vim)
|
||||
[Download plug.vim](https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim)
|
||||
and put it in ~/.vim/autoload
|
||||
|
||||
```sh
|
||||
mkdir -p ~/.vim/autoload
|
||||
curl -fLo ~/.vim/autoload/plug.vim https://raw.github.com/junegunn/vim-plug/master/plug.vim
|
||||
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
```
|
||||
|
||||
Edit your .vimrc
|
||||
@@ -37,51 +37,80 @@ Edit your .vimrc
|
||||
```vim
|
||||
call plug#begin('~/.vim/plugged')
|
||||
|
||||
" Make sure you use single quotes
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
|
||||
" 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' }
|
||||
" Plug 'user/repo1', 'branch_or_tag'
|
||||
" Plug 'user/repo2', { 'rtp': 'vim/plugin/dir', 'branch': 'devel' }
|
||||
" Plug 'git@github.com:junegunn/vim-github-dashboard.git'
|
||||
" ...
|
||||
|
||||
" Using git URL
|
||||
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
|
||||
|
||||
" Plugin options
|
||||
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
|
||||
|
||||
" Plugin outside ~/.vim/plugged with post-update hook
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
|
||||
|
||||
" Unmanaged plugin (manually installed and updated)
|
||||
Plug '~/my-prototype-plugin'
|
||||
|
||||
call plug#end()
|
||||
```
|
||||
|
||||
Reload .vimrc and `:PlugInstall` to install plugins.
|
||||
|
||||
### Plugin directory
|
||||
|
||||
If you omit the path argument to `plug#begin()`, plugins are installed in
|
||||
`plugged` directory under the first path in `runtimepath` at the point when
|
||||
`plug#begin()` is called. This is usually `~/.vim/plugged` (or
|
||||
`$HOME/vimfiles/plugged` on Windows) given that you didn't touch runtimepath
|
||||
before the call.
|
||||
|
||||
### Commands
|
||||
|
||||
| Command | Description |
|
||||
| --------------------------------- | ------------------------------------------------------------------ |
|
||||
| PlugInstall [name ...] [#threads] | Install plugins |
|
||||
| PlugUpdate [name ...] [#threads] | Install or update plugins |
|
||||
| PlugClean[!] | Remove unused directories (bang version will clean without prompt) |
|
||||
| PlugUpgrade | Upgrade vim-plug itself |
|
||||
| PlugStatus | Check the status of plugins |
|
||||
| PlugDiff | See the updated changes from the previous PlugUpdate |
|
||||
| Command | Description |
|
||||
| ----------------------------------- | ------------------------------------------------------------------ |
|
||||
| `PlugInstall [name ...] [#threads]` | Install plugins |
|
||||
| `PlugUpdate [name ...] [#threads]` | Install or update plugins |
|
||||
| `PlugClean[!]` | Remove unused directories (bang version will clean without prompt) |
|
||||
| `PlugUpgrade` | Upgrade vim-plug itself |
|
||||
| `PlugStatus` | Check the status of plugins |
|
||||
| `PlugDiff` | See the updated changes from the previous PlugUpdate |
|
||||
| `PlugSnapshot [output path]` | Generate script for restoring the current snapshot of the plugins |
|
||||
|
||||
### Options for parallel installer
|
||||
### `Plug` options
|
||||
|
||||
| Flag | Default | Description |
|
||||
| ---------------- | ------- | --------------------------------- |
|
||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||
| `g:plug_timeout` | 60 | Time limit of each task in seconds |
|
||||
| Option | Description |
|
||||
| -------------- | ------------------------------------------------ |
|
||||
| `branch`/`tag` | Branch or tag of the repository to use |
|
||||
| `rtp` | Subdirectory that contains Vim plugin |
|
||||
| `dir` | Custom directory for the plugin |
|
||||
| `do` | Post-update hook (string or funcref) |
|
||||
| `on` | On-demand loading: Commands or `<Plug>`-mappings |
|
||||
| `for` | On-demand loading: File types |
|
||||
| `frozen` | Do not update unless explicitly specified |
|
||||
|
||||
### Global options
|
||||
|
||||
| Flag | Default | Description |
|
||||
| ------------------- | --------------------------------- | ------------------------------------------------------ |
|
||||
| `g:plug_threads` | 16 | Default number of threads to use |
|
||||
| `g:plug_timeout` | 60 | Time limit of each task in seconds (*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_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL |
|
||||
|
||||
### Keybindings
|
||||
|
||||
- `D` - `PlugDiff`
|
||||
- `S` - `PlugStatus`
|
||||
- `R` - Retry failed update or installation tasks
|
||||
- `U` - Update plugins in the selected range
|
||||
- `q` - Close the window
|
||||
- `:PlugStatus`
|
||||
- `L` - Load plugin
|
||||
- `:PlugDiff`
|
||||
- `X` - Revert the update
|
||||
|
||||
### Example: A small [sensible](https://github.com/tpope/vim-sensible) Vim configuration
|
||||
|
||||
@@ -103,87 +132,81 @@ 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 loaded on demand
|
||||
Plug 'Valloric/YouCompleteMe', { 'for': 'cpp' }
|
||||
autocmd! User YouCompleteMe call youcompleteme#Enable()
|
||||
```
|
||||
|
||||
### Dependency resolution
|
||||
`for` option is generally not needed as most plugins for specific file types
|
||||
usually don't have too much code in `plugin` directory. You might want to
|
||||
examine the output of `vim --startuptime` before applying the option.
|
||||
|
||||
See [Dependency
|
||||
Resolution](https://github.com/junegunn/vim-plug/wiki/Dependency-Resolution).
|
||||
### Post-update hooks
|
||||
|
||||
There are some plugins that require extra steps after installation or update.
|
||||
In that case, use `do` option to describe the task to be performed.
|
||||
|
||||
```vim
|
||||
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
|
||||
Plug 'Valloric/YouCompleteMe', { 'do': './install.sh' }
|
||||
```
|
||||
|
||||
If you need more control, you can pass a reference to a Vim function that
|
||||
takes a single argument.
|
||||
|
||||
```vim
|
||||
function! BuildYCM(info)
|
||||
" info is a dictionary with 3 fields
|
||||
" - name: name of the plugin
|
||||
" - status: 'installed', 'updated', or 'unchanged'
|
||||
" - force: set on PlugInstall! or PlugUpdate!
|
||||
if a:info.status == 'installed' || a:info.force
|
||||
!./install.sh
|
||||
endif
|
||||
endfunction
|
||||
|
||||
Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
|
||||
```
|
||||
|
||||
Both forms of post-update hook are executed inside the directory of the plugin
|
||||
and only run when the repository has changed, but you can force it to run
|
||||
unconditionally with the bang-versions of the commands: `PlugInstall!` and
|
||||
`PlugUpdate!`.
|
||||
|
||||
Make sure to escape BARs and double-quotes when you write `do` option inline
|
||||
as they are mistakenly recognized as command separator or the start of the
|
||||
trailing comment.
|
||||
|
||||
```vim
|
||||
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' }
|
||||
```
|
||||
|
||||
But you can avoid the escaping if you extract the inline specification using a
|
||||
variable (or any Vimscript expression) as follows:
|
||||
|
||||
```vim
|
||||
let g:fzf_install = 'yes | ./install'
|
||||
Plug 'junegunn/fzf', { 'do': g:fzf_install }
|
||||
```
|
||||
|
||||
### FAQ/Troubleshooting
|
||||
|
||||
See [FAQ/Troubleshooting](https://github.com/junegunn/vim-plug/wiki/faq).
|
||||
|
||||
### Articles
|
||||
|
||||
- [Writing my own Vim plugin manager](http://junegunn.kr/2013/09/writing-my-own-vim-plugin-manager)
|
||||
- [Thoughts on Vim plugin dependency](http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency)
|
||||
- [Vim plugins and startup time](http://junegunn.kr/2014/07/vim-plugins-and-startup-time)
|
||||
- ~~[Thoughts on Vim plugin dependency](http://junegunn.kr/2013/09/thoughts-on-vim-plugin-dependency)~~
|
||||
- *Support for Plugfile has been removed since 0.5.0*
|
||||
|
||||
### FAQ/Troubleshooting
|
||||
### License
|
||||
|
||||
#### Plugins are not installed/updated in parallel
|
||||
|
||||
Your Vim does not support Ruby interface. `:echo has('ruby')` should print 1.
|
||||
In order to setup Vim with Ruby support, you may refer to [this
|
||||
article](http://junegunn.kr/2013/09/installing-vim-with-ruby-support).
|
||||
|
||||
#### *Vim: Caught deadly signal SEGV*
|
||||
|
||||
If your Vim crashes with the above message, first check if its Ruby interface is
|
||||
working correctly with the following command:
|
||||
|
||||
```vim
|
||||
:ruby puts RUBY_VERSION
|
||||
```
|
||||
|
||||
If Vim crashes even with this command, it is likely that Ruby interface is
|
||||
broken, and you have to rebuild Vim with a working version of Ruby.
|
||||
(`brew remove vim && brew install vim` or `./configure && make ...`)
|
||||
|
||||
If you're on OS X, one possibility is that you had installed Vim with
|
||||
[Homebrew](http://brew.sh/) while using a Ruby installed with
|
||||
[RVM](http://rvm.io/) or [rbenv](https://github.com/sstephenson/rbenv) and later
|
||||
removed that version of Ruby.
|
||||
|
||||
[Please let me know](https://github.com/junegunn/vim-plug/issues) if you can't
|
||||
resolve the problem. In the meantime, you can set `g:plug_threads` to 1, so that
|
||||
Ruby installer is not used at all.
|
||||
|
||||
#### Errors on fish shell
|
||||
|
||||
If vim-plug doesn't work correctly on fish shell, you might need to add `set
|
||||
shell=/bin/sh` to your .vimrc.
|
||||
|
||||
Refer to the following links for the details:
|
||||
- http://badsimplicity.com/vim-fish-e484-cant-open-file-tmpvrdnvqe0-error/
|
||||
- https://github.com/junegunn/vim-plug/issues/12
|
||||
|
||||
#### Freezing plugin version with commit hash
|
||||
|
||||
vim-plug does not allow you to freeze the version of a plugin with its commit
|
||||
hash. This is by design. I don't believe a user of a plugin should be looking
|
||||
at its individual commits. Instead, one should be choosing the right version
|
||||
using release tags or versioned branches (e.g. 1.2.3, stable, devel, etc.)
|
||||
|
||||
```vim
|
||||
Plug 'junegunn/vim-easy-align', '2.9.2'
|
||||
```
|
||||
|
||||
If the repository doesn't come with such tags or branches, you should think of
|
||||
it as "unstable" or "in development", and always use its latest revision.
|
||||
|
||||
If you really must choose a certain untagged revision, consider forking the
|
||||
repository.
|
||||
|
||||
### Regarding feature request
|
||||
|
||||
You may submit a request for a new feature by [creating an
|
||||
issue](https://github.com/junegunn/vim-plug/issues). However, please be minded
|
||||
that this is an opinionated software and I want to keep the feature set as small
|
||||
as possible. So I may not agree with you on the necessity of the suggested
|
||||
feature. If that happens, I suggest the following options.
|
||||
|
||||
1. Check out [Vundle](https://github.com/gmarik/vundle) or
|
||||
[NeoBundle](https://github.com/Shougo/neobundle.vim).
|
||||
They offer broader feature sets.
|
||||
2. Create a fork of this project and let it be your own plugin manager.
|
||||
There's no need for us to have a single canonical branch.
|
||||
MIT
|
||||
|
||||
|
||||
BIN
plug.png
BIN
plug.png
Binary file not shown.
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 23 KiB |
265
test/regressions.vader
Normal file
265
test/regressions.vader
Normal file
@@ -0,0 +1,265 @@
|
||||
**********************************************************************
|
||||
Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
||||
call plug#begin('$PLUG_FIXTURES')
|
||||
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
|
||||
call plug#end()
|
||||
|
||||
redir => out
|
||||
tabnew a.c
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin') >= 0
|
||||
|
||||
* The same applies to plug#load())
|
||||
redir => out
|
||||
call plug#load('ftplugin-msg')
|
||||
redir END
|
||||
Assert stridx(out, 'ftplugin') >= 0
|
||||
q
|
||||
|
||||
|
||||
**********************************************************************
|
||||
Execute (#114 Should not contain empty path in &rtp):
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#end()
|
||||
|
||||
Log &rtp
|
||||
Assert &rtp !~ ',,', 'Commas'
|
||||
Assert &rtp !~ '^,', 'Comma prefix'
|
||||
Assert &rtp !~ ',$', 'Comma suffix'
|
||||
|
||||
**********************************************************************
|
||||
Execute (#130 Proper cleanup of on-demand loading triggers):
|
||||
augroup PlugLOD
|
||||
autocmd!
|
||||
augroup END
|
||||
|
||||
" Cleared on command
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '<Plug>(EmojiMapping)'] }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
|
||||
Assert exists(':EmojiCommand'), 'EmojiCommand not defined'
|
||||
Assert exists(':EmojiCommand2'), 'EmojiCommand2 not defined'
|
||||
Assert !empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) not defined'
|
||||
|
||||
silent! EmojiCommand
|
||||
|
||||
Assert !exists(':EmojiCommand'), 'EmojiCommand defined'
|
||||
Assert !exists(':EmojiCommand2'), 'EmojiCommand2 defined'
|
||||
Assert empty(mapcheck('<Plug>(EmojiMapping)')), '<Plug>(EmojiMapping) defined'
|
||||
|
||||
" Cleared on FileType
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommandExtra', '<Plug>(EmojiMappingExtra)'], 'for': ['emoji'] }
|
||||
call plug#end()
|
||||
|
||||
Assert exists(':EmojiCommandExtra'), 'EmojiCommandExtra not defined'
|
||||
Assert !empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) not defined'
|
||||
|
||||
setf emoji
|
||||
|
||||
Assert !exists(':EmojiCommandExtra'), 'EmojiCommandExtra defined'
|
||||
Assert empty(mapcheck('<Plug>(EmojiMappingExtra)')), '<Plug>(EmojiMappingExtra) defined'
|
||||
|
||||
**********************************************************************
|
||||
Execute (#131 Syntax error):
|
||||
call plug#begin('/proc/no-permission')
|
||||
Plug 'junegunn/vim-emoji'
|
||||
call plug#end()
|
||||
|
||||
redir => out
|
||||
silent PlugInstall
|
||||
redir END
|
||||
Assert out =~ 'Invalid plug directory: /proc/no-permission', out
|
||||
|
||||
**********************************************************************
|
||||
Execute (#139-1 Using new remote branch):
|
||||
" Make sure to remove the clone
|
||||
call plug#begin('/tmp/plugged')
|
||||
call plug#end()
|
||||
PlugClean!
|
||||
|
||||
" Install master branch
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug expand('file:////tmp/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
|
||||
unlet! g:foo g:bar g:baz
|
||||
call plug#load('new-branch')
|
||||
Assert exists('g:foo'), 'g:foo should be found'
|
||||
Assert !exists('g:bar'), 'g:bar should not be found'
|
||||
Assert !exists('g:baz'), 'g:baz should not be found'
|
||||
|
||||
" Create a new branch on origin
|
||||
call system('cd /tmp/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')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
Plug expand('file:////tmp/new-branch'), { 'branch': 'new' }
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
Log @"
|
||||
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
|
||||
|
||||
unlet! g:foo g:bar g:baz
|
||||
call plug#load('new-branch')
|
||||
Assert exists('g:foo'), 'g:foo should be found'
|
||||
Assert exists('g:bar'), 'g:bar should be found'
|
||||
Assert !exists('g:baz'), 'g:baz should not be found'
|
||||
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
- new-branch: OK
|
||||
- seoul256.vim: OK
|
||||
Finished. 0 error(s).
|
||||
[==]
|
||||
|
||||
Execute (#139-2 Using yet another new remote branch):
|
||||
" Create another branch on origin
|
||||
call system('cd /tmp/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#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
Log @"
|
||||
Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @"
|
||||
|
||||
unlet! g:foo g:bar g:baz
|
||||
call plug#load('new-branch')
|
||||
Assert exists('g:foo'), 'g:foo should be found'
|
||||
Assert !exists('g:bar'), 'g:bar should not be found'
|
||||
Assert exists('g:baz'), 'g:baz should be found'
|
||||
|
||||
call PlugStatusSorted()
|
||||
|
||||
Expect:
|
||||
- new-branch: OK
|
||||
Finished. 0 error(s).
|
||||
[=]
|
||||
|
||||
Execute (#139-3 Should fail when not possible to fast-forward):
|
||||
" Commit on cloned repo
|
||||
call system('cd /tmp/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 &&'
|
||||
\. 'touch foobaz && git add foobaz && git commit -m foobaz')
|
||||
|
||||
for multi in [0, 1]
|
||||
call plug#begin('/tmp/plugged')
|
||||
if multi
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
endif
|
||||
Plug expand('file:////tmp/new-branch')
|
||||
call plug#end()
|
||||
PlugUpdate
|
||||
silent %y
|
||||
Assert @" =~ 'Not possible to fast-forward', @"
|
||||
endfor
|
||||
q
|
||||
|
||||
**********************************************************************
|
||||
Execute (#145: Merging on-demand loading triggers - cmd):
|
||||
unlet! g:xxx g:yyy
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'on': ['XXX', 'YYY'] }
|
||||
call plug#end()
|
||||
|
||||
silent! XXX
|
||||
|
||||
Assert exists('g:xxx'), 'xxx is not loaded'
|
||||
Assert exists('g:yyy'), 'yyy is not loaded'
|
||||
Assert !exists(':YYY')
|
||||
|
||||
Execute (#145: Merging on-demand loading triggers - map):
|
||||
unlet! g:xxx g:yyy
|
||||
|
||||
call ReloadPlug()
|
||||
call plug#begin()
|
||||
Plug '$PLUG_FIXTURES/xxx', { 'on': '<Plug>(xxx)' }
|
||||
Plug '$PLUG_FIXTURES/yyy', { 'on': ['<Plug>(xxx)' ,'<Plug>(yyy)' ] }
|
||||
call plug#end()
|
||||
|
||||
Assert !empty(mapcheck("<Plug>(xxx)"))
|
||||
Assert !empty(mapcheck("<Plug>(yyy)"))
|
||||
|
||||
# FIXME feedkeys() cannot be tested with Vader
|
||||
call plug#load('xxx', 'yyy')
|
||||
Assert empty(mapcheck("<Plug>(xxx)"))
|
||||
Assert empty(mapcheck("<Plug>(yyy)"))
|
||||
|
||||
**********************************************************************
|
||||
Execute (#159: shell=/bin/tcsh):
|
||||
let org = &shell
|
||||
try
|
||||
set shell=/bin/tcsh
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
|
||||
PlugStatus
|
||||
Log getline(1, '$')
|
||||
q
|
||||
AssertEqual '/bin/tcsh', &shell
|
||||
finally
|
||||
let &shell = org
|
||||
endtry
|
||||
|
||||
**********************************************************************
|
||||
Execute (#154: Spaces in &rtp should not be escaped):
|
||||
call plug#begin('/tmp/plug it')
|
||||
Plug 'seoul256 vim'
|
||||
call plug#end()
|
||||
Log &rtp
|
||||
Assert stridx(&rtp, 'plug it/seoul256 vim') >= 0
|
||||
|
||||
**********************************************************************
|
||||
Execute (#184: Duplicate entries in &rtp):
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'plugin1'
|
||||
\| Plug 'plugin0'
|
||||
|
||||
Plug 'plugin2'
|
||||
\| Plug 'plugin0'
|
||||
\| Plug 'plugin1'
|
||||
call plug#end()
|
||||
|
||||
Log &rtp
|
||||
AssertEqual 3, len(filter(split(&rtp, ','), 'stridx(v:val, "plugged") >= 0'))
|
||||
|
||||
**********************************************************************
|
||||
Execute (#236: Plugin removed from &rtp when .vimrc is reloaded):
|
||||
unlet! g:loaded_easy_align_plugin
|
||||
silent! delc EasyAlign
|
||||
|
||||
call ReloadPlug()
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
PlugInstall | q
|
||||
|
||||
Assert &rtp !~ '/vim-easy-align', 'Plugin should not be in &rtp'
|
||||
%EasyAlign=
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should be in &rtp'
|
||||
|
||||
call plug#begin('/tmp/plugged')
|
||||
Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
|
||||
call plug#end()
|
||||
Assert &rtp =~ '/vim-easy-align', 'Plugin should still be in &rtp'
|
||||
97
test/run
97
test/run
@@ -1,22 +1,97 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname $BASH_SOURCE)
|
||||
cd ..
|
||||
PLUG_SRC=$(pwd)/plug.vim
|
||||
cd - > /dev/null
|
||||
cd $(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
if [ ! -d vader.vim ]; then
|
||||
git clone https://github.com/junegunn/vader.vim.git
|
||||
fi
|
||||
export BASE="$PWD"
|
||||
export PLUG_SRC="$PWD/../plug.vim"
|
||||
export PLUG_FIXTURES="$PWD/fixtures"
|
||||
mkdir -p "$PLUG_FIXTURES"
|
||||
|
||||
cat > /tmp/mini-vimrc << VIMRC
|
||||
set rtp+=vader.vim
|
||||
source $PLUG_SRC
|
||||
set rtp+=/tmp/junegunn/vader.vim
|
||||
set shell=/bin/bash
|
||||
VIMRC
|
||||
|
||||
clone() {
|
||||
if [ ! -d $2 ]; then
|
||||
git clone $1 $2
|
||||
fi
|
||||
}
|
||||
|
||||
clone_repos() {
|
||||
cd /tmp
|
||||
mkdir -p junegunn vim-scripts jg
|
||||
for repo in vader.vim goyo.vim rust.vim seoul256.vim vim-easy-align vim-fnr \
|
||||
vim-oblique vim-pseudocl vim-redis vim-emoji; do
|
||||
clone https://github.com/junegunn/${repo}.git junegunn/$repo &
|
||||
done
|
||||
clone https://github.com/vim-scripts/beauty256.git vim-scripts/beauty256 &
|
||||
clone https://github.com/junegunn/fzf.git fzf &
|
||||
wait
|
||||
|
||||
clone junegunn/vim-emoji jg/vim-emoji
|
||||
cd junegunn/seoul256.vim && git checkout no-t_co && git checkout master
|
||||
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
make_dirs() {
|
||||
rm -rf "$PLUG_FIXTURES/$1"
|
||||
mkdir -p "$PLUG_FIXTURES/$1"
|
||||
cd "$PLUG_FIXTURES/$1"
|
||||
mkdir -p autoload colors ftdetect ftplugin indent plugin syntax
|
||||
for d in *; do
|
||||
[ -d $d ] || continue
|
||||
cat > $d/xxx.vim << EOF
|
||||
" echom expand('<sfile>')
|
||||
let g:total_order = get(g:, 'total_order', [])
|
||||
let g:$2 = get(g:, '$2', [])
|
||||
let s:name = join(filter(['$2', '${1:4}', '$d'], '!empty(v:val)'), '/')
|
||||
call add(g:$2, s:name)
|
||||
call add(g:total_order, s:name)
|
||||
EOF
|
||||
done
|
||||
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
prepare() {
|
||||
make_dirs xxx/ xxx
|
||||
make_dirs xxx/after xxx
|
||||
mkdir -p "$PLUG_FIXTURES/xxx/doc"
|
||||
cat > "$PLUG_FIXTURES/xxx/doc/xxx.txt" << DOC
|
||||
hello *xxx*
|
||||
DOC
|
||||
|
||||
make_dirs yyy/ yyy
|
||||
make_dirs yyy/after yyy
|
||||
|
||||
make_dirs z1/ z1
|
||||
make_dirs z2/ z2
|
||||
|
||||
rm -rf "$PLUG_FIXTURES/ftplugin-msg"
|
||||
mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin"
|
||||
echo "echomsg 'ftplugin'" > "$PLUG_FIXTURES/ftplugin-msg/ftplugin/c.vim"
|
||||
|
||||
rm -rf /tmp/new-branch
|
||||
cd /tmp
|
||||
git init new-branch
|
||||
cd new-branch
|
||||
mkdir plugin
|
||||
echo 'let g:foo = 1' > plugin/foo.vim
|
||||
git add plugin/foo.vim
|
||||
git commit -m initial
|
||||
|
||||
cd "$BASE"
|
||||
}
|
||||
|
||||
clone_repos
|
||||
prepare
|
||||
if [ "$1" = '!' ]; then
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! workflow.vader' > /dev/null
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader! test.vader' > /dev/null &&
|
||||
prepare &&
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null
|
||||
else
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader workflow.vader'
|
||||
/usr/local/bin/vim -Nu /tmp/mini-vimrc -c 'Vader test.vader'
|
||||
fi
|
||||
|
||||
|
||||
86
test/test.vader
Normal file
86
test/test.vader
Normal file
@@ -0,0 +1,86 @@
|
||||
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:base_rtp = &rtp
|
||||
let g:first_rtp = split(&rtp, ',')[0]
|
||||
let g:last_rtp = split(&rtp, ',')[-1]
|
||||
let g:temp_plugged = tempname()
|
||||
if !exists('$PLUG_SRC')
|
||||
let $PLUG_SRC = globpath(&rtp, 'autoload/plug.vim')
|
||||
endif
|
||||
|
||||
" Temporarily patch plug.vim
|
||||
call system('cp $PLUG_SRC $PLUG_SRC.org')
|
||||
call writefile(extend(readfile($PLUG_SRC),
|
||||
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_SRC)
|
||||
|
||||
set t_Co=256
|
||||
colo default
|
||||
pclose
|
||||
|
||||
function! PlugStatusSorted()
|
||||
PlugStatus
|
||||
%y
|
||||
q
|
||||
normal! P
|
||||
%sort
|
||||
g/^$/d
|
||||
endfunction
|
||||
|
||||
function! AssertExpect(bang, pat, cnt)
|
||||
let op = a:bang ? '==#' : '=~#'
|
||||
AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
|
||||
endfunction
|
||||
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
|
||||
|
||||
function! EnsureLoaded()
|
||||
if has('vim_starting')
|
||||
runtime! plugin/**/*.vim
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! RmRf(file)
|
||||
call system(printf('rm -rf "%s"', a:file))
|
||||
endfunction
|
||||
|
||||
function! ReloadPlug()
|
||||
call ResetPlug()
|
||||
source $PLUG_SRC
|
||||
let &rtp = g:base_rtp
|
||||
endfunction
|
||||
|
||||
source $PLUG_SRC
|
||||
|
||||
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]))
|
||||
endif
|
||||
redir END
|
||||
Log substitute(out, '\n', '', 'g')
|
||||
|
||||
Include: workflow.vader
|
||||
Include: regressions.vader
|
||||
|
||||
Execute (Cleanup):
|
||||
silent! call RmRf(g:temp_plugged)
|
||||
silent! unlet g:plugs g:plug_home g:plug_url_format
|
||||
silent! unlet g:temp_plugged g:first_rtp g:last_rtp g:base_rtp out
|
||||
silent! delf PlugStatusSorted
|
||||
silent! delf AssertExpect
|
||||
silent! delf PlugUpdated
|
||||
silent! delf EnsureLoaded
|
||||
silent! delf ReloadPlug
|
||||
silent! delc AssertExpect
|
||||
silent! unmap /
|
||||
silent! unmap ?
|
||||
call system('mv $PLUG_SRC.org $PLUG_SRC')
|
||||
|
||||
Restore
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user