From c87482f107a91364ac95302e6ac3f4c1030cf432 Mon Sep 17 00:00:00 2001 From: siduck76 Date: Fri, 27 Aug 2021 08:11:46 +0530 Subject: [PATCH] lazy load luasnip after cmp --- lua/plugins/configs/cmp.lua | 3 +-- lua/plugins/init.lua | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lua/plugins/configs/cmp.lua b/lua/plugins/configs/cmp.lua index e8518e6..064f8c9 100644 --- a/lua/plugins/configs/cmp.lua +++ b/lua/plugins/configs/cmp.lua @@ -1,10 +1,9 @@ vim.opt.completeopt = "menuone,noselect" local lspkind = require "plugins.configs.lspkind_icons" -local luasnip = require "luasnip" +local cmp = require "cmp" -- nvim-cmp setup -local cmp = require "cmp" cmp.setup { snippet = { expand = function(args) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index e80605e..90e394e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -176,25 +176,25 @@ return packer.startup(function() -- load luasnips + cmp related in insert mode only use { - "L3MON4D3/LuaSnip", + "hrsh7th/nvim-cmp", event = "InsertEnter", + config = function() + require "plugins.configs.cmp" + end, + } + + use { + "L3MON4D3/LuaSnip", wants = "friendly-snippets", + after = "nvim-cmp", config = function() require "plugins.configs.luasnip" end, } - use { - "hrsh7th/nvim-cmp", - config = function() - require "plugins.configs.cmp" - end, - after = "LuaSnip", - } - use { "saadparwaiz1/cmp_luasnip", - after = "nvim-cmp", + after = "LuaSnip", } use {