update
This commit is contained in:
parent
805221e92c
commit
400e7eeb5e
10 changed files with 180 additions and 156 deletions
|
|
@ -5,6 +5,9 @@ return {
|
|||
opts = {
|
||||
flavour = "macchiato",
|
||||
transparent_background = true,
|
||||
integrations = {
|
||||
fidget = true,
|
||||
},
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
|
|
|
|||
|
|
@ -8,23 +8,6 @@ return {
|
|||
-- Detect tabstop and shiftwidth automatically
|
||||
"tpope/vim-sleuth",
|
||||
|
||||
{
|
||||
-- LSP Configuration & Plugins
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
{ "williamboman/mason.nvim", config = true },
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
|
||||
-- Useful status updates for LSP
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
-- Autocompletion
|
||||
"hrsh7th/nvim-cmp",
|
||||
|
|
|
|||
119
config/nvim/lua/aleidk/plugins/lsp.lua
Normal file
119
config/nvim/lua/aleidk/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
return {
|
||||
-- LSP Configuration & Plugins
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
{ "williamboman/mason.nvim", config = true },
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
|
||||
-- Useful status updates for LSP
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
tag = "legacy",
|
||||
event = "LspAttach",
|
||||
opts = {
|
||||
window = {
|
||||
blend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
|
||||
config = function()
|
||||
-- LSP settings.
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(_, bufnr)
|
||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
||||
-- many times.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = "LSP: " .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
|
||||
|
||||
nmap("gd", vim.lsp.buf.definition, "Go to definition")
|
||||
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||
nmap("gI", vim.lsp.buf.implementation, "Go to Implementation")
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
|
||||
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
|
||||
nmap("<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, "[W]orkspace [L]ist Folders")
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = "Format current buffer with LSP" })
|
||||
end
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. They will be passed to
|
||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||
local servers = {
|
||||
bashls = {},
|
||||
cssls = {},
|
||||
dockerls = {},
|
||||
emmet_ls = {},
|
||||
html = {},
|
||||
pyright = {},
|
||||
rust_analyzer = {},
|
||||
sqlls = {},
|
||||
tsserver = {},
|
||||
yamlls = {},
|
||||
lua_ls = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Diagnostic keymaps
|
||||
-- vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
||||
-- vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
||||
-- vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
||||
-- vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
})
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
function(server_name)
|
||||
require("lspconfig")[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,42 +1,44 @@
|
|||
return {
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||
"MunifTanjim/nui.nvim",
|
||||
-- OPTIONAL:
|
||||
-- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- If not available, we use `mini` as the fallback
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
opts = {
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = "msg_show",
|
||||
any = {
|
||||
{ find = "%d+L, %d+B" },
|
||||
{ find = "; after #%d+" },
|
||||
{ find = "; before #%d+" },
|
||||
},
|
||||
},
|
||||
view = "mini",
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true,
|
||||
command_palette = true,
|
||||
long_message_to_split = true,
|
||||
inc_rename = true,
|
||||
},
|
||||
},
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||
"MunifTanjim/nui.nvim",
|
||||
-- OPTIONAL:
|
||||
-- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- If not available, we use `mini` as the fallback
|
||||
{ "rcarriga/nvim-notify", opts = {
|
||||
background_colour = "#000000",
|
||||
} },
|
||||
},
|
||||
opts = {
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = "msg_show",
|
||||
any = {
|
||||
{ find = "%d+L, %d+B" },
|
||||
{ find = "; after #%d+" },
|
||||
{ find = "; before #%d+" },
|
||||
},
|
||||
},
|
||||
view = "mini",
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true,
|
||||
command_palette = true,
|
||||
long_message_to_split = true,
|
||||
inc_rename = true,
|
||||
},
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue