diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua index 6d6a6ff..2efd030 100644 --- a/dot_config/nvim/lua/plugins/lsp.lua +++ b/dot_config/nvim/lua/plugins/lsp.lua @@ -1,62 +1,68 @@ return { { "williamboman/mason.nvim", opts = {} }, - { - "williamboman/mason-lspconfig.nvim", + { + "williamboman/mason-lspconfig.nvim", opts = { ensure_installed = { "gopls", "lua_ls" }, } }, - { - "neovim/nvim-lspconfig", - config = function() - require("lspconfig").gopls.setup {} - require("lspconfig").lua_ls.setup {} - end - }, - { - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "hrsh7th/cmp-vsnip", - "hrsh7th/vim-vsnip", - "hrsh7th/cmp-nvim-lsp-signature-help" + { + "neovim/nvim-lspconfig", + config = function() + require("lspconfig").gopls.setup {} + require("lspconfig").lua_ls.setup {} + end }, - config = function() - local cmp = require "cmp" - 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+) - end, - }, - 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' }, - { name = 'nvim_lsp_signature_help' } - }) - }) - end - } + { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-vsnip", + "hrsh7th/vim-vsnip", + "hrsh7th/cmp-nvim-lsp-signature-help" + }, + config = function() + local cmp = require "cmp" + 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+) + end, + }, + 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' }, + { name = 'nvim_lsp_signature_help' } + }) + }) + end + }, + { + 'numToStr/Comment.nvim', + opts = { + -- add any options here + } + } }