From 96f4f18d7d81c786ac0df5723bc7aca058bf2165 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 21 Mar 2026 09:50:09 +0100 Subject: [PATCH] fix(terminal): use Snacks.terminal.focus() for mapping Switches from toggle() to focus() so that only hides the terminal when you're currently in it. Restores hide win keys for terminal mode. Closes #7048 Co-Authored-By: Claude Opus 4.6 (1M context) --- lua/lazyvim/config/keymaps.lua | 4 ++-- lua/lazyvim/plugins/util.lua | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 05d07a21..9651e4e6 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -189,8 +189,8 @@ map("n", "L", function() LazyVim.news.changelog() end, { desc = "LazyVim -- floating terminal map("n", "fT", function() Snacks.terminal() end, { desc = "Terminal (cwd)" }) map("n", "ft", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) -map({"n","t"}, "",function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) -map({"n","t"}, "",function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" }) +map({"n","t"}, "",function() Snacks.terminal.focus(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" }) +map({"n","t"}, "",function() Snacks.terminal.focus(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" }) -- windows map("n", "-", "s", { desc = "Split Window Below", remap = true }) diff --git a/lua/lazyvim/plugins/util.lua b/lua/lazyvim/plugins/util.lua index 8d8aa220..9d0d231c 100644 --- a/lua/lazyvim/plugins/util.lua +++ b/lua/lazyvim/plugins/util.lua @@ -23,6 +23,8 @@ return { nav_j = { "", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" }, nav_k = { "", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" }, nav_l = { "", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" }, + hide_slash = { "", "hide", desc = "Hide Terminal", mode = "t" }, + hide_underscore = { "", "hide", desc = "which_key_ignore", mode = "t" }, }, }, },