feat: restructure keymaps and fix Lua configuration
- Restructure keymaps into modular folder system - Create keymaps/ folder with organized files - Separate keymaps by category (general, personal, lsp, telescope, plugins) - Auto-loading system for better maintainability - Fix Lua configuration issues - Add compatibility layer for deprecated APIs - Fix snacks.nvim configuration - Disable latex support in render-markdown - Improve LSP configuration - Enhance function navigation - Restore and improve LSP keymaps - Add comprehensive Telescope integration - Fix conflicting keymaps - Improve overall Neovim setup - Better options configuration - Enhanced plugin configurations - Cleaner code organization
This commit is contained in:
@@ -14,7 +14,6 @@ return {
|
||||
local lspconfig = require("lspconfig")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
local keymap = vim.keymap
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = {
|
||||
@@ -24,7 +23,7 @@ return {
|
||||
"gopls",
|
||||
"graphql",
|
||||
"html",
|
||||
-- "jdtls", -- uncomment if you’re actively doing Java
|
||||
-- "jdtls", -- uncomment if you're actively doing Java
|
||||
"lua_ls",
|
||||
"prismals",
|
||||
"pyright",
|
||||
@@ -41,10 +40,10 @@ return {
|
||||
min = vim.diagnostic.severity.WARN,
|
||||
},
|
||||
icons = {
|
||||
Error = " ",
|
||||
Warn = " ",
|
||||
Error = " ",
|
||||
Warn = " ",
|
||||
Hint = " ",
|
||||
Info = " ",
|
||||
Info = " ",
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -89,39 +88,7 @@ return {
|
||||
-- }
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
local opts = { buffer = ev.buf, silent = true }
|
||||
local mappings = {
|
||||
["gR"] = { "<cmd>Telescope lsp_references<CR>", "Show LSP references" },
|
||||
["gD"] = { vim.lsp.buf.declaration, "Go to declaration" },
|
||||
["gd"] = { "<cmd>Telescope lsp_definitions<CR>", "Show LSP definitions" },
|
||||
["gi"] = { "<cmd>Telescope lsp_implementations<CR>", "Show LSP implementations" },
|
||||
["gt"] = { "<cmd>Telescope lsp_type_definitions<CR>", "Show LSP type definitions" },
|
||||
["<leader>ca"] = { vim.lsp.buf.code_action, "See available code actions" },
|
||||
["<leader>rn"] = { vim.lsp.buf.rename, "Smart rename" },
|
||||
["<leader>D"] = { "<cmd>Telescope diagnostics bufnr=0<CR>", "Show buffer diagnostics" },
|
||||
["<leader>dd"] = { vim.diagnostic.open_float, "Show line diagnostics" },
|
||||
["[d"] = { vim.diagnostic.goto_prev, "Go to previous diagnostic" },
|
||||
["]d"] = { vim.diagnostic.goto_next, "Go to next diagnostic" },
|
||||
["K"] = { vim.lsp.buf.hover, "Show documentation for cursor" },
|
||||
["<leader>rs"] = { ":LspRestart<CR>", "Restart LSP" },
|
||||
}
|
||||
|
||||
for key, map in pairs(mappings) do
|
||||
keymap.set("n", key, map[1], { desc = map[2], silent = true })
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
buffer = ev.buf,
|
||||
callback = function()
|
||||
vim.diagnostic.open_float(nil, { focusable = false })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.o.updatetime = 250
|
||||
end,
|
||||
})
|
||||
-- LSP keymaps are now handled in the main keymaps.lua file
|
||||
-- This ensures consistent keymaps across all file types
|
||||
end,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user