From 784649d4dde1594c845c7306acb397a06e45e8fe Mon Sep 17 00:00:00 2001
From: qw457812 <37494864+qw457812@users.noreply.github.com>
Date: Tue, 11 Nov 2025 18:45:07 +0800
Subject: [PATCH] fix(terminal): term toggle key `` now only work for
terminals opened by itself
And `gco`/`gcO` keymaps now use blackhole register to avoid overwriting default register.
---
lua/lazyvim/config/keymaps.lua | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua
index 05d07a21..2d032713 100644
--- a/lua/lazyvim/config/keymaps.lua
+++ b/lua/lazyvim/config/keymaps.lua
@@ -85,8 +85,8 @@ map("x", "<", "", ">gv")
-- commenting
-map("n", "gco", "oVcxnormal gccfxa", { desc = "Add Comment Below" })
-map("n", "gcO", "OVcxnormal gccfxa", { desc = "Add Comment Above" })
+map("n", "gco", 'oV"_cxnormal gccfxa', { desc = "Add Comment Below" })
+map("n", "gcO", 'OV"_cxnormal gccfxa', { desc = "Add Comment Above" })
-- lazy
map("n", "l", "Lazy", { desc = "Lazy" })
@@ -189,8 +189,18 @@ 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(nil, {
+ cwd = LazyVim.root(),
+ win = { keys = { hide_slash = { "", "hide", desc = "Hide Terminal", mode = "t" } } },
+ })
+end, { desc = "Terminal (Root Dir)" })
+map({ "n", "t" }, "", function()
+ Snacks.terminal(nil, {
+ cwd = LazyVim.root(),
+ win = { keys = { hide_underscore = { "", "hide", desc = "which_key_ignore", mode = "t" } } },
+ })
+end, { desc = "which_key_ignore" })
-- windows
map("n", "-", "s", { desc = "Split Window Below", remap = true })