添加cmake-vsenv支持。
This commit is contained in:
@@ -1,24 +1,25 @@
|
|||||||
-- Keymaps are automatically loaded on the VeryLazy event
|
|
||||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
|
||||||
-- Add any additional keymaps here
|
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
local Terminal = require("toggleterm.terminal").Terminal
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
|
|
||||||
-- 测试外部命令。
|
-- 创建通用函数
|
||||||
local dir_term = Terminal:new({
|
local function createCMakeTask(action)
|
||||||
cmd = "cmd.exe /c dir",
|
return function()
|
||||||
direction = "float",
|
local cwd = vim.fn.getcwd()
|
||||||
float_opts = {
|
local dir_term = Terminal:new({
|
||||||
|
cmd = "cmake-vsenv -t Debug -a " .. action .. " -r " .. cwd,
|
||||||
|
direction = "float",
|
||||||
|
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,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set("n", "<Leader>mt", function()
|
|
||||||
dir_term:toggle()
|
dir_term:toggle()
|
||||||
end, { desc = "List directory contents" })
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 设置快捷键
|
||||||
|
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>mr", createCMakeTask("Clear"), { desc = "RemoveBuild" })
|
||||||
|
|||||||
Reference in New Issue
Block a user