Skip to main content
Module

x/denops_std/function/mod.ts>bufnr

📚 Standard module for denops.vim
Go to Latest
function bufnr
import { bufnr } from "https://deno.land/x/denops_std@v3.6.0/function/mod.ts";

The result is the number of a buffer, as it is displayed by the ":ls" command. For the use of {expr}, see |bufname()| above. If the buffer doesn't exist, -1 is returned. Or, if the {create} argument is present and not zero, a new, unlisted, buffer is created and its number is returned. bufnr("$") is the last buffer: :let last_buffer = bufnr("$") The result is a Number, which is the highest buffer number of existing buffers. Note that not all buffers with a smaller number necessarily exist, because ":bwipeout" may have removed them. Use bufexists() to test for the existence of a buffer.

Parameters

denops: Denops
optional
expr: string | number
optional
create: boolean

Returns

Promise<number>