Fix duplicate setup
This commit is contained in:
@@ -74,7 +74,7 @@ end
|
||||
core.on_keymap = function(keys, fallback)
|
||||
for key, action in pairs(config.get().mapping) do
|
||||
if key == keys then
|
||||
return action(core, fallback)
|
||||
return action.invoke(core, fallback)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,22 +2,19 @@ local types = require('cmp.types')
|
||||
|
||||
local mapping = {}
|
||||
|
||||
mapping.mode = function(modes, action)
|
||||
if type(action) == 'table' then
|
||||
if type(action.action) == 'function' then
|
||||
action = action.action
|
||||
mapping.mode = function(modes, action_or_invoke)
|
||||
local invoke = action_or_invoke
|
||||
if type(action_or_invoke) == 'table' then
|
||||
if type(action_or_invoke.invoke) == 'function' then
|
||||
invoke = action_or_invoke.invoke
|
||||
else
|
||||
error('`action` must be function or result of `cmp.mapping.mode`.')
|
||||
error('`invoke` must be function or result of `cmp.mapping.mode`.')
|
||||
end
|
||||
end
|
||||
return setmetatable({
|
||||
return {
|
||||
modes = modes,
|
||||
action = action,
|
||||
}, {
|
||||
__call = function(_, ...)
|
||||
action(...)
|
||||
end,
|
||||
})
|
||||
invoke = invoke,
|
||||
}
|
||||
end
|
||||
|
||||
mapping.complete = function()
|
||||
|
||||
Reference in New Issue
Block a user