Assume we have the following lua function to create a non-file backed buffer:
M.makeScratch = function(scratchpath)
local uri = vim.uri_from_fname(scratchpath)
local bufnr = vim.uri_to_bufnr(uri)
vim.bo[bufnr].bufhidden = ""
vim.bo[bufnr].buflisted = true
vim.bo[bufnr].buftype = "nofile"
vim.bo[bufnr].readonly = false
vim.bo[bufnr].swapfile = false
end
Now assume there is shell opened and the uri + buffer number is known (can be found via scratch path).
How can I pipe a command output to the created scratch buffer (not backed by a file)?