mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 10:35:38 -07:00
Merge pull request #160 from junegunn/fix-159
Fix #159 - Avoid errors on tcsh and fish
This commit is contained in:
commit
619e42a182
22
plug.vim
22
plug.vim
@ -777,7 +777,7 @@ function! s:job_abort()
|
||||
for [name, j] in items(s:jobs)
|
||||
silent! call jobstop(j.jobid)
|
||||
if j.new
|
||||
call system('rm -rf ' . s:shellesc(g:plugs[name].dir))
|
||||
call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir))
|
||||
endif
|
||||
endfor
|
||||
let s:jobs = {}
|
||||
@ -1191,8 +1191,16 @@ function! s:with_cd(cmd, dir)
|
||||
endfunction
|
||||
|
||||
function! s:system(cmd, ...)
|
||||
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||
return system(s:is_win ? '('.cmd.')' : cmd)
|
||||
try
|
||||
let sh = &shell
|
||||
if !s:is_win
|
||||
set shell=sh
|
||||
endif
|
||||
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||
return system(s:is_win ? '('.cmd.')' : cmd)
|
||||
finally
|
||||
let &shell = sh
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:system_chomp(...)
|
||||
@ -1280,7 +1288,7 @@ function! s:clean(force)
|
||||
if yes
|
||||
for dir in todo
|
||||
if isdirectory(dir)
|
||||
call system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(dir))
|
||||
call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(dir))
|
||||
endif
|
||||
endfor
|
||||
call append(line('$'), 'Removed.')
|
||||
@ -1297,7 +1305,7 @@ function! s:upgrade()
|
||||
redraw
|
||||
try
|
||||
if executable('curl')
|
||||
let output = system(printf('curl -fLo %s %s', s:shellesc(new), s:plug_src))
|
||||
let output = s:system(printf('curl -fLo %s %s', s:shellesc(new), s:plug_src))
|
||||
if v:shell_error
|
||||
throw get(s:lines(output), -1, v:shell_error)
|
||||
endif
|
||||
@ -1510,7 +1518,7 @@ function! s:snapshot(...) abort
|
||||
\ ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '',
|
||||
\ ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.s:esc(home)]] :
|
||||
\ ['sh', '$PLUG_HOME',
|
||||
\ ['#!/bin/bash', '# Generated by vim-plug', '# '.strftime("%c"), '',
|
||||
\ ['#!/bin/sh', '# Generated by vim-plug', '# '.strftime("%c"), '',
|
||||
\ 'vim +PlugUpdate +qa', '', 'PLUG_HOME='.s:esc(home)]]
|
||||
|
||||
call s:prepare()
|
||||
@ -1535,7 +1543,7 @@ function! s:snapshot(...) abort
|
||||
if a:0 > 0
|
||||
let fn = s:esc(expand(a:1))
|
||||
call writefile(getline(1, '$'), fn)
|
||||
if !s:is_win | call system('chmod +x ' . fn) | endif
|
||||
if !s:is_win | call s:system('chmod +x ' . fn) | endif
|
||||
echo 'Saved to '.a:1
|
||||
silent execute 'e' fn
|
||||
endif
|
||||
|
@ -201,3 +201,20 @@ Execute (#145: Merging on-demand loading triggers - map):
|
||||
Assert empty(mapcheck("<Plug>(xxx)"))
|
||||
Assert empty(mapcheck("<Plug>(yyy)"))
|
||||
|
||||
**********************************************************************
|
||||
Execute (#159: shell=/bin/tcsh):
|
||||
let org = &shell
|
||||
try
|
||||
set shell=/bin/tcsh
|
||||
call plug#begin('$TMPDIR/plugged')
|
||||
Plug 'junegunn/seoul256.vim'
|
||||
call plug#end()
|
||||
|
||||
PlugStatus
|
||||
Log getline(1, '$')
|
||||
q
|
||||
AssertEqual '/bin/tcsh', &shell
|
||||
finally
|
||||
let &shell = org
|
||||
endtry
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ Execute (PlugSnapshot):
|
||||
PlugClean!
|
||||
PlugInstall
|
||||
PlugSnapshot
|
||||
AssertEqual '#!/bin/bash', getline(1)
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user