From 49cf119df846fbfe312094e6b0bb7f6b5154a620 Mon Sep 17 00:00:00 2001 From: taynpg Date: Wed, 11 Feb 2026 15:10:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0C-q=E9=80=80=E5=87=BA?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=BF=AB=E6=8D=B7=E9=94=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/config/keymaps.lua | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 0de42e0..cd9809c 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -2,23 +2,25 @@ local Terminal = require("toggleterm.terminal").Terminal -- 创建通用函数 local function createCMakeTask(action) - return function() - local cwd = vim.fn.getcwd() - local dir_term = Terminal:new({ - cmd = "cmake-vsenv -t Debug -a " .. action .. " -r " .. cwd, - direction = "float", - float_opts = { - border = "rounded", - width = 100, - height = 30, - }, - hidden = false, - close_on_exit = false, - }) - dir_term:toggle() - end + return function() + local cwd = vim.fn.getcwd() + local dir_term = Terminal:new({ + cmd = "cmake-vsenv -t Debug -a " .. action .. " -r " .. cwd, + direction = "float", + float_opts = { + border = "rounded", + width = 100, + height = 30, + }, + hidden = false, + close_on_exit = false, + }) + dir_term:toggle() + end end +-- vim.keymap.set("t", "q", ":q", { desc = "Exit terminal and close window" }) +vim.keymap.set("t", "", "close", { desc = "Exit terminal and close window" }) -- 设置快捷键 vim.keymap.set("n", "mc", createCMakeTask("Config"), { desc = "ConfigDebug" }) vim.keymap.set("n", "mb", createCMakeTask("Build"), { desc = "BuildDebug" })