init
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
local bind = {}
|
||||
|
||||
bind.leader = "SUPER"
|
||||
|
||||
local function merge(...)
|
||||
local out = {}
|
||||
|
||||
for _, t in ipairs({ ... }) do
|
||||
if t ~= nil then
|
||||
for k, v in pairs(t) do
|
||||
out[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return out
|
||||
end
|
||||
|
||||
local function with_leader(keys)
|
||||
if keys == nil or keys == "" then
|
||||
return bind.leader
|
||||
end
|
||||
|
||||
return bind.leader .. " + " .. keys
|
||||
end
|
||||
|
||||
function bind.key(keys, dispatcher, desc, opts)
|
||||
local flags = merge(opts)
|
||||
|
||||
if desc ~= nil then
|
||||
flags.description = desc
|
||||
end
|
||||
|
||||
return hl.bind(keys, dispatcher, flags)
|
||||
end
|
||||
|
||||
function bind.leader_key(keys, dispatcher, desc, opts)
|
||||
return bind.key(with_leader(keys), dispatcher, desc, opts)
|
||||
end
|
||||
|
||||
return bind
|
||||
Reference in New Issue
Block a user