Skip to main content
Module

x/ddc_vim/deps.ts>fn.bufname

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.bufname
import { fn } from "https://deno.land/x/ddc_vim@v2.3.0/deps.ts";
const { bufname } = fn;

The result is the name of a buffer, as it is displayed by the ":ls" command. If {expr} is omitted the current buffer is used. If {expr} is a Number, that buffer number's name is given. Number zero is the alternate buffer for the current window. If {expr} is a String, it is used as a |file-pattern| to match with the buffer names. This is always done like 'magic' is set and 'cpoptions' is empty. When there is more than one match an empty string is returned. "" or "%" can be used for the current buffer, "#" for the alternate buffer. A full match is preferred, otherwise a match at the start, end or middle of the buffer name is accepted. If you only want a full match then put "^" at the start and "$" at the end of the pattern. Listed buffers are found first. If there is a single match with a listed buffer, that one is returned. Next unlisted buffers are searched for. If the {expr} is a String, but you want to use it as a buffer number, force it to be a Number by adding zero to it: > :echo bufname("3" + 0) If the buffer doesn't exist, or doesn't have a name, an empty string is returned. bufname("#") alternate buffer name bufname(3) name of buffer 3 bufname("%") name of current buffer bufname("file2") name of buffer where "file2" matches.

Parameters

denops: Denops
optional
expr: string | number

Returns

Promise<string>