[neovim] fix which key depreciated config and lsp config a little

This commit is contained in:
Piotr Domański 2024-09-17 16:11:37 +02:00
parent 95598c534f
commit 74e8197c34
3 changed files with 51 additions and 39 deletions

View file

@ -67,8 +67,21 @@ return {
{ "hrsh7th/cmp-nvim-lsp" }, { "hrsh7th/cmp-nvim-lsp" },
{ "williamboman/mason-lspconfig.nvim" }, { "williamboman/mason-lspconfig.nvim" },
{ "williamboman/mason.nvim" }, { "williamboman/mason.nvim" },
{ "VonHeikemen/lsp-zero.nvim", }
}, },
config = function() config = function()
local lsp_zero = require('lsp-zero')
local lsp_attach = function(client, bufnr)
-- this is where you enable features that only work
-- if there is a language server active in the file
end
lsp_zero.extend_lspconfig({
sign_text = true,
lsp_attach = lsp_attach,
})
require('mason').setup({}) require('mason').setup({})
require('mason-lspconfig').setup({ require('mason-lspconfig').setup({
-- Replace the language servers listed here -- Replace the language servers listed here
@ -82,18 +95,10 @@ return {
}, },
handlers = { handlers = {
function(server_name) function(server_name)
require('lspconfig')[server_name].setup({}) lsp_config = {}
end,
}
})
local nvim_lsp = require("lspconfig") if server_name == "pylsp" then
lsp_config = {
nvim_lsp.lua_ls.setup({})
nvim_lsp.gopls.setup({})
nvim_lsp.dartls.setup({})
nvim_lsp.ts_ls.setup({})
nvim_lsp.pylsp.setup({
settings = { settings = {
pylsp = { pylsp = {
plugins = { plugins = {
@ -103,7 +108,13 @@ return {
}, },
}, },
}, },
}) }
end
require('lspconfig')[server_name].setup(lsp_config)
end, end,
}
})
end
}, },
} }

View file

@ -148,27 +148,28 @@ return {
event = "VeryLazy", event = "VeryLazy",
opts = { opts = {
plugins = { spelling = true }, plugins = { spelling = true },
defaults = {
mode = { "n", "v" },
["g"] = { name = "+goto" },
["gz"] = { name = "+surround" },
["]"] = { name = "+next" },
["["] = { name = "+prev" },
["<leader>b"] = { name = "+buffer" },
["<leader>c"] = { name = "+colors" },
["<leader>l"] = { name = "+lsp" },
["<leader>f"] = { name = "+file/find" },
["<leader>g"] = { name = "+git" },
["<leader>h"] = { name = "+harpoon" },
["<leader>u"] = { name = "+ui" },
["<leader>w"] = { name = "+windows" },
["<leader>x"] = { name = "+diagnostics/quickfix" },
},
}, },
config = function(_, opts) config = function(_, opts)
local wk = require("which-key") local wk = require("which-key")
wk.setup(opts) wk.add(
wk.register(opts.defaults) {
mode = { "n", "v" },
{ "<leader>b", group = "buffer" },
{ "<leader>c", group = "colors" },
{ "<leader>f", group = "file/find" },
{ "<leader>g", group = "git" },
{ "<leader>h", group = "harpoon" },
{ "<leader>l", group = "lsp" },
{ "<leader>u", group = "ui" },
{ "<leader>w", group = "windows" },
{ "<leader>x", group = "diagnostics/quickfix" },
{ "[", group = "prev" },
{ "]", group = "next" },
{ "g", group = "goto" },
{ "gz", group = "surround" },
}
)
end, end,
}, },
{ {