import { fn } from "https://deno.land/x/ddc_vim@v3.8.0/deps.ts";
const { bufadd } = fn;
Add a buffer to the buffer list with name {name} (must be a String). If a buffer for file {name} already exists, return that buffer number. Otherwise return the buffer number of the newly created buffer. When {name} is an empty string then a new buffer is always created. The buffer will not have 'buflisted' set and not be loaded yet. To add some text to the buffer use this:
let bufnr = bufadd('someName')
call bufload(bufnr)
call setbufline(bufnr, 1, ['some', 'text'])
Returns 0 on error.
Can also be used as a method
:
let bufnr = 'somename'->bufadd()
Parameters
denops: Denops