Dear all,
what would be the best way to silently edit a buffer? In particular, I want to
be able to write the content of a variable to it, as well as to delete all of
its content.
The story goes, I'm writing a plugin that among other things reads from a
network socket using Vim 8 channels and jobs; this is the corresponding call:
call job_start(command_cmd, {'out_io': 'buffer', 'out_name': '_out'})
The problem is that on the other side of the socket there's a server process
which doesn't append a newline after it finishes its write. Consequently,
reading from the channel set to NL mode would always leave one line of input in
the socket, and so I'm forced to either fall back to RAW mode, or to check
whether there's something left in the socket and read it later with a separate
ch_read call:
- Writing in RAW mode directly to the buffer leaves ^@ in place of proper
linefeeds, meaning a callback function would have to be called, that would
substitute ^@ with ^M and only then write to the buffer; this is where the
initial question stems from.
- ch_read() call would also have to be performed by a callback function that
will, again, need a way to somehow write to the buffer.
The closest solution I've got is to do something like
:bufnr('_out') bufdo put =msg
but that switches the current window to "_out" buffer.
--
Regards,
Dmitry
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment