diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua index e28380c..7a85a1e 100644 --- a/lua/plugins/autopairs.lua +++ b/lua/plugins/autopairs.lua @@ -1,7 +1,15 @@ return { 'windwp/nvim-autopairs', event = 'InsertEnter', - config = true, + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require('nvim-autopairs').setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require 'nvim-autopairs.completion.cmp' + local cmp = require 'cmp' + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) + end, + -- use opts = {} for passing setup options -- this is equivalent to setup({}) function -- diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 0946284..ff448a6 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -36,10 +36,6 @@ return { local luasnip = require 'luasnip' luasnip.config.setup {} - -- Insert () after function/method completion - local cmp_autopairs = require 'nvim-autopairs.completion.cmp' - cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) - cmp.setup { snippet = { expand = function(args)