From ca521b400ccd92f6bfd62c67e167fba4c0194b28 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Sat, 2 Nov 2024 14:21:13 +0100 Subject: [PATCH] import shell options from kickstart-based config for windows-pwsh --- lua/config/options.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/config/options.lua b/lua/config/options.lua index f359bb9..a33e7a1 100755 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -11,9 +11,15 @@ vim.g.base_dir = vim.fn.getcwd() -- Set display language vim.cmd("silent! language en_US") --- Detect and use PowerShell on Windows +-- Sets the shell to use for system() and ! commands in windows and wsl if vim.fn.has("win32") == 1 or vim.fn.has("wsl") == 1 then - LazyVim.terminal.setup("pwsh") + vim.opt.shell = vim.fn.executable("pwsh.exe") == 1 and "pwsh.exe" or "powershell.exe" + 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" + vim.opt.shellxquote = "" + vim.opt.shellquote = "" end -- Indenting