Fix broken autopairs + <enter> combo
- Id
- 553a9ba1decb4a51da89aa16f78b0c269de6cd8b
- Author
- Caio
- Commit time
- 2024-03-19T10:17:14+01:00
Modified lua/plugins.lua
use {
'windwp/nvim-autopairs',
+ requires = { 'hrsh7th/nvim-cmp' },
config = function()
local autopairs = require('nvim-autopairs')
-
autopairs.setup({})
- function complete_or_autopairs()
- if vim.fn.pumvisible() ~= 0 then
- return autopairs.esc("<cr>")
- else
- return autopairs.autopairs_cr()
- end
- end
-
- vim.keymap.set('i' , '<CR>','v:lua.complete_or_autopairs()', {expr = true})
+ local cmp_autopairs = require('nvim-autopairs.completion.cmp')
+ local cmp = require('cmp')
+ cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end
}