-- 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('cc', 'CMakeClean', '[C]lean') map('cg', 'CMakeGenerate', '[G]enerate') map('cr', 'CMakeRun', '[R]un') map('cd', 'CMakeDebug', '[D]ebug') end, })