Fix keymap binding on macos
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user