Fix keymap binding on macos
This commit is contained in:
parent
9d9c7f291c
commit
dd9b4f06ab
|
@ -17,7 +17,7 @@ local function keymap_macos(keymap)
|
||||||
["alt+i"] = "root:switch-to-up",
|
["alt+i"] = "root:switch-to-up",
|
||||||
["alt+k"] = "root:switch-to-down",
|
["alt+k"] = "root:switch-to-down",
|
||||||
|
|
||||||
["cmd+w"] = "root:close",
|
["ctrl+w"] = "root:close",
|
||||||
["cmd+tab"] = "root:switch-to-next-tab",
|
["cmd+tab"] = "root:switch-to-next-tab",
|
||||||
["cmd+shift+tab"] = "root:switch-to-previous-tab",
|
["cmd+shift+tab"] = "root:switch-to-previous-tab",
|
||||||
["cmd+pageup"] = "root:move-tab-left",
|
["cmd+pageup"] = "root:move-tab-left",
|
||||||
|
|
|
@ -36,16 +36,12 @@ function keymap.add_direct(map)
|
||||||
end
|
end
|
||||||
|
|
||||||
function keymap.add(map, overwrite)
|
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
|
for stroke, commands in pairs(map) do
|
||||||
if type(commands) == "string" then
|
if macos then
|
||||||
commands = { control_translate(commands) }
|
stroke = stroke:gsub("%f[%a]ctrl%f[%A]", "cmd")
|
||||||
else
|
|
||||||
for i = 1, #commands do
|
|
||||||
commands[i] = control_translate(commands[i])
|
|
||||||
end
|
end
|
||||||
|
if type(commands) == "string" then
|
||||||
|
commands = { commands }
|
||||||
end
|
end
|
||||||
if overwrite then
|
if overwrite then
|
||||||
keymap.map[stroke] = commands
|
keymap.map[stroke] = commands
|
||||||
|
|
|
@ -59,6 +59,6 @@ command.add("core.docview", {
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
keymap.add {
|
keymap.add_direct {
|
||||||
["ctrl+shift+q"] = "reflow:reflow"
|
["ctrl+shift+q"] = "reflow:reflow"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue