Skip to content

Commit

Permalink
fix: resolve #84
Browse files Browse the repository at this point in the history
  • Loading branch information
m4xshen committed Apr 16, 2024
1 parent 21b0f91 commit 08505a6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/hardtime/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ local function get_return_key(key)
for _, mapping in ipairs(mappings) do
if mapping.lhs == key then
if mapping.callback then
return mapping.callback()
local success, result = pcall(mapping.callback)
if success then
return result
end

return vim.schedule(mapping.callback)
end
return util.try_eval(mapping.rhs)
end
Expand Down

0 comments on commit 08505a6

Please sign in to comment.