Vi and Vim Asked by Igor Semenov on January 2, 2021
My plugin creates new buffer, sets buffer type to nofile
and fills it with text via job_start
with out_io
=buffer
. Simplified code:
enew
setl bt=nofile
...
call job_start(cmd, {'out_io': 'buffer', 'out_buf': bufnr('%')})
Works fine, but when I switch to new buffer, and then return back, created buffer is empty. So, looks like vim doesn’t keep contents of nofile buffers.
Is there any way to keep nofile buffer contents for vim session?
You also need setl bufhidden=hide
to prevent the buffer from getting unloaded when you switch to another buffer.
See also :help special-buffers
, in particular the entry for "scratch" buffers.
Correct answer by filbranden on January 2, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP