Fix LSP and update plugins
- Structure LSP configuration code - Since `lsp-zero` is deprecated, instead use `nvim-lspconfig` - Use `nvim_lsp_signature_help` instead of `lsp_signature`
This commit is contained in:
parent
b25bcaf11a
commit
456046c4a7
11 changed files with 105 additions and 103 deletions
|
@ -11,3 +11,4 @@ vim.keymap.set("n", "<leader>q", "<Cmd>bd<CR>")
|
||||||
vim.keymap.set("n", "<leader>l", "<Cmd>bl<CR>")
|
vim.keymap.set("n", "<leader>l", "<Cmd>bl<CR>")
|
||||||
vim.keymap.set("n", "<leader>lb", "<Cmd>VGit toggle_live_blame<CR>")
|
vim.keymap.set("n", "<leader>lb", "<Cmd>VGit toggle_live_blame<CR>")
|
||||||
vim.keymap.set("n", "<leader>bp", "<Cmd>VGit buffer_blame_preview<CR>")
|
vim.keymap.set("n", "<leader>bp", "<Cmd>VGit buffer_blame_preview<CR>")
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,12 @@ vim.opt.softtabstop = 4
|
||||||
vim.opt.shiftwidth = 4
|
vim.opt.shiftwidth = 4
|
||||||
vim.opt.expandtab = true
|
vim.opt.expandtab = true
|
||||||
vim.opt.smartindent = true
|
vim.opt.smartindent = true
|
||||||
|
|
||||||
vim.opt.nu = false
|
vim.opt.nu = false
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
vim.opt.wrap = false
|
vim.opt.wrap = false
|
||||||
|
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
vim.opt.swapfile = false
|
vim.opt.swapfile = false
|
||||||
vim.opt.backup = false
|
vim.opt.backup = false
|
||||||
|
|
|
@ -1,72 +1,25 @@
|
||||||
local lsp = require("lsp-zero")
|
lsp = vim.lsp
|
||||||
local git = require("vgit")
|
lsp_config = require('lspconfig')
|
||||||
local sig = require("lsp_signature")
|
cmp_defcaps = require('cmp_nvim_lsp').default_capabilities()
|
||||||
local cmp = require("cmp")
|
|
||||||
local cmp_action = require("lsp-zero").cmp_action()
|
|
||||||
|
|
||||||
lsp.preset("recommended")
|
snippet_engine = 'luasnip'
|
||||||
|
|
||||||
require('mason').setup({})
|
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
|
||||||
require('mason-lspconfig').setup({
|
vim.diagnostic.config({
|
||||||
ensure_installed = {'rust_analyzer'},
|
signs = {
|
||||||
handlers = {
|
text = {
|
||||||
lsp.default_setup,
|
[vim.diagnostic.severity.ERROR] = '',
|
||||||
},
|
[vim.diagnostic.severity.WARN] = '',
|
||||||
})
|
[vim.diagnostic.severity.HINT] = '',
|
||||||
|
[vim.diagnostic.severity.INFO] = '',
|
||||||
cmp.setup({
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<C-p>'] = cmp_action.luasnip_jump_backward(),
|
|
||||||
['<C-n>'] = cmp_action.luasnip_jump_forward(),
|
|
||||||
['<tab>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
['<C-space>'] = cmp.mapping.complete(),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
lsp.set_preferences({
|
|
||||||
sign_icons = { }
|
|
||||||
})
|
|
||||||
|
|
||||||
lsp.set_sign_icons({
|
|
||||||
error = '',
|
|
||||||
warn = '',
|
|
||||||
hint = '',
|
|
||||||
info = '',
|
|
||||||
})
|
|
||||||
|
|
||||||
lsp.on_attach(function(client, bufnr)
|
|
||||||
local opts = {buffer = bufnr, remap = false}
|
|
||||||
|
|
||||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
|
||||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vws", function() vim.lps.buf.workspace_symbol() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
|
|
||||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
|
||||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vca", function() vim.diagnostic.code_action() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vrr", function() vim.diagnostic.references() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vrn", function() vim.diagnostic.rename() end, opts)
|
|
||||||
vim.keymap.set("n", "<C-h>", function() vim.diagnostic.signature_help() end, opts)
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
lsp.setup()
|
|
||||||
-- sig.setup({
|
|
||||||
-- hint_enable = false,
|
|
||||||
-- fix_pos = ,
|
|
||||||
-- always_trigger = true,
|
|
||||||
-- handler_opts = {
|
|
||||||
-- border = "rounded" -- double, rounded, single, shadow, none, or a table of borders
|
|
||||||
-- },
|
|
||||||
--})
|
|
||||||
git.setup({
|
|
||||||
settings = {
|
|
||||||
signs = {
|
|
||||||
priority = 0,
|
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
virtual_text = true,
|
||||||
|
severity_sort = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
require('lsp.mason')
|
||||||
|
require('lsp.cmp')
|
||||||
|
require('lsp.pylsp')
|
||||||
|
require('lsp.rust')
|
||||||
|
require('lsp.git')
|
||||||
|
|
|
@ -2,7 +2,7 @@ require('nightfox').setup({
|
||||||
options = {
|
options = {
|
||||||
transparent = true, -- Disable setting background
|
transparent = true, -- Disable setting background
|
||||||
terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal`
|
terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal`
|
||||||
dim_inactive = false, -- Non focused panes set to alternative background
|
dim_inactive = false, -- Non-focused panes set to alternative background
|
||||||
module_default = true, -- Default enable value for modules
|
module_default = true, -- Default enable value for modules
|
||||||
},
|
},
|
||||||
palettes = {
|
palettes = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require'nvim-treesitter.configs'.setup {
|
require'nvim-treesitter.configs'.setup {
|
||||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "query" , "rust" },
|
ensure_installed = { "c", "lua", "vim", "vimdoc", "query" , "rust", "python" },
|
||||||
|
|
||||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
|
|
25
nvim/lua/lsp/cmp.lua
Normal file
25
nvim/lua/lsp/cmp.lua
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local sneng = require(snippet_engine)
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
sneng.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-p>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-n>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<tab>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
['<C-space>'] = cmp.mapping.complete(),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'nvim_lsp_signature_help' },
|
||||||
|
{ name = sneng_name },
|
||||||
|
})
|
||||||
|
})
|
7
nvim/lua/lsp/git.lua
Normal file
7
nvim/lua/lsp/git.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require('vgit').setup({
|
||||||
|
settings = {
|
||||||
|
signs = {
|
||||||
|
priority = 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
4
nvim/lua/lsp/mason.lua
Normal file
4
nvim/lua/lsp/mason.lua
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
require('mason').setup({})
|
||||||
|
require('mason-lspconfig').setup({
|
||||||
|
ensure_installed = {'rust_analyzer', 'pylsp'},
|
||||||
|
})
|
4
nvim/lua/lsp/pylsp.lua
Normal file
4
nvim/lua/lsp/pylsp.lua
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
lsp.config('pylsp', {
|
||||||
|
capabilities = cmp_defcaps,
|
||||||
|
})
|
||||||
|
lsp.enable('pylsp')
|
11
nvim/lua/lsp/rust.lua
Normal file
11
nvim/lua/lsp/rust.lua
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
lsp.config('rust_analyzer', {
|
||||||
|
capabilities = cmp_defcaps,
|
||||||
|
settings = {
|
||||||
|
['rust-analyzer'] = {
|
||||||
|
diagnostics = {
|
||||||
|
enable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
lsp.enable('rust_analyzer')
|
|
@ -7,57 +7,51 @@ return require('packer').startup(function(use)
|
||||||
-- Packer can manage itself
|
-- Packer can manage itself
|
||||||
use('wbthomason/packer.nvim')
|
use('wbthomason/packer.nvim')
|
||||||
|
|
||||||
|
|
||||||
use('olimorris/onedarkpro.nvim')
|
use('olimorris/onedarkpro.nvim')
|
||||||
use('SapphirusBeryl/nightfox.nvim')
|
use('SapphirusBeryl/nightfox.nvim')
|
||||||
use('nvim-tree/nvim-web-devicons')
|
use('nvim-tree/nvim-web-devicons')
|
||||||
|
|
||||||
use('nvim-treesitter/playground');
|
|
||||||
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
|
||||||
|
|
||||||
use('mbbill/undotree')
|
use('mbbill/undotree')
|
||||||
|
|
||||||
use('williamboman/mason.nvim')
|
|
||||||
use('williamboman/mason-lspconfig.nvim')
|
|
||||||
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
'nvim-telescope/telescope.nvim', tag = '0.1.5',
|
'neovim/nvim-lspconfig',
|
||||||
requires = { {'nvim-lua/plenary.nvim'} }
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
|
||||||
branch = "v3.x",
|
|
||||||
requires = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
|
||||||
"MunifTanjim/nui.nvim",
|
|
||||||
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
|
||||||
branch = 'v3.x',
|
|
||||||
requires = {
|
requires = {
|
||||||
--- Uncomment the two plugins below if you want to manage the language servers from neovim
|
-- Mason Package Manager
|
||||||
-- {'williamboman/mason.nvim'},
|
{'williamboman/mason.nvim'},
|
||||||
-- {'williamboman/mason-lspconfig.nvim'},
|
{'williamboman/mason-lspconfig.nvim'},
|
||||||
|
|
||||||
-- LSP Support
|
|
||||||
{'neovim/nvim-lspconfig'},
|
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
{'hrsh7th/nvim-cmp'},
|
{'hrsh7th/nvim-cmp'},
|
||||||
{'hrsh7th/cmp-nvim-lsp'},
|
{'hrsh7th/cmp-nvim-lsp'},
|
||||||
|
{'hrsh7th/cmp-nvim-lsp-signature-help'},
|
||||||
{'L3MON4D3/LuaSnip'},
|
{'L3MON4D3/LuaSnip'},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"ray-x/lsp_signature.nvim",
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
run = ':TSUpdate',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
tag = '0.1.x',
|
||||||
|
requires = {
|
||||||
|
{'nvim-lua/plenary.nvim'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
'nvim-neo-tree/neo-tree.nvim',
|
||||||
|
branch = 'v3.x',
|
||||||
|
requires = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||||
|
'MunifTanjim/nui.nvim',
|
||||||
|
-- '3rd/image.nvim', -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
'tanvirtin/vgit.nvim',
|
'tanvirtin/vgit.nvim',
|
||||||
requires = {
|
requires = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue