From: Alexander Goussas Date: Thu, 12 Jun 2025 02:28:40 +0000 (-0500) Subject: nvim: add keymaps for toggleterm X-Git-Url: http://git.frustrated-labs.net/?a=commitdiff_plain;h=a3a72306494d377f98cc9182719c672910a8a804;p=dotfiles.git nvim: add keymaps for toggleterm These are for being able to navigate between panes when the terminal buffer is active. --- 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 - } - , + }, + } })