fix(terminal): use Snacks.terminal.focus() for <C-/> mapping

Switches from toggle() to focus() so that <C-/> 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) <noreply@anthropic.com>
This commit is contained in:
Folke Lemaitre 2026-03-21 09:50:09 +01:00
parent 2a5c892835
commit 96f4f18d7d
No known key found for this signature in database
GPG key ID: 9B52594D560070AB
2 changed files with 4 additions and 2 deletions

View file

@ -189,8 +189,8 @@ map("n", "<leader>L", function() LazyVim.news.changelog() end, { desc = "LazyVim
-- floating terminal
map("n", "<leader>fT", function() Snacks.terminal() end, { desc = "Terminal (cwd)" })
map("n", "<leader>ft", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" })
map({"n","t"}, "<c-/>",function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" })
map({"n","t"}, "<c-_>",function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" })
map({"n","t"}, "<c-/>",function() Snacks.terminal.focus(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" })
map({"n","t"}, "<c-_>",function() Snacks.terminal.focus(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" })
-- windows
map("n", "<leader>-", "<C-W>s", { desc = "Split Window Below", remap = true })

View file

@ -23,6 +23,8 @@ return {
nav_j = { "<C-j>", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" },
nav_k = { "<C-k>", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" },
nav_l = { "<C-l>", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" },
hide_slash = { "<C-/>", "hide", desc = "Hide Terminal", mode = "t" },
hide_underscore = { "<c-_>", "hide", desc = "which_key_ignore", mode = "t" },
},
},
},