From 44b45b7c1154d72e2ee645673b11afb3fc931df2 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Thu, 24 Oct 2024 16:42:05 +0200 Subject: [PATCH] simply apply pwsh as shell for wsl instead of f7e7530 --- lua/keymaps.lua | 5 +---- lua/options.lua | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 1864baf..1e75fd9 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -16,10 +16,7 @@ vim.keymap.set('n', 'q', vim.diagnostic.setqflist, { desc = 'Open diagno vim.keymap.set('t', '', '', { 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.exe' == 1 and 'pwsh' or 'powershell' -local cond_str = use_ps and (' ' .. shellname .. '.exe') or '' -vim.keymap.set({ 'n', 'v' }, 'to', 'term' .. cond_str .. '', { desc = '[T]erminal [O]pen' }) +vim.keymap.set({ 'n', 'v' }, 'to', 'term', { desc = '[T]erminal [O]pen' }) -- Disable arrow keys in normal mode vim.keymap.set({ 'n', 'v' }, '', 'echo "Use h to move!!"') diff --git a/lua/options.lua b/lua/options.lua index aaaaec7..a43fa62 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -7,9 +7,9 @@ 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.exe' == 1 and 'pwsh' or 'powershell' +-- 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 + 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'