Home Explore Blog CI



neovim

23th chunk of `runtime/doc/vimfn.txt`
3d14b79dcb5a460618bc0f299bb1faff655dccdd38cf3bae0000000100000fb3
    • {digraphlist} (`table<integer,string[]>`)

                Return: ~
                  (`any`)

empty({expr})                                                          *empty()*
		Return the Number 1 if {expr} is empty, zero otherwise.
		- A |List| or |Dictionary| is empty when it does not have any
		  items.
		- A |String| is empty when its length is zero.
		- A |Number| and |Float| are empty when their value is zero.
		- |v:false| and |v:null| are empty, |v:true| is not.
		- A |Blob| is empty when its length is zero.

                Parameters: ~
                  • {expr} (`any`)

                Return: ~
                  (`integer`)

environ()                                                            *environ()*
		Return all of environment variables as dictionary. You can
		check if an environment variable exists like this: >vim
			echo has_key(environ(), 'HOME')
<		Note that the variable name may be CamelCase; to ignore case
		use this: >vim
			echo index(keys(environ()), 'HOME', 0, 1) != -1
<

                Return: ~
                  (`any`)

escape({string}, {chars})                                             *escape()*
		Escape the characters in {chars} that occur in {string} with a
		backslash.  Example: >vim
			echo escape('c:\program files\vim', ' \')
<		results in: >
			c:\\program\ files\\vim
<		Also see |shellescape()| and |fnameescape()|.

                Parameters: ~
                  • {string} (`string`)
                  • {chars} (`string`)

                Return: ~
                  (`string`)

eval({string})                                                          *eval()*
		Evaluate {string} and return the result.  Especially useful to
		turn the result of |string()| back into the original value.
		This works for Numbers, Floats, Strings, Blobs and composites
		of them.  Also works for |Funcref|s that refer to existing
		functions.

                Parameters: ~
                  • {string} (`string`)

                Return: ~
                  (`any`)

eventhandler()                                                  *eventhandler()*
		Returns 1 when inside an event handler.  That is that Vim got
		interrupted while waiting for the user to type a character,
		e.g., when dropping a file on Vim.  This means interactive
		commands cannot be used.  Otherwise zero is returned.

                Return: ~
                  (`any`)

executable({expr})                                                *executable()*
		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.
							*PATHEXT*
		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 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}

Title: Vimscript Functions: Environment, Escaping, Execution, and Existence Checks
Summary
This section details several Vimscript functions. It covers `environ()`, which retrieves environment variables as a dictionary; `escape()`, which escapes specified characters within a string; `eval()`, which evaluates a string expression; `eventhandler()`, which checks if the code is running inside an event handler; `executable()`, which determines if an executable program exists; and begins documenting `execute()`, which executes a command and captures its output.