diff --git a/plug.vim b/plug.vim index 8695e47..11141f1 100644 --- a/plug.vim +++ b/plug.vim @@ -115,7 +115,7 @@ function! s:define_commands() command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install('' == '!', []) command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update('' == '!', []) command! -nargs=0 -bar -bang PlugClean call s:clean('' == '!') - command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:me | endif + command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif command! -nargs=0 -bar PlugStatus call s:status() command! -nargs=0 -bar PlugDiff call s:diff() command! -nargs=? -bar PlugSnapshot call s:snapshot() @@ -132,7 +132,7 @@ endfunction function! s:source(from, ...) for pattern in a:000 for vim in s:lines(globpath(a:from, pattern)) - execute 'source' vim + execute 'source' s:esc(vim) endfor endfor endfunction @@ -1562,11 +1562,12 @@ function! s:snapshot(...) abort endfor if a:0 > 0 - let fn = s:esc(expand(a:1)) + let fn = expand(a:1) + let fne = s:esc(fn) call writefile(getline(1, '$'), fn) - if !s:is_win | call s:system('chmod +x ' . fn) | endif + if !s:is_win | call s:system('chmod +x ' . fne) | endif echo 'Saved to '.a:1 - silent execute 'e' fn + silent execute 'e' fne endif endfunction diff --git a/test/workflow.vader b/test/workflow.vader index cc78d51..d6168b5 100644 --- a/test/workflow.vader +++ b/test/workflow.vader @@ -1008,21 +1008,22 @@ Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home q ********************************************************************** -Execute (PlugSnapshot): - call plug#begin('$TMPDIR/plugged') - Plug 'junegunn/vim-emoji' +Execute (PlugSnapshot / #154 issues with paths containing spaces): + call plug#begin('$TMPDIR/plug with spaces') + Plug 'junegunn/vim-easy-align' Plug 'junegunn/seoul256.vim' call plug#end() PlugClean! PlugInstall + call plug#load('vim-easy-align') " Should properly hand paths with spaces PlugSnapshot AssertEqual '#!/bin/sh', getline(1) AssertEqual '# Generated by vim-plug', getline(2) AssertEqual 'vim +PlugUpdate +qa', getline(5) - AssertEqual 'PLUG_HOME=$TMPDIR/plugged', getline(7) + AssertEqual 'PLUG_HOME=$TMPDIR/plug\ with\ spaces', getline(7) AssertEqual 0, stridx(getline(9), 'cd $PLUG_HOME/seoul256.vim/ && git reset --hard') - AssertEqual 0, stridx(getline(10), 'cd $PLUG_HOME/vim-emoji/ && git reset --hard') + AssertEqual 0, stridx(getline(10), 'cd $PLUG_HOME/vim-easy-align/ && git reset --hard') AssertEqual 'sh', &filetype execute 'PlugSnapshot' g:plug_home.'/snapshot.sh'