Skip to main content
Module

x/denops_std/function/mod.ts>executable

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

This function checks if an executable with the name {expr} exists. {expr} must be the name of the program without any arguments. executable() uses the value of $PATH and/or the normal searchpath for programs. On MS-Windows the ".exe", ".bat", etc. can optionally be included. Then the extensions in $PATHEXT are tried. Thus if "foo.exe" does not exist, "foo.exe.bat" can be found. If $PATHEXT is not set then ".com;.exe;.bat;.cmd" is used. A dot by itself can be used in $PATHEXT to try using the name without an extension. When 'shell' looks like a Unix shell, then the name is also tried without adding an extension. On MS-Windows it only checks if the file exists and is not a directory, not if it's really executable. On MS-Windows an executable in the same directory as Vim is normally found. Since this directory is added to $PATH it should also work to execute it win32-PATH. This can be disabled by setting the $NoDefaultCurrentDirectoryInExePath environment variable. The result is a Number: 1 exists 0 does not exist -1 not implemented on this system exepath() can be used to get the full path of an executable.

Can also be used as a method:

GetCommand()->executable()

Parameters

denops: Denops
expr: unknown

Returns

Promise<number>