From 78a1c3bcfb897768644532ecdf59269ce1db212a Mon Sep 17 00:00:00 2001 From: Seymur Bagirov Date: Mon, 24 Feb 2025 11:23:22 +0400 Subject: [PATCH] refactor: improve lsp config preparing the code to migrate out of lsp-zero (not maintained anymore) --- nvim/lua/themystery/plugins/init.lua | 5 ---- nvim/lua/themystery/plugins/lazydev.lua | 14 --------- nvim/lua/themystery/plugins/lsp.lua | 39 ++++++++++++++++--------- nvim/lua/themystery/plugins/sql.lua | 7 ----- 4 files changed, 26 insertions(+), 39 deletions(-) delete mode 100644 nvim/lua/themystery/plugins/lazydev.lua diff --git a/nvim/lua/themystery/plugins/init.lua b/nvim/lua/themystery/plugins/init.lua index abe5774..c3c71ee 100644 --- a/nvim/lua/themystery/plugins/init.lua +++ b/nvim/lua/themystery/plugins/init.lua @@ -45,11 +45,6 @@ return { }, "SmiteshP/nvim-navic", "Decodetalkers/csharpls-extended-lsp.nvim", - -- { - -- "lukas-reineke/headlines.nvim", - -- dependencies = "nvim-treesitter/nvim-treesitter", - -- config = true, -- or `opts = {}` - -- }, { 'MeanderingProgrammer/markdown.nvim', main = "render-markdown", diff --git a/nvim/lua/themystery/plugins/lazydev.lua b/nvim/lua/themystery/plugins/lazydev.lua deleted file mode 100644 index f4f5a0a..0000000 --- a/nvim/lua/themystery/plugins/lazydev.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - { - "folke/lazydev.nvim", - ft = "lua", -- only load on lua files - opts = { - library = { - -- See the configuration section for more details - -- Load luvit types when the `vim.uv` word is found - { path = "luvit-meta/library", words = { "vim%.uv" } }, - }, - }, - }, - { "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings -} diff --git a/nvim/lua/themystery/plugins/lsp.lua b/nvim/lua/themystery/plugins/lsp.lua index b19d3ff..46e663e 100644 --- a/nvim/lua/themystery/plugins/lsp.lua +++ b/nvim/lua/themystery/plugins/lsp.lua @@ -1,4 +1,4 @@ -return { +local rust = { { 'mrcjkb/rustaceanvim', version = '^5', -- Recommended @@ -26,6 +26,9 @@ return { vim.keymap.set("n", "cf", crates.show_features_popup, opts) end, }, +} + +local go = { { "ray-x/go.nvim", dependencies = { -- optional packages @@ -34,6 +37,27 @@ return { ft = { "go", 'gomod' }, build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries }, +} + +local lazydev = { + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "luvit-meta/library", words = { "vim%.uv" } }, + }, + }, + }, + { "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings +} + +return { + lazydev, + rust, + go, { 'VonHeikemen/lsp-zero.nvim', branch = 'v3.x', @@ -123,18 +147,6 @@ return { }, init_options = { userLanguages = { rust = "html", templ = "html" } }, }) - -- - -- lsp.configure("rust_analyzer", { - -- settings = { - -- ["rust-analyzer"] = { - -- checkOnSave = true, - -- check = { - -- command = "clippy" - -- } - -- } - -- } - -- }) - local cmp = require('cmp') @@ -221,6 +233,7 @@ return { navbuddy.attach(client, bufnr) end vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts) vim.keymap.set("n", "dc", function() vim.lsp.buf.hover() end, opts) vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) vim.keymap.set("n", "ed", function() vim.diagnostic.open_float() end, opts) diff --git a/nvim/lua/themystery/plugins/sql.lua b/nvim/lua/themystery/plugins/sql.lua index fee32b1..0b10d2e 100644 --- a/nvim/lua/themystery/plugins/sql.lua +++ b/nvim/lua/themystery/plugins/sql.lua @@ -6,13 +6,6 @@ return { dependencies = { 'tpope/vim-dadbod', lazy = true }, lazy = true, init = function() - -- vim.api.nvim_create_autocmd("FileType", { - -- pattern = { - -- "sql", - -- }, - -- command = [[setlocal omnifunc=vim_dadbod_completion#omni]], - -- }) - -- taken from here https://github.com/kristijanhusak/vim-dadbod-completion/issues/53#issuecomment-1902659351 local autocomplete_group = vim.api.nvim_create_augroup("vimrc_autocompletion", { clear = true }) vim.api.nvim_create_autocmd("FileType", {