From f34fb8cb46a1669690df6b4ef395c4c313938722 Mon Sep 17 00:00:00 2001 From: "Radu C. Martin" Date: Fri, 13 Dec 2024 16:31:43 +0100 Subject: [PATCH] chore(autopairs): move () completion to autopairs plugin --- lua/plugins/autopairs.lua | 10 +++++++++- lua/plugins/cmp.lua | 4 ---- 2 files changed, 9 insertions(+), 5 deletions(-) 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)