From f7e753013c5b7ee994b11f1159f3c95abe7faecc Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Tue, 22 Oct 2024 14:55:08 +0200 Subject: [PATCH] using powershell/pwsh for windows/wsl installations --- lua/keymaps.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 1e75fd9..d563a78 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -16,7 +16,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setqflist, { desc = 'Open diagno vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- Open terminal in current window -vim.keymap.set({ 'n', 'v' }, 'to', 'term', { desc = '[T]erminal [O]pen' }) +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 cond_str = use_ps and (' ' .. shellname .. '.exe') or '' +vim.keymap.set({ 'n', 'v' }, 'to', 'term' .. cond_str .. '', { desc = '[T]erminal [O]pen' }) -- Disable arrow keys in normal mode vim.keymap.set({ 'n', 'v' }, '', 'echo "Use h to move!!"')