I would like to know how to put the setup part associated with the “InsertEnter” event
use {'windwp/nvim-autopairs', event = "InsertEnter"}
I have these lines below
-- nvim-autopairs plugin settings
-- you need setup cmp first put this after cmp.setup()
-- use 'windwp/nvim-autopairs'
require('nvim-autopairs').setup{
check_ts = true,
}
require("nvim-autopairs.completion.cmp").setup({
map_cr = true, -- map <CR> on insert mode
map_complete = true, -- it will auto insert `(` after select function or method item
auto_select = true -- automatically select the first item
})
You can use event = 'InsertEnter' with cmp, then use after when you set up nvim-autopairs and put your configuration in separate files (e.g. in ~/.config/nvim/lua/config/autopairs.lua)
use {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
config = [[require('config.cmp')]]
}
use {
'windwp/nvim-autopairs',
after = 'nvim-cmp',
config = [[require('config.autopairs')]]
}