feat(defaults): shelltemp=false #33012

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
This commit is contained in:
Alexej Kowalew
2025-04-12 17:24:42 +02:00
committed by GitHub
parent c8fbb0d2ee
commit d77d961b35
11 changed files with 140 additions and 64 deletions

View File

@@ -642,7 +642,7 @@ function M.source(code)
end
function M.has_powershell()
return M.eval('executable("' .. (is_os('win') and 'powershell' or 'pwsh') .. '")') == 1
return M.eval('executable("pwsh")') == 1
end
--- Sets Nvim shell to powershell.
@@ -655,7 +655,7 @@ function M.set_shell_powershell(fake)
if not fake then
assert(found)
end
local shell = found and (is_os('win') and 'powershell' or 'pwsh') or M.testprg('pwsh-test')
local shell = found and 'pwsh' or M.testprg('pwsh-test')
local cmd = 'Remove-Item -Force '
.. table.concat(
is_os('win') and { 'alias:cat', 'alias:echo', 'alias:sleep', 'alias:sort', 'alias:tee' }
@@ -671,7 +671,7 @@ function M.set_shell_powershell(fake)
let &shellcmdflag .= '$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';'
let &shellcmdflag .= ']] .. cmd .. [['
let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode'
let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode'
let &shellpipe = '> %s 2>&1'
]])
return found
end