12 Commits
0.5.2 ... 0.5.3

Author SHA1 Message Date
Junegunn Choi
3a2e406cd0 Merge pull request #47 from junegunn/fix-upgrade
Do not require reloading of .vimrc after PlugUpgrade
2014-08-05 19:09:17 +09:00
Junegunn Choi
84cdf61730 Do not require reloading of .vimrc after PlugUpgrade 2014-08-05 18:52:19 +09:00
Junegunn Choi
0aeea1db08 Update README.md 2014-08-05 15:32:28 +09:00
Junegunn Choi
8289477d18 Revert "Make sure update/install after PlugUpgrade work"
This reverts commit 19b12e2216.

No luck. The user still have to reload .vimrc anyway. Let's just make it
clear that a restart can be required after PlugUpgrade.
2014-08-05 01:50:03 +09:00
Junegunn Choi
19b12e2216 Make sure update/install after PlugUpgrade work
By not assuming `frozen` property exists. I tried to fix it with
s:upgrade_specs, but it has no effect if the old version of vim-plug
doesn't know about it.
2014-08-05 01:43:42 +09:00
Junegunn Choi
4c9ebe9c31 Add -bar option to commands 2014-08-05 01:31:19 +09:00
Junegunn Choi
74dcd13575 s:upgrade_specs should be called after reloading the source 2014-08-05 01:25:34 +09:00
Junegunn Choi
518f20652f Merge pull request #46 from vheon/fix-multiple-create-directory
Do not try to create g:plug_home more than once
2014-08-05 00:56:26 +09:00
Andrea Cedraro
665ec057d7 Do not try to create g:plug_home more than once 2014-08-04 17:43:34 +02:00
Junegunn Choi
bc212dca77 Merge pull request #45 from junegunn/travis-ci-rubies
Test against multiple versions of Ruby
2014-08-04 16:40:11 +09:00
Junegunn Choi
8da7b50fb2 Test against multiple versions of Ruby
As discussed in junegunn/vim-plug#31
2014-08-04 16:31:05 +09:00
Junegunn Choi
4ae2e879e1 Note on escaping double quotes in inline expression 2014-08-02 14:04:03 +09:00
4 changed files with 63 additions and 43 deletions

View File

@@ -1,4 +1,7 @@
language: vim
language: ruby
rvm:
- 1.8.7
- 2.0.0
before_script: |
hg clone https://code.google.com/p/vim/

View File

@@ -25,7 +25,8 @@ and put it in ~/.vim/autoload
```sh
mkdir -p ~/.vim/autoload
curl -fLo ~/.vim/autoload/plug.vim https://raw.github.com/junegunn/vim-plug/master/plug.vim
curl -fLo ~/.vim/autoload/plug.vim \
https://raw.github.com/junegunn/vim-plug/master/plug.vim
```
Edit your .vimrc
@@ -60,14 +61,14 @@ Reload .vimrc and `:PlugInstall` to install plugins.
### Commands
| Command | Description |
| --------------------------------- | ------------------------------------------------------------------ |
| PlugInstall [name ...] [#threads] | Install plugins |
| PlugUpdate [name ...] [#threads] | Install or update plugins |
| PlugClean[!] | Remove unused directories (bang version will clean without prompt) |
| PlugUpgrade | Upgrade vim-plug itself |
| PlugStatus | Check the status of plugins |
| PlugDiff | See the updated changes from the previous PlugUpdate |
| Command | Description |
| ----------------------------------- | ------------------------------------------------------------------ |
| `PlugInstall [name ...] [#threads]` | Install plugins |
| `PlugUpdate [name ...] [#threads]` | Install or update plugins |
| `PlugClean[!]` | Remove unused directories (bang version will clean without prompt) |
| `PlugUpgrade` | Upgrade vim-plug itself |
| `PlugStatus` | Check the status of plugins |
| `PlugDiff` | See the updated changes from the previous PlugUpdate |
### `Plug` options
@@ -151,8 +152,9 @@ 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 when you write `do` option inline as they are
mistakenly recognized as command separator for Plug command.
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' }

View File

@@ -92,13 +92,6 @@ function! plug#begin(...)
return s:err('Unable to determine plug home. Try calling plug#begin() with a path argument.')
endif
if !isdirectory(home)
try
call mkdir(home, 'p')
catch
return s:err('Invalid plug directory: '. home)
endtry
endif
if !executable('git')
return s:err('`git` executable not found. vim-plug requires git.')
endif
@@ -108,17 +101,20 @@ function! plug#begin(...)
" we want to keep track of the order plugins where registered.
let g:plugs_order = []
command! -nargs=+ -bar Plug call s:add(<args>)
command! -nargs=* -bang -complete=customlist,s:names PlugInstall call s:install(!empty('<bang>'), <f-args>)
command! -nargs=* -bang -complete=customlist,s:names PlugUpdate call s:update(!empty('<bang>'), <f-args>)
command! -nargs=0 -bang PlugClean call s:clean('<bang>' == '!')
command! -nargs=0 PlugUpgrade if s:upgrade() | call s:upgrade_specs() | execute 'source '. s:me | endif
command! -nargs=0 PlugStatus call s:status()
command! -nargs=0 PlugDiff call s:diff()
call s:define_commands()
return 1
endfunction
function! s:define_commands()
command! -nargs=+ -bar Plug call s:add(<args>)
command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install('<bang>' == '!', <f-args>)
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update('<bang>' == '!', <f-args>)
command! -nargs=0 -bar -bang PlugClean call s:clean('<bang>' == '!')
command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source '. s:me | endif
command! -nargs=0 -bar PlugStatus call s:status()
command! -nargs=0 -bar PlugDiff call s:diff()
endfunction
function! s:to_a(v)
return type(a:v) == s:TYPE.list ? a:v : [a:v]
endfunction
@@ -561,15 +557,21 @@ function! s:update_impl(pull, force, args) abort
return
endif
if !isdirectory(g:plug_home)
try
call mkdir(g:plug_home, 'p')
catch
return s:err(printf('Invalid plug directory: %s.'
\ 'Try to call plug#begin with a valid directory', g:plug_home))
endtry
endif
call s:prepare()
call append(0, a:pull ? 'Updating plugins' : 'Installing plugins')
call append(1, '['. s:lpad('', len(todo)) .']')
normal! 2G
redraw
if !isdirectory(g:plug_home)
call mkdir(g:plug_home, 'p')
endif
let s:prev_update = { 'errors': [], 'pull': a:pull, 'force': a:force, 'new': {}, 'threads': threads }
if has('ruby') && threads > 1
try
@@ -1004,16 +1006,13 @@ function! s:upgrade()
call system(printf(
\ 'curl -fLo %s %s && '.cp.' %s %s.old && '.mv.' %s %s',
\ new, s:plug_source, mee, mee, new, mee))
if v:shell_error == 0
unlet g:loaded_plug
echo 'Downloaded '. s:plug_source
return 1
else
if v:shell_error
return s:err('Error upgrading vim-plug')
endif
elseif has('ruby')
echo 'Downloading '. s:plug_source
ruby << EOF
try
ruby << EOF
require 'open-uri'
require 'fileutils'
me = VIM::evaluate('s:me')
@@ -1025,12 +1024,16 @@ function! s:upgrade()
FileUtils.cp me, old
File.rename new, me
EOF
unlet g:loaded_plug
echo 'Downloaded '. s:plug_source
return 1
catch
return s:err('Error upgrading vim-plug')
endtry
else
return s:err('curl executable or ruby support not found')
endif
unlet g:loaded_plug
echo 'Downloaded '. s:plug_source
return 1
endfunction
function! s:upgrade_specs()
@@ -1147,6 +1150,12 @@ endfunction
let s:first_rtp = s:esc(get(split(&rtp, ','), 0, ''))
let s:last_rtp = s:esc(get(split(&rtp, ','), -1, ''))
if exists('g:plugs')
let g:plugs_order = get(g:, 'plugs_order', keys(g:plugs))
call s:upgrade_specs()
call s:define_commands()
endif
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -33,6 +33,12 @@ Execute (Initialize test environment):
endfunction
command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
Execute (Print Ruby version):
redir => out
silent ruby puts RUBY_VERSION
redir END
Log substitute(out, '\n', '', 'g')
Execute (plug#end() before plug#begin() should fail):
redir => out
AssertEqual 0, plug#end()
@@ -506,15 +512,15 @@ Execute (Frozen plugin are not installed nor updated):
Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
call plug#end()
redir => output
redir => out
silent PlugInstall
redir END
Assert output =~ 'No plugin to install'
Assert out =~ 'No plugin to install'
redir => output
redir => out
silent PlugUpdate
redir END
Assert output =~ 'No plugin to update'
Assert out =~ 'No plugin to update'
Execute (But you can still install it if the name is given as the argument):
PlugInstall vim-easy-align