mirror of
https://github.com/Cian-H/my_nvim_config.git
synced 2025-12-22 20:21:57 +00:00
71 lines
3.1 KiB
Lua
71 lines
3.1 KiB
Lua
return {
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
dependencies = {
|
|
"williamboman/mason.nvim",
|
|
"williamboman/mason-lspconfig.nvim",
|
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
|
{ "j-hui/fidget.nvim", opts = {} },
|
|
{ "folke/neodev.nvim", opts = {} },
|
|
},
|
|
config = function()
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
|
callback = function(event)
|
|
local map = function(keys, func, desc)
|
|
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
|
end
|
|
map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
|
|
map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
|
map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
|
|
map("<leader>D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
|
|
map("<leader>ds", require("telescope.builtin").lsp_document_symbols, "Document [S]ymbols")
|
|
map("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
|
|
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
|
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
|
|
map("K", vim.lsp.buf.hover, "Hover Documentation")
|
|
map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
|
|
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
|
if client and client.server_capabilities.documentHighlightProvider then
|
|
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
|
buffer = event.buf,
|
|
callback = vim.lsp.buf.document_highlight,
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
|
|
buffer = event.buf,
|
|
callback = vim.lsp.buf.clear_references,
|
|
})
|
|
end
|
|
end,
|
|
})
|
|
|
|
require("mason").setup()
|
|
require("mason-lspconfig").setup({
|
|
ensure_installed = {
|
|
"lua_ls",
|
|
"uv",
|
|
"ruff",
|
|
"pylsp",
|
|
"alejandra",
|
|
"nil",
|
|
"taplo",
|
|
},
|
|
})
|
|
|
|
vim.lsp.config("lua_ls", {
|
|
settings = {
|
|
Lua = {
|
|
completion = {
|
|
callSnippet = "Replace",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
{ "fladson/vim-kitty", ft = "kitty" },
|
|
{ "scallop-lang/vim-scallop", ft = "scallop" },
|
|
}
|