summaryrefslogtreecommitdiff
path: root/lua/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lua/plugins')
-rw-r--r--lua/plugins/keybindings.lua16
-rw-r--r--lua/plugins/lspconfig.lua8
2 files changed, 20 insertions, 4 deletions
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')