Skip to content

Commit 36ff649

Browse files
committed
fix(keymaps): resume precompile module path is possible
1 parent c27c398 commit 36ff649

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

lua/fzf-lua/path.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,14 @@ function M.keymap_to_entry(str)
683683
mode = valid_modes[mode] and mode or "" -- only valid modes
684684
local vmap = vim.fn.maparg(keymap, mode, false, true)
685685
if vmap.callback then
686-
local info = debug.getinfo(vmap.callback)
687-
if info and info.source then
688-
return { path = info.source:gsub("^@", ""), line = info.linedefined }
686+
local info = debug.getinfo(vmap.callback, "Sl")
687+
if info and info.source and info.linedefined and info.linedefined > 0 then
688+
local source = info.source:gsub("^@", "")
689+
-- https://github.com/neovim/neovim/blob/64d55b74d83d566975e269bed0810d9008119ddf/src/nvim/lua/executor.c#L671-L680
690+
if source:match("vim/") and package.preload[source:gsub("%.lua$", ""):gsub("/", ".")] then
691+
source = vim.env.VIMRUNTIME .. "/lua/" .. source .. ".lua"
692+
end
693+
return { path = source, line = info.linedefined }
689694
end
690695
end
691696
local cmd = ("verb %smap %s"):format(mode, keymap)

0 commit comments

Comments
 (0)