import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { getbufinfo } = fn;
Get information about buffers as a List of Dictionaries.
Without an argument information about all the buffers is returned.
When the argument is a Dictionary
only the buffers matching
the specified criteria are returned. The following keys can
be specified in {dict}:
buflisted include only listed buffers.
bufloaded include only loaded buffers.
bufmodified include only modified buffers.
Otherwise, {buf} specifies a particular buffer to return
information for. For the use of {buf}, see bufname()
above. If the buffer is found the returned List has one item.
Otherwise the result is an empty list.
Each returned List item is a dictionary with the following
entries:
bufnr Buffer number.
changed TRUE if the buffer is modified.
changedtick Number of changes made to the buffer.
hidden TRUE if the buffer is hidden.
lastused Timestamp in seconds, like
localtime()
, when the buffer was
last used.
only with the +viminfo
feature
listed TRUE if the buffer is listed.
lnum Line number used for the buffer when
opened in the current window.
Only valid if the buffer has been
displayed in the window in the past.
If you want the line number of the
last known cursor position in a given
window, use line()
:
:echo line('.', {winid})
linecount Number of lines in the buffer (only
valid when loaded)
loaded TRUE if the buffer is loaded.
name Full path to the file in the buffer.
signs List of signs placed in the buffer.
Each list item is a dictionary with
the following fields:
id sign identifier
lnum line number
name sign name
variables A reference to the dictionary with
buffer-local variables.
windows List of `window-ID`s that display this
buffer
popups List of popup `window-ID`s that
display this buffer
Examples:
for buf in getbufinfo()
echo buf.name
endfor
for buf in getbufinfo({'buflisted':1})
if buf.changed
....
endif
endfor
To get buffer-local options use:
getbufvar({bufnr}, '&option_name')
Can also be used as a method
:
GetBufnr()->getbufinfo()