From b9022d9046ca4bc2fcff2554e560653029d160bc Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 11 Dec 2016 13:25:33 +0100 Subject: [PATCH 1/8] test/workflow.vader: minor Assert improvement (#563) --- test/workflow.vader | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/workflow.vader b/test/workflow.vader index 92d790f..dfc5604 100644 --- a/test/workflow.vader +++ b/test/workflow.vader @@ -270,8 +270,8 @@ Execute (PlugClean! to remove vim-emoji): PlugClean! AssertExpect '^\~ ', 1 AssertEqual 'Removed 1 directories.', getline(4) - Assert empty(globpath(&rtp, 'colors/seoul256.vim')) - Assert empty(globpath(&rtp, 'autoload/emoji.vim')) + Assert empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim was removed' + Assert empty(globpath(&rtp, 'autoload/emoji.vim')), 'emoji was removed' q Execute (PlugUpdate to install both again): From 1540764563f9b69841d3211866bea7f74e9269a4 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 11 Dec 2016 13:43:44 +0100 Subject: [PATCH 2/8] git_validate: better error with checkout being ahead/diverged (#546) --- plug.vim | 19 ++++++++++++++---- test/workflow.vader | 47 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/plug.vim b/plug.vim index d16afe8..1f55f7b 100644 --- a/plug.vim +++ b/plug.vim @@ -2013,10 +2013,21 @@ function! s:git_validate(spec, check_branch) \ branch, a:spec.branch) endif if empty(err) - let commits = len(s:lines(s:system(printf('git rev-list origin/%s..HEAD', a:spec.branch), a:spec.dir))) - if !v:shell_error && commits - let err = join([printf('Diverged from origin/%s by %d commit(s).', a:spec.branch, commits), - \ 'Reinstall after PlugClean.'], "\n") + let [ahead, behind] = split(s:lastline(s:system(printf( + \ 'git rev-list --count --left-right HEAD...origin/%s', + \ a:spec.branch), a:spec.dir)), '\t') + if !v:shell_error && ahead + if behind + " Only mention PlugClean if diverged, otherwise it's likely to be + " pushable (and probably not that messed up). + let err = printf( + \ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n" + \ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind) + else + let err = printf("Ahead of origin/%s by %d commit(s).\n" + \ .'Cannot update until local changes are pushed.', + \ a:spec.branch, ahead) + endif endif endif endif diff --git a/test/workflow.vader b/test/workflow.vader index dfc5604..1b3efef 100644 --- a/test/workflow.vader +++ b/test/workflow.vader @@ -212,7 +212,7 @@ Expect: [==] x seoul256.vim: -Execute (Corrected the URI but diverged from master): +Execute (Corrected the URI but ahead of upstream): call plug#begin() Plug 'junegunn/seoul256.vim' Plug 'file:///tmp/vim-plug-test/jg/vim-emoji' @@ -223,8 +223,8 @@ Execute (Corrected the URI but diverged from master): call PlugStatusSorted() Expect: - Diverged from origin/master by 3 commit(s). - Reinstall after PlugClean. + Ahead of origin/master by 3 commit(s). + Cannot update until local changes are pushed. - vim-emoji: OK Finished. 1 error(s). [==] @@ -237,11 +237,44 @@ Expect: # q # PGdd -Execute (PlugClean! to remove seoul256.vim): +Execute (PlugClean! keeps seoul256.vim): PlugClean! - " Three removed, emoji left - AssertEqual 'Removed 3 directories.', getline(4) - AssertExpect '^\~ ', 3 + " Two removed, emoji and seoul256 left + AssertEqual 'Removed 2 directories.', getline(4) + AssertExpect '^\~ ', 2 + AssertExpect 'Diverged', 0 + Assert !empty(globpath(&rtp, 'colors/seoul256.vim')) + Assert !empty(globpath(&rtp, 'autoload/emoji.vim')) + q + +Execute (Make seoul256 to be diverged): + call plug#begin() + Plug 'junegunn/seoul256.vim' + Plug 'file:///tmp/vim-plug-test/jg/vim-emoji' + call plug#end() + call system(printf(join([ + \ 'cd "%s"', + \ 'git fetch --unshallow', + \ 'git reset "@{u}~1"', + \ 'git commit --allow-empty -m "diverged1"', + \ 'git commit --allow-empty -m "diverged2"'], ' && '), + \ g:plugs['seoul256.vim'].dir)) + Assert empty(v:shell_error), 'Got shell error: '.v:shell_error + call PlugStatusSorted() + +Expect: + Backup local changes and run PlugClean and PlugUpdate to reinstall it. + Diverged from origin/master (2 commit(s) ahead and 1 commit(s) behind! + - vim-emoji: OK + Finished. 1 error(s). + [==] + x seoul256.vim: + +Execute (PlugClean! removes seoul256.vim): + PlugClean! + " One removed, emoji left + AssertEqual 'Removed 1 directories.', getline(4) + AssertExpect '^\~ ', 1 AssertExpect 'Diverged', 1 Assert empty(globpath(&rtp, 'colors/seoul256.vim')) Assert !empty(globpath(&rtp, 'autoload/emoji.vim')) From 5bccd9bc987a2459b3128ccd28d24e9697069e13 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Tue, 13 Dec 2016 04:25:46 +0100 Subject: [PATCH 3/8] Neovim: use "dict" when referring to "self" (#566) --- plug.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index 1f55f7b..f318ff0 100644 --- a/plug.vim +++ b/plug.vim @@ -1153,7 +1153,7 @@ function! s:job_cb(fn, job, ch, data) call call(a:fn, [a:job, a:data]) endfunction -function! s:nvim_cb(job_id, data, event) abort +function! s:nvim_cb(job_id, data, event) dict abort return a:event == 'stdout' ? \ s:job_cb('s:job_out_cb', self, 0, join(a:data, "\n")) : \ s:job_cb('s:job_exit_cb', self, 0, a:data) From a4aac4cf567bb060356694991064f687f8758a81 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 13 Dec 2016 12:13:54 +0900 Subject: [PATCH 4/8] Do not check Ruby interface when parallel update is not needed In case Ruby interface is completely broken that simply running `:ruby require 'thread'` crashes Vim. Close #564 --- plug.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index f318ff0..9165956 100644 --- a/plug.vim +++ b/plug.vim @@ -955,7 +955,7 @@ function! s:update_impl(pull, force, args) abort let use_job = s:nvim || s:vim8 let python = (has('python') || has('python3')) && !use_job - let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && s:check_ruby() + let ruby = has('ruby') && !use_job && (v:version >= 703 || v:version == 702 && has('patch374')) && !(s:is_win && has('gui_running')) && threads > 1 && s:check_ruby() let s:update = { \ 'start': reltime(), From 8180692f81132d9c7de1130ae1f13fb7c64ff18f Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 18 Dec 2016 12:05:13 +0900 Subject: [PATCH 5/8] Update usage examples vim-plug has no support for dependencies. Remove comment that has been a source of confusion. #544 --- README.md | 2 +- plug.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a3a0c7..f170a66 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Plug 'junegunn/vim-easy-align' " Any valid git URL is allowed Plug 'https://github.com/junegunn/vim-github-dashboard.git' -" Group dependencies, vim-snippets depends on ultisnips +" Multiple Plug commands can be written in a single line using | separators Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " On-demand loading diff --git a/plug.vim b/plug.vim index 9165956..2bece3c 100644 --- a/plug.vim +++ b/plug.vim @@ -18,7 +18,7 @@ " " Any valid git URL is allowed " Plug 'https://github.com/junegunn/vim-github-dashboard.git' " -" " Group dependencies, vim-snippets depends on ultisnips +" " Multiple Plug commands can be written in a single line using | separators " Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " " " On-demand loading From b50f9bb16b9832235beb60ed290393a5d03a4bf5 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 18 Dec 2016 12:12:57 +0900 Subject: [PATCH 6/8] More description on `plug#end` Related: #379 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f170a66..53f17be 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ Add a vim-plug section to your `~/.vimrc` (or `~/.config/nvim/init.vim` for Neov 1. Begin the section with `call plug#begin()` 1. List the plugins with `Plug` commands 1. `call plug#end()` to update `&runtimepath` and initialize plugin system + - Automatically executes `filetype plugin indent on` and `syntax enable`. + You can revert the settings after the call. e.g. `filetype indent off`, `syntax off`, etc. #### Example From f916aabfbef2cc0517b88c49ccaab7293027d746 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 19 Dec 2016 01:58:15 +0900 Subject: [PATCH 7/8] Update documentation /cc @accolade --- README.md | 2 +- plug.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53f17be..9d15c3a 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " Unmanaged plugin (manually installed and updated) Plug '~/my-prototype-plugin' -" Add plugins to &runtimepath +" Initialize plugin system call plug#end() ``` diff --git a/plug.vim b/plug.vim index 2bece3c..b245aa7 100644 --- a/plug.vim +++ b/plug.vim @@ -40,7 +40,7 @@ " " Unmanaged plugin (manually installed and updated) " Plug '~/my-prototype-plugin' " -" " Add plugins to &runtimepath +" " Initialize plugin system " call plug#end() " " Then reload .vimrc and :PlugInstall to install plugins. From 0b1343b582047930b928383b75eb28c1a38c15dc Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 30 Dec 2016 03:29:00 +0100 Subject: [PATCH 8/8] test/run: shellcheck fixes (#562) --- test/run | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/run b/test/run index 1e80cbc..d1706d9 100755 --- a/test/run +++ b/test/run @@ -1,6 +1,10 @@ #!/bin/bash -cd $(dirname "${BASH_SOURCE[0]}") +# Privileged mode, ignores $CDPATH etc. +set -p +set -eu + +cd "$(dirname "${BASH_SOURCE[0]}")" export BASE="$PWD" export PLUG_SRC="$PWD/../plug.vim" @@ -16,8 +20,8 @@ set shell=/bin/bash VIMRC clone() { - if [ ! -d $2 ]; then - git clone $1 $2 + if [ ! -d "$2" ]; then + git clone "$1" "$2" fi } @@ -44,8 +48,8 @@ make_dirs() ( 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 + [ -d "$d" ] || continue + cat > "$d/xxx.vim" << EOF " echom expand('') let g:total_order = get(g:, 'total_order', []) let g:$2 = get(g:, '$2', []) @@ -97,7 +101,7 @@ DOC select_vim() { local vim=/usr/bin/vim - if [ -n "$DEPS" ] && [ -e "${DEPS}/bin/vim" ]; then + if [ -n "${DEPS:-}" ] && [ -e "${DEPS}/bin/vim" ]; then vim="${DEPS}/bin/vim" elif [ -e "/usr/local/bin/vim" ]; then vim=/usr/local/bin/vim @@ -111,7 +115,7 @@ prepare git --version VIM=$(select_vim) echo "Selected Vim: $VIM" -if [ "$1" = '!' ]; then +if [ "${1:-}" = '!' ]; then $VIM -Nu $TEMP/mini-vimrc -c 'Vader! test.vader' > /dev/null && prepare && $VIM -Nu $TEMP/mini-vimrc -c 'let g:plug_threads = 1 | Vader! test.vader' > /dev/null