mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(picker.keymaps): try to locate neovim compiled lua source files for keymaps
Some checks are pending
CI / ci (push) Waiting to run
Some checks are pending
CI / ci (push) Waiting to run
This commit is contained in:
parent
0bc7c2631a
commit
76160be5d3
1 changed files with 8 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue