From d8beb7892e78474511899202972a145e8fbb9762 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Thu, 10 Sep 2026 22:25:18 +0200 Subject: Make window nav work from terminal buffers too only works in Normal mode; a terminal buffer (e.g. claude-code.nvim's split) is in Terminal mode by default, where keystrokes go straight to the running process instead of Neovim. Add terminal-mode versions of the existing mappings that escape to Normal mode () before running the window command, so leaving a terminal split works the same one-chord way as moving between any other windows. Deliberately not mapping to escape terminal mode (the vimrc had this commented out too) - many programs run inside a terminal buffer (claude included) and need to receive a real Escape keypress. --- neovim/.config/nvim/lua/config/keymaps.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'neovim') diff --git a/neovim/.config/nvim/lua/config/keymaps.lua b/neovim/.config/nvim/lua/config/keymaps.lua index f0bfbec..66e97a0 100644 --- a/neovim/.config/nvim/lua/config/keymaps.lua +++ b/neovim/.config/nvim/lua/config/keymaps.lua @@ -1,10 +1,18 @@ local map = vim.keymap.set --- Switch windows with +-- Switch windows with , from Normal mode or from inside a +-- terminal buffer (e.g. claude-code.nvim's split) without leaving it first. +-- Terminal mode passes keys straight to the running process by default, so +-- alone never reaches Neovim there - escapes to +-- Normal mode before running the window command. map("n", "", "j") map("n", "", "k") map("n", "", "h") map("n", "", "l") +map("t", "", [[j]]) +map("t", "", [[k]]) +map("t", "", [[h]]) +map("t", "", [[l]]) -- Never use the arrow keys for _, key in ipairs({ "", "", "", "" }) do -- cgit v1.3