$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 the Vim
executable is always found (it's added to $PATH at |startup|).
*NoDefaultCurrentDirectoryInExePath*
On MS-Windows an executable in Vim's current working directory
is also normally found, but this can be disabled by setting
the $NoDefaultCurrentDirectoryInExePath environment variable.
The result is a Number:
1 exists
0 does not exist
|exepath()| can be used to get the full path of an executable.
Parameters: ~
• {expr} (`string`)
Return: ~
(`0|1`)
execute({command} [, {silent}]) *execute()*
Execute {command} and capture its output.
If {command} is a |String|, returns {command} output.
If {command} is a |List|, returns concatenated outputs.
Line continuations in {command} are not recognized.
Examples: >vim
echo execute('echon "foo"')
< foo >vim
echo execute(['echon "foo"', 'echon "bar"'])
< foobar
The optional {silent} argument can have these values:
"" no `:silent` used
"silent" `:silent` used
"silent!" `:silent!` used
The default is "silent". Note that with "silent!", unlike
`:redir`, error messages are dropped.
To get a list of lines use `split()` on the result: >vim
execute('args')->split("\n")
< This function is not available in the |sandbox|.
Note: If nested, an outer execute() will not observe output of
the inner calls.
Note: Text attributes (highlights) are not captured.
To execute a command in another window than the current one
use `win_execute()`.
Parameters: ~
• {command} (`string|string[]`)
• {silent} (`''|'silent'|'silent!'?`)
Return: ~
(`string`)
exepath({expr}) *exepath()*
Returns the full path of {expr} if it is an executable and
given as a (partial or full) path or is found in $PATH.
Returns empty string otherwise.
If {expr} starts with "./" the |current-directory| is used.
Parameters: ~
• {expr} (`string`)
Return: ~
(`string`)
exists({expr}) *exists()*
The result is a Number, which is |TRUE| if {expr} is
defined, zero otherwise.
For checking for a supported feature use |has()|.
For checking if a file exists use |filereadable()|.
The {expr} argument is a string, which contains one of these:
varname internal variable (see
dict.key |internal-variables|). Also works
list[i] for |curly-braces-names|, |Dictionary|
entries, |List| items, etc.
Beware that evaluating an index may
cause an error message for an invalid
expression. E.g.: >vim
let l = [1, 2, 3]
echo exists("l[5]")
< 0 >vim
echo exists("l[xx]")
< E121: Undefined variable: xx
0
&option-name Vim option (only checks if it exists,
not if it really works)
+option-name Vim option that works.
$ENVNAME environment variable (could also be
done by comparing with an empty
string)
`*funcname` built-in function (see |functions|)
or user defined function (see
|user-function|). Also works for a
variable that is a Funcref.
:cmdname Ex command: built-in command, user
command or command modifier |:command|.
Returns:
1 for match with start of a command
2 full match with a command
3 matches several user commands
To check for a supported command
always check the return value to be 2.
:2match The |:2match| command.
:3match The |:3match|