Skip to content

Commit 376d760

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

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lua/fzf-lua/path.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,13 @@ function M.keymap_to_entry(str)
684684
local vmap = vim.fn.maparg(keymap, mode, false, true)
685685
if vmap.callback then
686686
local info = debug.getinfo(vmap.callback)
687-
if info and info.source then
688-
return { path = info.source:gsub("^@", ""), line = info.linedefined }
687+
if info and info.source 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)