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" })