|
|
|
@ -501,10 +501,15 @@ contents of an object can get pretty tedious. It might be worthwhile to
|
|
|
|
|
have a global wrapper function somewhere in your configuration:
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
function _G.dump(...)
|
|
|
|
|
local objects = vim.tbl_map(vim.inspect, {...})
|
|
|
|
|
print(unpack(objects))
|
|
|
|
|
return ...
|
|
|
|
|
function _G.put(...)
|
|
|
|
|
local objects = {}
|
|
|
|
|
for i = 1, select('#', ...) do
|
|
|
|
|
local v = select(i, ...)
|
|
|
|
|
table.insert(objects, vim.inspect(v))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
print(table.concat(objects, '\n'))
|
|
|
|
|
return ...
|
|
|
|
|
end
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
@ -512,11 +517,11 @@ You can then inspect the contents of an object very quickly in your code
|
|
|
|
|
or from the command-line:
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
dump({1, 2, 3})
|
|
|
|
|
put({1, 2, 3})
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
:lua dump(vim.loop)
|
|
|
|
|
:lua put(vim.loop)
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -603,11 +608,13 @@ Alias for `vim.api.nvim_exec()`. Only the command argument is needed,
|
|
|
|
|
>
|
|
|
|
|
vim.cmd('buffers')
|
|
|
|
|
vim.cmd([[
|
|
|
|
|
let g:multiline =<< EOF
|
|
|
|
|
foo
|
|
|
|
|
bar
|
|
|
|
|
baz
|
|
|
|
|
EOF
|
|
|
|
|
let g:multiline_list = [
|
|
|
|
|
\ 1,
|
|
|
|
|
\ 2,
|
|
|
|
|
\ 3,
|
|
|
|
|
\ ]
|
|
|
|
|
|
|
|
|
|
echo g:multiline_list
|
|
|
|
|
]])
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
|