From b98b66242bf6ec28c256ddff2a274e2e7a43d832 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 18 Jun 2024 18:02:36 +0900 Subject: [PATCH] Fix PlugClean when &shell is powershell on Windows (#1283) --- plug.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index 56e7ff1d..6296f8bc 100644 --- a/plug.vim +++ b/plug.vim @@ -2281,7 +2281,10 @@ endfunction function! s:with_cd(cmd, dir, ...) let script = a:0 > 0 ? a:1 : 1 - return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd) + let pwsh = s:is_powershell(&shell) + let cd = s:is_win && !pwsh ? 'cd /d' : 'cd' + let sep = pwsh ? ';' : '&&' + return printf('%s %s %s %s', cd, plug#shellescape(a:dir, {'script': script, 'shell': &shell}), sep, a:cmd) endfunction function! s:system(cmd, ...)