mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 18:47:29 -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)
|
for [name, j] in items(s:jobs)
|
||||||
silent! call jobstop(j.jobid)
|
silent! call jobstop(j.jobid)
|
||||||
if j.new
|
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
|
endif
|
||||||
endfor
|
endfor
|
||||||
let s:jobs = {}
|
let s:jobs = {}
|
||||||
@ -1191,8 +1191,16 @@ function! s:with_cd(cmd, dir)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:system(cmd, ...)
|
function! s:system(cmd, ...)
|
||||||
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
try
|
||||||
return system(s:is_win ? '('.cmd.')' : cmd)
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:system_chomp(...)
|
function! s:system_chomp(...)
|
||||||
@ -1280,7 +1288,7 @@ function! s:clean(force)
|
|||||||
if yes
|
if yes
|
||||||
for dir in todo
|
for dir in todo
|
||||||
if isdirectory(dir)
|
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
|
endif
|
||||||
endfor
|
endfor
|
||||||
call append(line('$'), 'Removed.')
|
call append(line('$'), 'Removed.')
|
||||||
@ -1297,7 +1305,7 @@ function! s:upgrade()
|
|||||||
redraw
|
redraw
|
||||||
try
|
try
|
||||||
if executable('curl')
|
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
|
if v:shell_error
|
||||||
throw get(s:lines(output), -1, v:shell_error)
|
throw get(s:lines(output), -1, v:shell_error)
|
||||||
endif
|
endif
|
||||||
@ -1510,7 +1518,7 @@ function! s:snapshot(...) abort
|
|||||||
\ ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '',
|
\ ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '',
|
||||||
\ ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.s:esc(home)]] :
|
\ ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.s:esc(home)]] :
|
||||||
\ ['sh', '$PLUG_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)]]
|
\ 'vim +PlugUpdate +qa', '', 'PLUG_HOME='.s:esc(home)]]
|
||||||
|
|
||||||
call s:prepare()
|
call s:prepare()
|
||||||
@ -1535,7 +1543,7 @@ function! s:snapshot(...) abort
|
|||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
let fn = s:esc(expand(a:1))
|
let fn = s:esc(expand(a:1))
|
||||||
call writefile(getline(1, '$'), fn)
|
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
|
echo 'Saved to '.a:1
|
||||||
silent execute 'e' fn
|
silent execute 'e' fn
|
||||||
endif
|
endif
|
||||||
|
@ -201,3 +201,20 @@ Execute (#145: Merging on-demand loading triggers - map):
|
|||||||
Assert empty(mapcheck("<Plug>(xxx)"))
|
Assert empty(mapcheck("<Plug>(xxx)"))
|
||||||
Assert empty(mapcheck("<Plug>(yyy)"))
|
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!
|
PlugClean!
|
||||||
PlugInstall
|
PlugInstall
|
||||||
PlugSnapshot
|
PlugSnapshot
|
||||||
AssertEqual '#!/bin/bash', getline(1)
|
AssertEqual '#!/bin/sh', getline(1)
|
||||||
AssertEqual '# Generated by vim-plug', getline(2)
|
AssertEqual '# Generated by vim-plug', getline(2)
|
||||||
AssertEqual 'vim +PlugUpdate +qa', getline(5)
|
AssertEqual 'vim +PlugUpdate +qa', getline(5)
|
||||||
AssertEqual 'PLUG_HOME=$TMPDIR/plugged', getline(7)
|
AssertEqual 'PLUG_HOME=$TMPDIR/plugged', getline(7)
|
||||||
|
Loading…
Reference in New Issue
Block a user