Replies: 1 comment
-
vim.system(cmd, {
stdout = function(err, data)
local chunk = data
-- ……
end,
}) This
Each chunk = "aaa123456\nbb" -- 1st time call
chunk = "b234567\nccc3" -- 2nd
chunk = "45678" -- 3rd
chunk = nil -- the last You should carefully deal with such cases, then you can implement logic to add outputs into buffers smoothly. plenary.job also has a similar feature: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi nvim-lua team, I wonder what the difference is between
vim.system
andplenary.job
, mostly in performance.For context: I'm writing a plugin that writes output of
jq
to a buffer, using vim.system:The
vim.schedule
is there becausenvim_buf_set_lines
"must not be used in a fast context". However, this still hangs the editor for a while on large json input/output. Do you know if plenary.job could help here?Beta Was this translation helpful? Give feedback.
All reactions