From 56ba8021fdd0533034aee7a9b0d9ac4093778948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9la=20Richartz?= Date: Tue, 3 Mar 2026 12:12:53 +0100 Subject: [PATCH] Update LSP config --- after/plugin/lsp.lua | 51 ++++++++++++++++++++++++++++--------- after/plugin/treesitter.lua | 29 ++++++++++----------- lua/sevi-kun/plugins.lua | 35 +++++++++++++++++++------ 3 files changed, 80 insertions(+), 35 deletions(-) diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 47f7fb7..749fa49 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -1,15 +1,42 @@ -local lsp_zero = require('lsp-zero') + -- Set up nvim-cmp. + local cmp = require'cmp' -lsp_zero.on_attach(function(client, bufnr) - -- see :help lsp-zero-keybindings - -- to learn the available actions - lsp_zero.default_keymaps({buffer = bufnr}) -end) + cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + -- require('snippy').expand_snippet(args.body) -- For `snippy` users. + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) -require('mason').setup({}) -require('mason-lspconfig').setup({ - ensure_installed = {}, - handlers = { - lsp_zero.default_setup, + -- For `mini.snippets` users: + -- local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert + -- insert({ body = args.body }) -- Insert at cursor + -- cmp.resubscribe({ "TextChangedI", "TextChangedP" }) + -- require("cmp.config").set_onetime({ sources = {} }) + end, }, -}) + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, -- For vsnip users. + -- { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + }, { + { name = 'buffer' }, + }) + }) + diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index 717b1e1..81f1b6d 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -1,21 +1,20 @@ --- parsing and highlighting 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 listed parsers MUST always be installed) + ensure_installed = { "python", "bash", "yaml", "csv", "dockerfile", "go", "java", "latex", "nginx", "nix", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", }, - ensure_installed = 'all', - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, - highlight = { - enable = true, - }, + highlight = { + enable = true, + }, - -- Needed because treesitter highlight turns off autoindent for php files - indent = { - enable = true, - }, + -- Needed because treesitter highlight turns off autoindent for php files + indent = { + enable = true, + }, } diff --git a/lua/sevi-kun/plugins.lua b/lua/sevi-kun/plugins.lua index 02f9737..eccb95b 100644 --- a/lua/sevi-kun/plugins.lua +++ b/lua/sevi-kun/plugins.lua @@ -96,21 +96,40 @@ return { -- lsp + -- { + -- 'Exafunction/windsurf.vim', + -- event = 'BufEnter' + -- }, + { - "Exafunction/codeium.vim", - event = "BufEnter" + "mason-org/mason.nvim", + opts = {} + }, + { + "mason-org/mason-lspconfig.nvim", + opts = {}, + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + "neovim/nvim-lspconfig", + }, }, - {"williamboman/mason.nvim", + { + "rachartier/tiny-inline-diagnostic.nvim", + event = "VeryLazy", + priority = 1000, config = function() - require("mason").setup({}) - end + require("tiny-inline-diagnostic").setup() + vim.diagnostic.config({ virtual_text = false }) -- Disable Neovim's default virtual text diagnostics + end, }, - {"williamboman/mason-lspconfig.nvim"}, - {"VonHeikemen/lsp-zero.nvim", branch = "v3.x"}, {"neovim/nvim-lspconfig"}, {"hrsh7th/cmp-nvim-lsp"}, {"hrsh7th/nvim-cmp"}, - {"L3MON4D3/LuaSnip"}, + {"hrsh7th/cmp-buffer"}, + {"hrsh7th/cmp-path"}, + {"hrsh7th/cmp-cmdline"}, + {"hrsh7th/cmp-vsnip"}, + {"hrsh7th/vim-vsnip"} }