From a3a72306494d377f98cc9182719c672910a8a804 Mon Sep 17 00:00:00 2001 From: Alexander Goussas Date: Wed, 11 Jun 2025 21:28:40 -0500 Subject: [PATCH] nvim: add keymaps for toggleterm These are for being able to navigate between panes when the terminal buffer is active. --- nvim/.config/nvim/init.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 30abddc..b1e72c1 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -234,11 +234,27 @@ require("lazy").setup({ command = "tno tt ToggleTerm" }) + function _G.set_terminal_keymaps() + local opts = {buffer = 0} + vim.keymap.set('t', '', [[]], opts) + vim.keymap.set('t', 'jk', [[]], opts) + vim.keymap.set('t', '', [[wincmd h]], opts) + vim.keymap.set('t', '', [[wincmd j]], opts) + vim.keymap.set('t', '', [[wincmd k]], opts) + vim.keymap.set('t', '', [[wincmd l]], opts) + vim.keymap.set('t', '', [[]], opts) + end + + vim.api.nvim_create_autocmd({"TermEnter"}, { + pattern = "term://*toggleterm#*", + command = "lua set_terminal_keymaps()" + }) + require("toggleterm").setup({ shade_terminals = false, }) end - } - , + }, + } }) -- 2.43.0