From d9f73282686ae281fc7887f68f9dc31a5b478b7f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 8 Apr 2020 06:18:32 -0400 Subject: [PATCH] Set shellredir on Windows Prep to use list type for command passed to s:system() within s:spawn() --- plug.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plug.vim b/plug.vim index 6cbed4b..c2a9f9e 100644 --- a/plug.vim +++ b/plug.vim @@ -864,8 +864,15 @@ endfunction function! s:chsh(swap) let prev = [&shell, &shellcmdflag, &shellredir] - if !s:is_win && a:swap - set shell=sh shellredir=>%s\ 2>&1 + if !s:is_win + set shell=sh + endif + if a:swap + if &shell =~# 'powershell\.exe' || &shell =~# 'pwsh$' + let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s' + elseif &shell =~# 'sh' || &shell =~# 'cmd\.exe' + set shellredir=>%s\ 2>&1 + endif endif return prev endfunction