Modalbind: Add key aliases
This commit is contained in:
parent
a2f10f3d33
commit
9265f70e4b
|
@ -30,6 +30,9 @@ local function update_settings()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local aliases = {}
|
||||||
|
aliases[" "] = "Space"
|
||||||
|
|
||||||
|
|
||||||
--- Change the opacity of the modebox.
|
--- Change the opacity of the modebox.
|
||||||
-- @param amount opacity between 0.0 and 1.0, or nil to use default
|
-- @param amount opacity between 0.0 and 1.0, or nil to use default
|
||||||
|
@ -213,6 +216,10 @@ function grab(keymap, name, stay_in_mode)
|
||||||
|
|
||||||
if event == "release" then return true end
|
if event == "release" then return true end
|
||||||
|
|
||||||
|
if aliases[key] then
|
||||||
|
key = aliases[key]
|
||||||
|
end
|
||||||
|
|
||||||
if keymap[key] then
|
if keymap[key] then
|
||||||
keygrabber.stop()
|
keygrabber.stop()
|
||||||
if type(keymap[key]) == "table" then
|
if type(keymap[key]) == "table" then
|
||||||
|
@ -227,6 +234,8 @@ function grab(keymap, name, stay_in_mode)
|
||||||
if nesting < 1 then hide_box() end
|
if nesting < 1 then hide_box() end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
print("Unmapped key: \"" .. key .. "\"")
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in a new issue