Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lua/opencode/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ local function process_keymap_entry(keymap_config, default_modes, base_opts, pre
local opts = vim.tbl_deep_extend('force', {}, base_opts)
opts.desc = config_entry.desc or vim.tbl_get(command_defs, func_name, 'desc') or ''

if callback and #modes > 0 then
if not callback then
if type(func_name) ~= 'string' then
vim.notify(string.format('No action found for keymap: %s -> %s', key_binding, func_name), vim.log.levels.WARN)
end
elseif #modes > 0 then
if config_entry.defer_to_completion then
callback = wrap_with_completion_check(key_binding, callback)
end
vim.keymap.set(modes, key_binding, callback, opts)
elseif type(func_name) ~= 'string' then
vim.notify(string.format('No action found for keymap: %s -> %s', key_binding, func_name), vim.log.levels.WARN)
end
end
end
Expand Down
1 change: 1 addition & 0 deletions tests/unit/keymap_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ describe('opencode.keymap', function()
}, bufnr, true)

assert.equal(0, #set_keymaps)
assert.equal(0, #notify_calls)
vim.g.mapleader = original_mapleader
vim.api.nvim_buf_delete(bufnr, { force = true })
end)
Expand Down
Loading