Skip to content

Commit d8a81b5

Browse files
committed
chore(keymaps): remove old keymap formats + general cleanup
1 parent f502443 commit d8a81b5

File tree

6 files changed

+0
-637
lines changed

6 files changed

+0
-637
lines changed

lua/opencode/config.lua

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -234,31 +234,7 @@ function M.setup(opts)
234234
M.values.keymap.editor = {}
235235
end
236236

237-
-- Check for old keymap structure and migrate to new structure
238-
if opts.keymap and (opts.keymap.global or opts.keymap.window) then
239-
vim.notify('opencode.nvim: Legacy keymap format detected. Consider migrating to new format.', vim.log.levels.WARN)
240-
241-
-- Migrate old global section to editor
242-
if opts.keymap.global then
243-
opts.keymap.editor = M.normalize_keymap(opts.keymap.global)
244-
---@diagnostic disable-next-line: inject-field
245-
opts.keymap.global = nil
246-
end
247-
248-
-- Migrate old window section to input_window and output_window
249-
if opts.keymap.window then
250-
opts.keymap.input_window =
251-
M.normalize_keymap(opts.keymap.window, get_function_names(M.values.keymap.input_window))
252-
opts.keymap.output_window =
253-
M.normalize_keymap(opts.keymap.window, get_function_names(M.values.keymap.output_window))
254-
---@diagnostic disable-next-line: inject-field
255-
opts.keymap.window = nil
256-
end
257-
end
258-
259-
-- vim.notify(vim.inspect(opts))
260237
M.values = vim.tbl_deep_extend('force', M.values, opts --[[@as OpencodeConfig]])
261-
-- vim.notify(vim.inspect(M.values))
262238

263239
update_keymap_prefix(M.values.keymap_prefix, M.defaults.keymap_prefix)
264240
end
@@ -291,21 +267,6 @@ function M.get_key_for_function(scope, function_name)
291267
return nil
292268
end
293269

294-
---Normalize keymap configuration from old format to new format (exported for testing)
295-
---@param legacy_config table Old config format
296-
---@param filter_functions? table If set, only move functions in this table
297-
---@return table
298-
function M.normalize_keymap(legacy_config, filter_functions)
299-
local converted = {}
300-
for func_name, key in pairs(legacy_config) do
301-
local api_name = func_name == 'submit' and 'submit_input_prompt' or func_name
302-
if not filter_functions or vim.tbl_contains(filter_functions, api_name) then
303-
converted[key] = { api_name }
304-
end
305-
end
306-
return converted
307-
end
308-
309270
---@export Config
310271
return setmetatable(M, {
311272
__index = function(_, key)

lua/opencode/review.lua

Lines changed: 0 additions & 342 deletions
This file was deleted.

0 commit comments

Comments
 (0)