simply apply pwsh as shell for wsl instead of f7e7530

This commit is contained in:
Baipyrus 2024-10-24 16:42:05 +02:00
parent 7404b85ee4
commit 44b45b7c11
2 changed files with 4 additions and 7 deletions

View File

@ -16,10 +16,7 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setqflist, { desc = 'Open diagno
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.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' })
vim.keymap.set({ 'n', 'v' }, '<leader>to', '<cmd>term<cr>', { desc = '[T]erminal [O]pen' })
-- Disable arrow keys in normal mode
vim.keymap.set({ 'n', 'v' }, '<left>', '<cmd>echo "Use h to move!!"<CR>')

View File

@ -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'