Initial neovim config
Lazy.nvim plugin manager, LSP (rust-analyzer, clangd, ts_ls, zls), treesitter, telescope, bufferline, neo-tree, gitsigns, lazygit, alabaster theme, persistence sessions, nvim-cmp, lualine, which-key. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
57
lua/plugins/lsp.lua
Normal file
57
lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" },
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"ts_ls",
|
||||
"clangd",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- LSP keymaps on attach
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(ev)
|
||||
local map = function(keys, func, desc)
|
||||
vim.keymap.set("n", keys, func, { buffer = ev.buf, desc = desc })
|
||||
end
|
||||
map("gd", vim.lsp.buf.definition, "Go to definition")
|
||||
map("gD", vim.lsp.buf.declaration, "Go to declaration")
|
||||
map("gr", vim.lsp.buf.references, "Go to references")
|
||||
map("gi", vim.lsp.buf.implementation, "Go to implementation")
|
||||
map("K", vim.lsp.buf.hover, "Hover documentation")
|
||||
map("<leader>ca", vim.lsp.buf.code_action, "Code action")
|
||||
map("<leader>rn", vim.lsp.buf.rename, "Rename symbol")
|
||||
map("<leader>fs", "<cmd>Telescope lsp_document_symbols<cr>", "Document symbols")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Configure servers using vim.lsp.config (Neovim 0.11+)
|
||||
vim.lsp.config("ts_ls", { capabilities = capabilities })
|
||||
vim.lsp.config("clangd", { capabilities = capabilities })
|
||||
vim.lsp.config("zls", { capabilities = capabilities })
|
||||
|
||||
-- Enable servers
|
||||
vim.lsp.enable({ "ts_ls", "clangd", "zls" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- Rust gets its own dedicated plugin
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^5",
|
||||
lazy = false,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user