dotfiles/lua/autocmds.lua

19 lines
751 B
Lua

-- TODO: why does this cmake-tools autocmd ONLY work when it is here and not
-- when it is inside that plugin's `config` function? that `config`
-- function pattern seems to work with a bunch of other plugins' autocmds ... ?
vim.api.nvim_create_autocmd('User', {
pattern = 'CMakeToolsEnterProject',
callback = function(event)
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'CMake: ' .. desc })
end
map('<leader>cc', '<Cmd>CMakeClean<CR>', '[C]lean')
map('<leader>cg', '<Cmd>CMakeGenerate<CR>', '[G]enerate')
map('<leader>cr', '<Cmd>CMakeRun<CR>', '[R]un')
map('<leader>cd', '<Cmd>CMakeDebug<CR>', '[D]ebug')
end,
})