fix(picker.keymaps): try to locate neovim compiled lua source files for keymaps
Some checks are pending
CI / ci (push) Waiting to run

This commit is contained in:
Folke Lemaitre 2025-10-31 07:41:18 +01:00
parent 0bc7c2631a
commit 76160be5d3
No known key found for this signature in database
GPG key ID: 9B52594D560070AB

View file

@ -242,9 +242,15 @@ function M.keymaps(opts)
}
if km.callback then
local info = debug.getinfo(km.callback, "S")
item.info = info
if info.what == "Lua" then
item.file = info.source:sub(2)
item.pos = { info.linedefined, 0 }
local source = info.source:sub(2)
item.file = source:gsub("^vim/", vim.env.VIMRUNTIME .. "/lua/vim/")
if source:find("^vim/") and info.linedefined == 0 then
item.search = "/vim\\.keymap\\.set.*['\"]" .. km.lhs
else
item.pos = { info.linedefined, 0 }
end
item.preview = "file"
end
end