feat: init binds config
This commit is contained in:
+19
-3
@@ -16,7 +16,7 @@ local function merge(...)
|
||||
return out
|
||||
end
|
||||
|
||||
local function with_leader(keys)
|
||||
function bind.with_leader(keys)
|
||||
if keys == nil or keys == "" then
|
||||
return bind.leader
|
||||
end
|
||||
@@ -34,8 +34,24 @@ function bind.key(keys, dispatcher, desc, opts)
|
||||
return hl.bind(keys, dispatcher, flags)
|
||||
end
|
||||
|
||||
function bind.leader_key(keys, dispatcher, desc, opts)
|
||||
return bind.key(with_leader(keys), dispatcher, desc, opts)
|
||||
function bind.set(table)
|
||||
local keys = table.keys
|
||||
local dispatcher = table.dispatcher
|
||||
local desc = ""
|
||||
local opts = {}
|
||||
if table.desc ~= nil and table.desc ~= "" then
|
||||
desc = table.desc
|
||||
end
|
||||
if table.opts ~= nil then
|
||||
opts = table.opts
|
||||
end
|
||||
bind.key(keys, dispatcher, desc, opts)
|
||||
end
|
||||
|
||||
function bind.map(table)
|
||||
for _, item in pairs(table) do
|
||||
bind.set(item)
|
||||
end
|
||||
end
|
||||
|
||||
return bind
|
||||
|
||||
Reference in New Issue
Block a user