File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments