Skip to main content
Module

x/denops_std/function/mod.ts>bufexists

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

The result is a Number, which is TRUE if a buffer called {buf} exists. If the {buf} argument is a number, buffer numbers are used. Number zero is the alternate buffer for the current window.

If the {buf} argument is a string it must match a buffer name exactly. The name can be:

  • Relative to the current directory.
  • A full path.
  • The name of a buffer with 'buftype' set to "nofile".
  • A URL name. Unlisted buffers will be found. Note that help files are listed by their short name in the output of :buffers, but bufexists() requires using their long name to be able to find them. bufexists() may report a buffer exists, but to use the name with a :buffer command you may need to use expand(). Esp for MS-Windows 8.3 names in the form "c:\DOCUME~1" Use "bufexists(0)" to test for the existence of an alternate file name.

Can also be used as a method:

let exists = 'somename'->bufexists()

Obsolete name: buffer_exists().

Returns

Promise<boolean>