mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 10:35:38 -07:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
a600a675d0
@ -7,7 +7,7 @@ env:
|
||||
- PATH=$DEPS/bin:$PATH
|
||||
matrix:
|
||||
include:
|
||||
- env: ENV=vim72
|
||||
- env: ENV=vim74
|
||||
rvm: 1.8.7
|
||||
addons: { apt: { packages: [vim-nox] } }
|
||||
- env: ENV=python
|
||||
@ -26,7 +26,7 @@ install: |
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Your Name"
|
||||
|
||||
if [ "$ENV" == "vim72" ]; then
|
||||
if [ "$ENV" == "vim74" ]; then
|
||||
mkdir -p ${DEPS}/bin
|
||||
ln -s /usr/bin/vim.nox ${DEPS}/bin/vim
|
||||
return
|
||||
|
@ -149,7 +149,7 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
||||
| ----------------------------------- | ------------------------------------------------------------------ |
|
||||
| `PlugInstall [name ...] [#threads]` | Install plugins |
|
||||
| `PlugUpdate [name ...] [#threads]` | Install or update plugins |
|
||||
| `PlugClean[!]` | Remove (Uninstall) unused plugin directories (bang version will clean without prompt) |
|
||||
| `PlugClean[!]` | Remove (Uninstall) 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 |
|
||||
|
@ -194,7 +194,7 @@ Reload .vimrc and `:PlugInstall` to install plugins.
|
||||
------------------------------------+-------------------------------------------------------------------
|
||||
`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
|
||||
|
26
plug.vim
26
plug.vim
@ -434,8 +434,8 @@ endfunction
|
||||
|
||||
function! s:dobufread(names)
|
||||
for name in a:names
|
||||
let path = s:rtp(g:plugs[name]).'/**'
|
||||
for dir in ['ftdetect', 'ftplugin']
|
||||
let path = s:rtp(g:plugs[name])
|
||||
for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
|
||||
if len(finddir(dir, path))
|
||||
if exists('#BufRead')
|
||||
doautocmd BufRead
|
||||
@ -794,9 +794,7 @@ endfunction
|
||||
|
||||
function! s:chsh(swap)
|
||||
let prev = [&shell, &shellcmdflag, &shellredir]
|
||||
if s:is_win
|
||||
set shell=cmd.exe shellcmdflag=/c shellredir=>%s\ 2>&1
|
||||
elseif a:swap
|
||||
if !s:is_win && a:swap
|
||||
set shell=sh shellredir=>%s\ 2>&1
|
||||
endif
|
||||
return prev
|
||||
@ -811,7 +809,7 @@ function! s:bang(cmd, ...)
|
||||
if s:is_win
|
||||
let batchfile = tempname().'.bat'
|
||||
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
||||
let cmd = batchfile
|
||||
let cmd = s:shellesc(expand(batchfile))
|
||||
endif
|
||||
let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
|
||||
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
|
||||
@ -1210,7 +1208,7 @@ function! s:spawn(name, cmd, opts)
|
||||
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
|
||||
if !empty(job.batchfile)
|
||||
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
|
||||
let cmd = job.batchfile
|
||||
let cmd = s:shellesc(expand(job.batchfile))
|
||||
endif
|
||||
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
|
||||
|
||||
@ -2037,9 +2035,9 @@ function! s:system(cmd, ...)
|
||||
if s:is_win
|
||||
let batchfile = tempname().'.bat'
|
||||
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
||||
let cmd = batchfile
|
||||
let cmd = s:shellesc(expand(batchfile))
|
||||
endif
|
||||
return system(s:is_win ? '('.cmd.')' : cmd)
|
||||
return system(cmd)
|
||||
finally
|
||||
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
|
||||
if s:is_win
|
||||
@ -2224,7 +2222,7 @@ function! s:upgrade()
|
||||
let new = tmp . '/plug.vim'
|
||||
|
||||
try
|
||||
let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp))
|
||||
let out = s:system(printf('git clone --depth 1 %s %s', s:shellesc(s:plug_src), s:shellesc(tmp)))
|
||||
if v:shell_error
|
||||
return s:err('Error upgrading vim-plug: '. out)
|
||||
endif
|
||||
@ -2371,7 +2369,7 @@ function! s:preview_commit()
|
||||
if s:is_win
|
||||
let batchfile = tempname().'.bat'
|
||||
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
||||
let cmd = batchfile
|
||||
let cmd = expand(batchfile)
|
||||
endif
|
||||
execute 'silent %!' cmd
|
||||
finally
|
||||
@ -2420,7 +2418,11 @@ function! s:diff()
|
||||
call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
|
||||
for [k, v] in plugs
|
||||
let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..'
|
||||
let diff = s:system_chomp('git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)')), v.dir)
|
||||
let cmd = 'git log --graph --color=never '.join(map(['--pretty=format:%x01%h%x01%d%x01%s%x01%cr', range], 's:shellesc(v:val)'))
|
||||
if has_key(v, 'rtp')
|
||||
let cmd .= ' -- '.s:shellesc(v.rtp)
|
||||
endif
|
||||
let diff = s:system_chomp(cmd, v.dir)
|
||||
if !empty(diff)
|
||||
let ref = has_key(v, 'tag') ? (' (tag: '.v.tag.')') : has_key(v, 'commit') ? (' '.v.commit) : ''
|
||||
call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
|
||||
|
@ -537,6 +537,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 ~
|
||||
**********************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user