Skip to content

Commit 761487e

Browse files
committed
fix(config): don't overwrite keymaps with diff keymap_prefix
If keymap_prefix is used, don't overwrite user specified keymaps when mapping default keymaps to the new prefix
1 parent a7fa453 commit 761487e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lua/opencode/config.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,12 @@ local function update_keymap_prefix(prefix, default_prefix)
190190
local new_mappings = {}
191191
for key, opts in pairs(mappings) do
192192
if vim.startswith(key, default_prefix) then
193-
new_mappings[prefix .. key:sub(#default_prefix + 1)] = opts
193+
local new_key = prefix .. key:sub(#default_prefix + 1)
194+
195+
-- make sure there's not already a mapping for that key
196+
if not new_mappings[new_key] then
197+
new_mappings[new_key] = opts
198+
end
194199
else
195200
new_mappings[key] = opts
196201
end

0 commit comments

Comments
 (0)