Skip to main content
Module

x/denops_std/function/buffer.ts>bufexists

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

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

If the {expr} 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.

Parameters

denops: Denops
expr: string | number

Returns

Promise<boolean>