Home Explore Blog CI



neovim

88th chunk of `runtime/doc/vimfn.txt`
a93face1a4f0debdaf173f59e96e638eb520fee6de3481080000000100000fb3
 |prevnonblank()|.

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

                Return: ~
                  (`integer`)

nr2char({expr} [, {utf8}])                                           *nr2char()*
		Return a string with a single character, which has the number
		value {expr}.  Examples: >vim
			echo nr2char(64)		" returns '@'
			echo nr2char(32)		" returns ' '
<		Example for "utf-8": >vim
			echo nr2char(300)		" returns I with bow character
<
		UTF-8 encoding is always used, {utf8} option has no effect,
		and exists only for backwards-compatibility.
		Note that a NUL character in the file is specified with
		nr2char(10), because NULs are represented with newline
		characters.  nr2char(0) is a real NUL and terminates the
		string, thus results in an empty string.

                Parameters: ~
                  • {expr} (`integer`)
                  • {utf8} (`boolean?`)

                Return: ~
                  (`string`)

nvim_...({...})                                      *nvim_...()* *E5555* *eval-api*
		Call nvim |api| functions. The type checking of arguments will
		be stricter than for most other builtins. For instance,
		if Integer is expected, a |Number| must be passed in, a
		|String| will not be autoconverted.
		Buffer numbers, as returned by |bufnr()| could be used as
		first argument to nvim_buf_... functions.  All functions
		expecting an object (buffer, window or tabpage) can
		also take the numerical value 0 to indicate the current
		(focused) object.

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

                Return: ~
                  (`any`)

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

<		Rationale: The reason this is a function and not using the "|"
		character like many languages, is that Vi has always used "|"
		to separate commands.  In many places it would not be clear if
		"|" is an operator or a command separator.

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

                Return: ~
                  (`any`)

pathshorten({path} [, {len}])                                    *pathshorten()*
		Shorten directory names in the path {path} and return the
		result.  The tail, the file name, is kept as-is.  The other
		components in the path are reduced to {len} letters in length.
		If {len} is omitted or smaller than 1 then 1 is used (single
		letters).  Leading '~' and '.' characters are kept.  Examples: >vim
			echo pathshorten('~/.config/nvim/autoload/file1.vim')
<			~/.c/n/a/file1.vim ~
>vim
			echo pathshorten('~/.config/nvim/autoload/file2.vim', 2)
<			~/.co/nv/au/file2.vim ~
		It doesn't matter if the path exists or not.
		Returns an empty string on error.

                Parameters: ~
                  • {path} (`string`)
                  • {len} (`integer?`)

                Return: ~
                  (`string`)

perleval({expr})                                                    *perleval()*
		Evaluate |perl| expression {expr} and return its result
		converted to Vim data structures.
		Numbers and strings are returned as they are (strings are
		copied though).
		Lists are represented as Vim |List| type.
		Dictionaries are represented as Vim |Dictionary| type,
		non-string keys result in error.

		Note: If you want an array or hash, {expr} must return a
		reference to it.
		Example: >vim
			echo perleval('[1 .. 4]')
<			[1, 2, 3, 4]

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

                Return: ~
                  (`any`)

pow({x}, {y})                                                            *pow()*
		Return the power of {x} to the exponent {y} as a |Float|.
		{x} and {y} must evaluate to a |Float| or a

Title: nvim API, or, pathshorten, perleval, and pow Functions
Summary
This section defines several Vim functions: `nr2char({expr} [, {utf8}])`, which converts a number to its corresponding character string; `nvim_...({...})`, which calls nvim API functions with strict type checking; `or({expr}, {expr})`, which performs a bitwise OR operation; `pathshorten({path} [, {len}])`, which shortens directory names in a path; `perleval({expr})`, which evaluates a Perl expression and converts the result to Vim data structures; and `pow({x}, {y})`, which returns the power of {x} to the exponent {y}.