From ac9a7343c65aba18f70e4e9d7724b6f059c9b3d9 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 10 Sep 2021 01:40:44 -0700 Subject: [PATCH] Fixed a terrible nvim bug where pressing tab would error and type a 0 --- .config/nvim/lua/lsp.lua | 23 +++++++++++++---------- .config/nvim/lua/plugins.lua | 12 +++++++++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index caee677..a809119 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -99,15 +99,15 @@ end -- <<< M.cmp = function() ---- cmp >>> - -- nvim-cmp supports additional completion capabilities - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) + -- luasnip setup + local luasnip = require 'luasnip' + -- nvim-cmp setup local cmp = require 'cmp' cmp.setup { snippet = { expand = function(args) - vim.fn["vsnip#anonymous"](args.body) + require('luasnip').lsp_expand(args.body) end, }, mapping = { @@ -144,7 +144,7 @@ M.cmp = function() ---- cmp >>> { name = 'path' }, { name = 'buffer' }, { name = 'calc' }, - { name = 'vsnip' }, + { name = 'luasnip' }, { name = 'nvim_lsp' }, { name = 'nvim_lua' }, { name = 'spell' }, @@ -158,11 +158,14 @@ M.cmp = function() ---- cmp >>> -- set a name for each source vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - luasnip = "[LuaSnip]", - nvim_lua = "[Lua]", - latex_symbols = "[Latex]", + path = "[Path]", + buffer = "[Buffer]", + calc = "[Calc]", + luasnip = "[LuaSnip]", + nvim_lsp = "[LSP]", + nvim_lua = "[Lua]", + spell = "[Spell]", + treesitter = "[TS]", })[entry.source.name] return vim_item end, diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 4bd8ab2..b66b2f4 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -61,19 +61,25 @@ return require('packer').startup(function() require('lsp').cmp() end, requires = { -- nvim-cmp sources - "hrsh7th/vim-vsnip", - "rafamadriz/friendly-snippets", + -- snippet integration + -- "hrsh7th/cmp-vsnip", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-path", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-latex-symbols", - "hrsh7th/cmp-vsnip", "hrsh7th/cmp-emoji", "hrsh7th/cmp-calc", "hrsh7th/cmp-look", } } + use { -- code snippits + "L3MON4D3/LuaSnip", + -- "hrsh7th/vim-vsnip", + -- "rafamadriz/friendly-snippets", + } use { -- function parameter previews "ray-x/lsp_signature.nvim", after = "nvim-lspconfig",