summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbpc2003 <wpesfriendnva@gmail.com>2025-05-19 16:09:46 -0400
committerbpc2003 <wpesfriendnva@gmail.com>2025-05-19 16:09:46 -0400
commit5a5a7b7ba5e5a4f83a2c76c46dd9d05bea8b88d8 (patch)
tree7c97db05fe27f1172131eb289889cf17e1c5503f
parentf08a1d80993366e19a5f5f8db4b2d68554317492 (diff)
Add commenting
-rw-r--r--lazy-lock.json1
-rw-r--r--lua/config/lazy.lua6
-rw-r--r--lua/plugins/keybindings.lua16
-rw-r--r--lua/plugins/lspconfig.lua8
4 files changed, 27 insertions, 4 deletions
diff --git a/lazy-lock.json b/lazy-lock.json
index 245f528..06074c6 100644
--- a/lazy-lock.json
+++ b/lazy-lock.json
@@ -1,4 +1,5 @@
{
+ "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"gruvbox.nvim": { "branch": "main", "commit": "00e38a379bab3389e187b3953566d67d494dfddd" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" },
diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua
index b707a30..adc467e 100644
--- a/lua/config/lazy.lua
+++ b/lua/config/lazy.lua
@@ -47,6 +47,12 @@ require("lazy").setup({
{
"ellisonleao/gruvbox.nvim"
},
+ {
+ "numToStr/Comment.nvim",
+ config = function()
+ require('Comment').setup()
+ end,
+ },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
diff --git a/lua/plugins/keybindings.lua b/lua/plugins/keybindings.lua
index cb40552..10d8436 100644
--- a/lua/plugins/keybindings.lua
+++ b/lua/plugins/keybindings.lua
@@ -36,6 +36,22 @@ vim.keymap.set('n', '<Leader>lr', ':Lazy restore<CR>', { noremap = true })
vim.keymap.set('n', '<Leader>lp', ':Lazy profile<CR>', { noremap = true })
vim.keymap.set('n', '<Leader>ld', ':Lazy debug<CR>', { noremap = true })
+-- ==============Comments============
+-- Comment out a group of lines
+vim.keymap.set('x', '<Leader>/', function()
+ local api = require('Comment.api')
+ local esc = vim.api.nvim_replace_termcodes('<ESC>', true, false, true)
+ vim.api.nvim_feedkeys(esc, 'nx', false)
+ api.toggle.linewise(vim.fn.visualmode())
+end)
+
+-- Comment out the current line
+vim.keymap.set('n', '<Leader>/', function()
+ local api = require('Comment.api')
+ api.toggle.linewise.current()
+end)
+
+
-- ============file commands=========
-- write
vim.keymap.set('n', '<Leader>s', ':w<CR>', { noremap = true })
diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua
index 586a03e..da34c9f 100644
--- a/lua/plugins/lspconfig.lua
+++ b/lua/plugins/lspconfig.lua
@@ -5,9 +5,9 @@ vim.diagnostic.config({
severity_sort = true,
})
-vim.lsp.config['ccls'] = {
- cmd = { 'ccls' },
- root_markers = { '.ccls-cache', '.ccls' },
+vim.lsp.config['clangd'] = {
+ cmd = { 'clangd' },
+ root_markers = { '.clangd', 'compile_flags.txt', 'compile_commands.json', '.git' },
filetypes = { 'c', 'cpp', 'cc', 'h' },
}
@@ -46,7 +46,7 @@ vim.lsp.config['lua_ls'] = {
},
}
-vim.lsp.enable('ccls')
+vim.lsp.enable('clangd')
vim.lsp.enable('rust_analyzer')
vim.lsp.enable('gopls')
vim.lsp.enable('lua_ls')