style: re-format
This commit is contained in:
+42
-42
@@ -3,69 +3,69 @@ local bind = {}
|
||||
bind.leader = "SUPER"
|
||||
|
||||
local function merge(...)
|
||||
local out = {}
|
||||
local out = {}
|
||||
|
||||
for _, t in ipairs({ ... }) do
|
||||
if t ~= nil then
|
||||
for k, v in pairs(t) do
|
||||
out[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, t in ipairs({ ... }) do
|
||||
if t ~= nil then
|
||||
for k, v in pairs(t) do
|
||||
out[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return out
|
||||
return out
|
||||
end
|
||||
|
||||
function bind.with_leader(keys)
|
||||
if keys == nil or keys == "" then
|
||||
return bind.leader
|
||||
end
|
||||
if keys == nil or keys == "" then
|
||||
return bind.leader
|
||||
end
|
||||
|
||||
return bind.leader .. " + " .. keys
|
||||
return bind.leader .. " + " .. keys
|
||||
end
|
||||
|
||||
function bind.key(keys, dispatcher, desc, opts)
|
||||
local flags = merge(opts)
|
||||
local flags = merge(opts)
|
||||
|
||||
if desc ~= nil then
|
||||
flags.description = desc
|
||||
end
|
||||
if desc ~= nil then
|
||||
flags.description = desc
|
||||
end
|
||||
|
||||
return hl.bind(keys, dispatcher, flags)
|
||||
return hl.bind(keys, dispatcher, flags)
|
||||
end
|
||||
|
||||
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)
|
||||
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
|
||||
for _, item in pairs(table) do
|
||||
bind.set(item)
|
||||
end
|
||||
end
|
||||
|
||||
function bind.layout_dispatcher(actions, fallback)
|
||||
return function()
|
||||
local ws = hl.get_active_special_workspace() or hl.get_active_workspace()
|
||||
if not ws then
|
||||
return
|
||||
end
|
||||
return function()
|
||||
local ws = hl.get_active_special_workspace() or hl.get_active_workspace()
|
||||
if not ws then
|
||||
return
|
||||
end
|
||||
|
||||
local action = actions[ws.tiled_layout] or fallback
|
||||
if action then
|
||||
hl.dispatch(action)
|
||||
end
|
||||
end
|
||||
local action = actions[ws.tiled_layout] or fallback
|
||||
if action then
|
||||
hl.dispatch(action)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return bind
|
||||
|
||||
Reference in New Issue
Block a user