mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +00:00
fix(lua): print multiple return values with =expr (#16933)
This commit is contained in:
@@ -689,4 +689,23 @@ vim._expand_pat_get_parts = function(lua_string)
|
||||
return parts, search_index
|
||||
end
|
||||
|
||||
---Prints given arguments in human-readable format.
|
||||
---Example:
|
||||
---<pre>
|
||||
--- -- Print highlight group Normal and store it's contents in a variable.
|
||||
--- local hl_normal = vim.pretty_print(vim.api.nvim_get_hl_by_name("Normal", true))
|
||||
---</pre>
|
||||
---@see |vim.inspect()|
|
||||
---@return given arguments.
|
||||
function vim.pretty_print(...)
|
||||
local objects = {}
|
||||
for i = 1, select('#', ...) do
|
||||
local v = select(i, ...)
|
||||
table.insert(objects, vim.inspect(v))
|
||||
end
|
||||
|
||||
print(table.concat(objects, ' '))
|
||||
return ...
|
||||
end
|
||||
|
||||
return module
|
||||
|
Reference in New Issue
Block a user