From dd9b4f06ab1b6073d76f991f37203374cc169b0d Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Wed, 21 Apr 2021 01:42:56 -0700 Subject: [PATCH] Fix keymap binding on macos --- data/core/keymap-macos.lua | 2 +- data/core/keymap.lua | 12 ++++-------- data/plugins/reflow.lua | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/data/core/keymap-macos.lua b/data/core/keymap-macos.lua index f9c521e4..0809615f 100644 --- a/data/core/keymap-macos.lua +++ b/data/core/keymap-macos.lua @@ -17,7 +17,7 @@ local function keymap_macos(keymap) ["alt+i"] = "root:switch-to-up", ["alt+k"] = "root:switch-to-down", - ["cmd+w"] = "root:close", + ["ctrl+w"] = "root:close", ["cmd+tab"] = "root:switch-to-next-tab", ["cmd+shift+tab"] = "root:switch-to-previous-tab", ["cmd+pageup"] = "root:move-tab-left", diff --git a/data/core/keymap.lua b/data/core/keymap.lua index 9efb7d7f..84bcd770 100644 --- a/data/core/keymap.lua +++ b/data/core/keymap.lua @@ -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 diff --git a/data/plugins/reflow.lua b/data/plugins/reflow.lua index 9556e37e..621c361c 100644 --- a/data/plugins/reflow.lua +++ b/data/plugins/reflow.lua @@ -59,6 +59,6 @@ command.add("core.docview", { }) -keymap.add { +keymap.add_direct { ["ctrl+shift+q"] = "reflow:reflow" }