From 0a255ee62da085a01ab376fd69a97e0e26df4da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Dagur?= Date: Wed, 8 Aug 2018 01:52:00 +0000 Subject: [PATCH 1/5] Clear colorcolumn in vim-plug buffer (#779) --- plug.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plug.vim b/plug.vim index 52c6b2a..5d2b00e 100644 --- a/plug.vim +++ b/plug.vim @@ -763,6 +763,9 @@ function! s:prepare(...) execute 'silent! unmap ' k endfor setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline modifiable nospell + if exists('+colorcolumn') + setlocal colorcolumn= + endif setf vim-plug if exists('g:syntax_on') call s:syntax() From 8ed2617ba088cadcc4c87c9fa1007b4633b06442 Mon Sep 17 00:00:00 2001 From: "Samuel D. Leslie" Date: Thu, 6 Sep 2018 15:48:54 +1000 Subject: [PATCH 2/5] 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. --- plug.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index 5d2b00e..686dd47 100644 --- a/plug.vim +++ b/plug.vim @@ -1011,6 +1011,8 @@ function! s:update_impl(pull, force, args) abort let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input' endif + let s:submodule_opt = s:git_version_requirement(2, 8) ? ' --jobs='.threads : '' + " Python version requirement (>= 2.7) if python && !has('python3') && !ruby && !use_job && s:update.threads > 1 redir => pyv @@ -1102,7 +1104,7 @@ function! s:update_finish() if !v:shell_error && filereadable(spec.dir.'/.gitmodules') && \ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir)) call s:log4(name, 'Updating submodules. This may take a while.') - let out .= s:bang('git submodule update --init --recursive 2>&1', spec.dir) + let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir) endif let msg = s:format_message(v:shell_error ? 'x': '-', name, out) if v:shell_error From 7f8fdd044431ae60776cd8d64d2454fcfe134427 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 12 Sep 2018 13:40:33 +0900 Subject: [PATCH 3/5] Ignore useless use of on-demand loading (#786) --- plug.vim | 10 +++++++++- test/regressions.vader | 1 + test/run | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/plug.vim b/plug.vim index 686dd47..3b49660 100644 --- a/plug.vim +++ b/plug.vim @@ -193,6 +193,14 @@ function! s:ask_no_interrupt(...) endtry endfunction +function! s:lazy(plug, opt) + return has_key(a:plug, a:opt) && + \ (empty(s:to_a(a:plug[a:opt])) || + \ !isdirectory(a:plug.dir) || + \ len(s:glob(s:rtp(a:plug), 'plugin')) || + \ len(s:glob(s:rtp(a:plug), 'after/plugin'))) +endfunction + function! plug#end() if !exists('g:plugs') return s:err('Call plug#begin() first') @@ -214,7 +222,7 @@ function! plug#end() continue endif let plug = g:plugs[name] - if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') + if get(s:loaded, name, 0) || !s:lazy(plug, 'on') && !s:lazy(plug, 'for') let s:loaded[name] = 1 continue endif diff --git a/test/regressions.vader b/test/regressions.vader index dd2a6a2..40f6d4b 100644 --- a/test/regressions.vader +++ b/test/regressions.vader @@ -41,6 +41,7 @@ Execute (#130 Proper cleanup of on-demand loading triggers): Plug 'junegunn/vim-emoji', { 'on': ['EmojiCommand', 'EmojiCommand2', '(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' diff --git a/test/run b/test/run index 6e19ed8..bcccba3 100755 --- a/test/run +++ b/test/run @@ -87,7 +87,7 @@ DOC make_dirs z2/ z2 rm -rf "$PLUG_FIXTURES/ftplugin-msg" - mkdir -p "$PLUG_FIXTURES/ftplugin-msg/ftplugin" + 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" From b6050d6f03f3e2792589535249e3c997d3e94461 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 12 Sep 2018 13:45:38 +0900 Subject: [PATCH 4/5] Allow cloning into an empty directory (#782) Close #766 We can rely on git to check if the destination directory is empty. --- plug.vim | 2 +- test/workflow.vader | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/plug.vim b/plug.vim index 3b49660..db1f615 100644 --- a/plug.vim +++ b/plug.vim @@ -1331,7 +1331,7 @@ while 1 " Without TCO, Vim stack is bound to explode let name = keys(s:update.todo)[0] let spec = remove(s:update.todo, name) - let new = !isdirectory(spec.dir) + let new = empty(globpath(spec.dir, '.git', 1)) call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...') redraw diff --git a/test/workflow.vader b/test/workflow.vader index d76a13b..5bd14e1 100644 --- a/test/workflow.vader +++ b/test/workflow.vader @@ -1511,7 +1511,7 @@ Execute (Commit hash support): Log getline(1, '$') 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...') + 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 @@ -1638,3 +1638,15 @@ Execute (#532 - Reuse plug window): AssertEqual 2, winnr(), 'Current window is #2 after PlugStatus (but is '.winnr().')' AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')' q + +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 From 734d9a11b5a6354e6a66e152dee5d311233e033c Mon Sep 17 00:00:00 2001 From: Nate Fischer Date: Sat, 3 Nov 2018 11:00:00 -0700 Subject: [PATCH 5/5] 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 ~ **********************************************************************