better windows detection and fallback shell

This commit is contained in:
Baipyrus 2024-05-14 11:07:01 +02:00
parent b93e5eeb7f
commit 5137d4bbea

View File

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