添加C-q退出窗口快捷键。
This commit is contained in:
@@ -2,23 +2,25 @@ local Terminal = require("toggleterm.terminal").Terminal
|
|||||||
|
|
||||||
-- 创建通用函数
|
-- 创建通用函数
|
||||||
local function createCMakeTask(action)
|
local function createCMakeTask(action)
|
||||||
return function()
|
return function()
|
||||||
local cwd = vim.fn.getcwd()
|
local cwd = vim.fn.getcwd()
|
||||||
local dir_term = Terminal:new({
|
local dir_term = Terminal:new({
|
||||||
cmd = "cmake-vsenv -t Debug -a " .. action .. " -r " .. cwd,
|
cmd = "cmake-vsenv -t Debug -a " .. action .. " -r " .. cwd,
|
||||||
direction = "float",
|
direction = "float",
|
||||||
float_opts = {
|
float_opts = {
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
width = 100,
|
width = 100,
|
||||||
height = 30,
|
height = 30,
|
||||||
},
|
},
|
||||||
hidden = false,
|
hidden = false,
|
||||||
close_on_exit = false,
|
close_on_exit = false,
|
||||||
})
|
})
|
||||||
dir_term:toggle()
|
dir_term:toggle()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- vim.keymap.set("t", "q", "<C-\\><C-n>:q<CR>", { desc = "Exit terminal and close window" })
|
||||||
|
vim.keymap.set("t", "<C-q>", "<cmd>close<CR>", { desc = "Exit terminal and close window" })
|
||||||
-- 设置快捷键
|
-- 设置快捷键
|
||||||
vim.keymap.set("n", "<Leader>mc", createCMakeTask("Config"), { desc = "ConfigDebug" })
|
vim.keymap.set("n", "<Leader>mc", createCMakeTask("Config"), { desc = "ConfigDebug" })
|
||||||
vim.keymap.set("n", "<Leader>mb", createCMakeTask("Build"), { desc = "BuildDebug" })
|
vim.keymap.set("n", "<Leader>mb", createCMakeTask("Build"), { desc = "BuildDebug" })
|
||||||
|
|||||||
Reference in New Issue
Block a user