import { fn } from "https://deno.land/x/ddu_vim@v4.0.0/deps.ts";
const { appendbufline } = fn;
Like append()
but append the text in buffer {buf}.
This function works only for loaded buffers. First call
bufload()
if needed.
For the use of {buf}, see bufname()
.
{lnum} is the line number to append below. Note that using
line()
would use the current buffer, not the one appending
to. Use "$" to append at the end of the buffer. Other string
values are not supported.
On success 0 is returned, on failure 1 is returned.
In Vim9
script an error is given for an invalid {lnum}.
If {buf} is not a valid buffer or {lnum} is not valid, an error message is given. Example:
:let failed = appendbufline(13, 0, "# THE START")
However, when {text} is an empty list then no error is given for an invalid {lnum}, since {lnum} isn't actually used.
Can also be used as a method
after a List, the base is
passed as the second argument:
mylist->appendbufline(buf, lnum)