From 734d9a11b5a6354e6a66e152dee5d311233e033c Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Sat, 3 Nov 2018 11:00:00 -0700 Subject: [PATCH 1/7] 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`. --- plug.vim | 6 +++++- test/workflow.vader | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index db1f615..4e05630 100644 --- a/plug.vim +++ b/plug.vim @@ -2420,7 +2420,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)'))) diff --git a/test/workflow.vader b/test/workflow.vader index 5bd14e1..7e2c352 100644 --- a/test/workflow.vader +++ b/test/workflow.vader @@ -537,6 +537,51 @@ Execute (PlugDiff): Assert !empty(mapcheck("\")) 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("\")) + q + ********************************************************************** ~ On-demand loading / Partial installation/update ~ ********************************************************************** From d1c19a6fa934d90718c18e40acbec0ad7014e931 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 22 Feb 2019 03:14:16 +0100 Subject: [PATCH 2/7] Travis: rename vim72 to vim74 (#723) --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5fc0240..028ca78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 From 518a3566c32cec35c68749c765127ef6f7703630 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 11 Apr 2019 17:53:13 +0900 Subject: [PATCH 3/7] Escape arguments to git command during PlugUpgrade Fix #832 --- plug.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index 4e05630..123035e 100644 --- a/plug.vim +++ b/plug.vim @@ -2224,7 +2224,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 From 08e78d8a5ea874bebbd7f39de7bb540d9b539963 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 29 May 2019 18:29:11 +0900 Subject: [PATCH 4/7] Avoid downward search when using finddir Close #750 --- plug.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plug.vim b/plug.vim index 123035e..2c26070 100644 --- a/plug.vim +++ b/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 From f1ad2d864ab43c56bf86ce01be9971f62bc14f6c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 17 Jun 2019 17:00:59 -0400 Subject: [PATCH 5/7] Escape batchfile path on Windows (#850) Close #832 --- plug.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plug.vim b/plug.vim index 2c26070..bfafbfb 100644 --- a/plug.vim +++ b/plug.vim @@ -811,7 +811,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(batchfile) endif let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') execute "normal! :execute g:_plug_bang\\" @@ -1210,7 +1210,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(job.batchfile) endif let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd) @@ -2037,9 +2037,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(batchfile) endif - return system(s:is_win ? '('.cmd.')' : cmd) + return system(cmd) finally let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] if s:is_win From fddbcb8f1a37e216504b3d14859a0a992a81cd5d Mon Sep 17 00:00:00 2001 From: Harry Moreno Date: Tue, 9 Jul 2019 03:16:02 -0400 Subject: [PATCH 6/7] Change PlugClean description (#853) Be more clear about uninstalling plugin directories. --- README.md | 2 +- doc/plug.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c6d785b..2bda1a5 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,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 | diff --git a/doc/plug.txt b/doc/plug.txt index 6a5c602..7f3eaa0 100644 --- a/doc/plug.txt +++ b/doc/plug.txt @@ -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 From 226d6abeb2f02bcd8f5b11288543259fa2e02962 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 15 Jul 2019 20:06:27 -0400 Subject: [PATCH 7/7] 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 --- plug.vim | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plug.vim b/plug.vim index bfafbfb..afb1772 100644 --- a/plug.vim +++ b/plug.vim @@ -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 = s:shellesc(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\\" @@ -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 = s:shellesc(job.batchfile) + let cmd = s:shellesc(expand(job.batchfile)) endif let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd) @@ -2037,7 +2035,7 @@ function! s:system(cmd, ...) if s:is_win let batchfile = tempname().'.bat' call writefile(["@echo off\r", cmd . "\r"], batchfile) - let cmd = s:shellesc(batchfile) + let cmd = s:shellesc(expand(batchfile)) endif return system(cmd) finally @@ -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