bugfix: use pwsh by explicite file extension

This commit is contained in:
Baipyrus 2024-10-22 16:40:16 +02:00
parent bb27e773c5
commit 7404b85ee4
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }
-- Open terminal in current window
local use_ps = vim.fn.has 'win32' == 1 or vim.fn.has 'wsl' == 1
local shellname = vim.fn.executable 'pwsh' == 1 and 'pwsh' or 'powershell'
local shellname = vim.fn.executable 'pwsh.exe' == 1 and 'pwsh' or 'powershell'
local cond_str = use_ps and (' ' .. shellname .. '.exe') or ''
vim.keymap.set({ 'n', 'v' }, '<leader>to', '<cmd>term' .. cond_str .. '<cr>', { desc = '[T]erminal [O]pen' })

View File

@ -9,7 +9,7 @@ vim.cmd 'silent! language en_US'
-- Shell options
-- Sets the shell to use for system() and ! commands in windows
if vim.fn.has 'win32' == 1 and vim.fn.has 'wsl' == 0 then
vim.opt.shell = vim.fn.executable 'pwsh' == 1 and 'pwsh' or 'powershell'
vim.opt.shell = vim.fn.executable 'pwsh.exe' == 1 and 'pwsh' or 'powershell'
vim.opt.shellcmdflag = '-NoLogo -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
vim.opt.shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait'
vim.opt.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'