Add cmp.EventConfig

This commit is contained in:
hrsh7th
2021-08-12 19:02:36 +09:00
parent 22f8ce1bd5
commit 17b0171e9f
4 changed files with 12 additions and 0 deletions

View File

@@ -48,6 +48,8 @@ return function()
}
},
event = {},
mapping = {},
formatting = {

View File

@@ -254,6 +254,9 @@ core.confirm = vim.schedule_wrap(function(e, option, callback)
})
end
e:execute(function()
if config.get().event.on_confirm_done then
config.get().event.on_confirm_done(e)
end
if callback then
callback()
end

View File

@@ -51,6 +51,7 @@ cmp.ScrollDirection.Down = 'down'
---@field public sorting cmp.SortingConfig
---@field public formatting cmp.FormattingConfig
---@field public snippet cmp.SnippetConfig
---@field public event cmp.EventConfig
---@field public mapping table<string, fun(core: cmp.Core, fallback: function)>
---@field public sources cmp.SourceConfig[]
@@ -79,6 +80,9 @@ cmp.ScrollDirection.Down = 'down'
---@class cmp.SnippetConfig
---@field public expand fun(args: cmp.SnippetExpansionParams)
---@class cmp.EventConfig
---@field on_confirm_done function(e: cmp.Entry)
---@class cmp.SourceConfig
---@field public name string
---@field public opts table