add cmake-tools and some initial config/support for cmake projects

This commit is contained in:
Gered 2024-09-04 14:23:08 -04:00
parent 376794ae63
commit 68bc8119a4
6 changed files with 28 additions and 1 deletions

View file

@ -26,6 +26,7 @@ vim.g.have_nerd_font = true
require 'options'
require 'keymaps'
require 'lazy-bootstrap'
require 'autocmds'
require 'lazy-plugins'
require 'helper/health'

View file

@ -2,6 +2,7 @@
"LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" },
"barbar.nvim": { "branch": "master", "commit": "31b6951c53a59bccfa91bf3984ed1510a940c836" },
"beacon.nvim": { "branch": "master", "commit": "098ff96c33874339d5e61656f3050dbd587d6bd5" },
"cmake-tools.nvim": { "branch": "master", "commit": "4be3c229fe932043fd83ad52fdf0ba9af7297789" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },

18
lua/autocmds.lua Normal file
View file

@ -0,0 +1,18 @@
-- 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,
})

View file

@ -0,0 +1,6 @@
return {
{
'Civitasv/cmake-tools.nvim',
opts = {},
},
}

View file

@ -169,6 +169,7 @@ return {
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
clangd = {},
cmake = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- Some languages (like typescript) have entire language plugins that can be useful:

View file

@ -42,13 +42,13 @@ return {
-- Document existing key chains
spec = {
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
{ '<leader>d', group = '[D]ebug' },
{ '<leader>s', group = '[S]earch' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>l', group = '[L]SP' },
{ '<leader>b', group = '[B]uffer' },
{ '<leader>r', group = '[R]ust' },
{ '<leader>c', group = '[C]Make' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
},
},