diff --git a/runtime/lua/vim/_editor.lua b/runtime/lua/vim/_editor.lua index a15fd33613..85090c06fb 100644 --- a/runtime/lua/vim/_editor.lua +++ b/runtime/lua/vim/_editor.lua @@ -1323,7 +1323,7 @@ local function traceback() if not info then break end - local msg = (' %s:%s'):format(info.source:sub(2), info.currentline) + local msg = (' %s:%s'):format(info.source:gsub('^@', ''), info.currentline) table.insert(backtrace, msg) level = level + 1 end diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua index c6aba5593f..c0431875bc 100644 --- a/runtime/lua/vim/loader.lua +++ b/runtime/lua/vim/loader.lua @@ -492,7 +492,7 @@ function M._profile(opts) if opts and opts.loaders then for l, loader in pairs(loaders) do - local loc = debug.getinfo(loader, 'Sn').source:sub(2) + local loc = debug.getinfo(loader, 'Sn').source:gsub('^@', '') loaders[l] = track('loader ' .. l .. ': ' .. loc, loader) end end diff --git a/src/gen/gen_vimdoc.lua b/src/gen/gen_vimdoc.lua index 68912cf0b5..2750202dd9 100755 --- a/src/gen/gen_vimdoc.lua +++ b/src/gen/gen_vimdoc.lua @@ -841,7 +841,7 @@ end --- @return string local function get_script_path() - local str = debug.getinfo(2, 'S').source:sub(2) + local str = debug.getinfo(2, 'S').source:gsub('^@', '') return str:match('(.*[/\\])') or './' end diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index fb8df27a50..b8cc38dff9 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -1176,7 +1176,7 @@ describe('user config init', function() string.format( [[ vim.g.exrc_file = "%s" - vim.g.exrc_path = debug.getinfo(1, 'S').source:sub(2) + vim.g.exrc_path = debug.getinfo(1, 'S').source:gsub('^@', '') ]], exrc_path )