From b63e1502a5e935eb0b0b67c791465d087ab5e959 Mon Sep 17 00:00:00 2001 From: ashincoder <83629316+ashincoder@users.noreply.github.com> Date: Fri, 27 Aug 2021 14:53:58 +0530 Subject: [PATCH] fix: Fixing the luasnip error while tabbing --- lua/plugins/configs/cmp.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/plugins/configs/cmp.lua b/lua/plugins/configs/cmp.lua index 064f8c9..65b536c 100644 --- a/lua/plugins/configs/cmp.lua +++ b/lua/plugins/configs/cmp.lua @@ -1,6 +1,5 @@ vim.opt.completeopt = "menuone,noselect" -local lspkind = require "plugins.configs.lspkind_icons" local cmp = require "cmp" -- nvim-cmp setup @@ -13,7 +12,11 @@ cmp.setup { formatting = { format = function(entry, vim_item) -- load lspkind icons - vim_item.kind = string.format("%s %s", lspkind.icons[vim_item.kind], vim_item.kind) + vim_item.kind = string.format( + "%s %s", + require("plugins.configs.lspkind_icons").icons[vim_item.kind], + vim_item.kind + ) vim_item.menu = ({ nvim_lsp = "[LSP]", @@ -38,7 +41,7 @@ cmp.setup { [""] = function(fallback) if vim.fn.pumvisible() == 1 then vim.fn.feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "n") - elseif luasnip.expand_or_jumpable() then + elseif require("luasnip").expand_or_jumpable() then vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") else fallback() @@ -47,7 +50,7 @@ cmp.setup { [""] = function(fallback) if vim.fn.pumvisible() == 1 then vim.fn.feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "n") - elseif luasnip.jumpable(-1) then + elseif require("luasnip").jumpable(-1) then vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") else fallback()