Fix keymap binding on macos

This commit is contained in:
Francesco Abbate
2021-04-21 01:42:56 -07:00
parent 9d9c7f291c
commit dd9b4f06ab
3 changed files with 6 additions and 10 deletions
+4 -8
View File
@@ -36,16 +36,12 @@ function keymap.add_direct(map)
end
function keymap.add(map, overwrite)
local control_translate = function(s)
return macos and s:gsub("%f[%a]ctrl%f[%A]", "cmd") or s
end
for stroke, commands in pairs(map) do
if macos then
stroke = stroke:gsub("%f[%a]ctrl%f[%A]", "cmd")
end
if type(commands) == "string" then
commands = { control_translate(commands) }
else
for i = 1, #commands do
commands[i] = control_translate(commands[i])
end
commands = { commands }
end
if overwrite then
keymap.map[stroke] = commands