Home Explore Blog CI



neovim

1st chunk of `runtime/doc/vimfn.txt`
9b55ad1158182c5b4b69a01f81a27e415cd3bdf4d9355f2d0000000100000fb0
*vimfn.txt*	Nvim


		  NVIM REFERENCE MANUAL


Vimscript functions	*vimscript-functions* *builtin-functions* *builtin.txt*

For functions grouped by what they are used for see |function-list|.

				      Type |gO| to see the table of contents.
==============================================================================
1. Details					*builtin-function-details*

abs({expr})                                                              *abs()*
		Return the absolute value of {expr}.  When {expr} evaluates to
		a |Float| abs() returns a |Float|.  When {expr} can be
		converted to a |Number| abs() returns a |Number|.  Otherwise
		abs() gives an error message and returns -1.
		Examples: >vim
			echo abs(1.456)
<			1.456  >vim
			echo abs(-5.456)
<			5.456  >vim
			echo abs(-4)
<			4

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

                Return: ~
                  (`number`)

acos({expr})                                                            *acos()*
		Return the arc cosine of {expr} measured in radians, as a
		|Float| in the range of [0, pi].
		{expr} must evaluate to a |Float| or a |Number| in the range
		[-1, 1].
		Returns NaN if {expr} is outside the range [-1, 1].  Returns
		0.0 if {expr} is not a |Float| or a |Number|.
		Examples: >vim
			echo acos(0)
<			1.570796 >vim
			echo acos(-0.5)
<			2.094395

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

                Return: ~
                  (`number`)

add({object}, {expr})                                                    *add()*
		Append the item {expr} to |List| or |Blob| {object}.  Returns
		the resulting |List| or |Blob|.  Examples: >vim
			let alist = add([1, 2, 3], item)
			call add(mylist, "woodstock")
<		Note that when {expr} is a |List| it is appended as a single
		item.  Use |extend()| to concatenate |Lists|.
		When {object} is a |Blob| then {expr} must be a number.
		Use |insert()| to add an item at another position.
		Returns 1 if {object} is not a |List| or a |Blob|.

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

                Return: ~
                  (`any`) Resulting |List| or |Blob|, or 1 if {object} is not
                  a |List| or a |Blob|.

and({expr}, {expr})                                                      *and()*
		Bitwise AND on the two arguments.  The arguments are converted
		to a number.  A List, Dict or Float argument causes an error.
		Also see `or()` and `xor()`.
		Example: >vim
			let flag = and(bits, 0x80)
<

                Parameters: ~
                  • {expr} (`number`)
                  • {expr1} (`number`)

                Return: ~
                  (`integer`)

api_info()                                                          *api_info()*
		Returns Dictionary of |api-metadata|.

		View it in a nice human-readable format: >vim
		       lua vim.print(vim.fn.api_info())
<

                Return: ~
                  (`table`)

append({lnum}, {text})                                                *append()*
		When {text} is a |List|: Append each item of the |List| as a
		text line below line {lnum} in the current buffer.
		Otherwise append {text} as one text line below line {lnum} in
		the current buffer.
		Any type of item is accepted and converted to a String.
		{lnum} can be zero to insert a line before the first one.
		{lnum} is used like with |getline()|.
		Returns 1 for failure ({lnum} out of range or out of memory),
		0 for success.  When {text} is an empty list zero is returned,
		no matter the value of {lnum}.  Example: >vim
			let failed = append(line('$'), "# THE END")
			let failed = append(0, ["Chapter 1", "the beginning"])
<

                Parameters: ~
                  • {lnum} (`integer|string`)
                  • {text} (`string|string[]`)

                Return: ~
                  (`0|1`)

appendbufline({buf}, {lnum}, {text})                           *appendbufline()*
		Like |append()|

Title: Vimscript Built-in Functions: Details and Usage
Summary
This section of the Nvim reference manual details various built-in Vimscript functions, providing their syntax, parameters, return values, and examples. Functions covered include `abs()`, `acos()`, `add()`, `and()`, `api_info()`, `append()`, and `appendbufline()`. The manual explains how to use these functions to manipulate numbers, lists, blobs, and buffer lines within the Vim environment.