Home Explore Blog CI



neovim

95th chunk of `runtime/doc/vimfn.txt`
43519d744fdb60d1b76c330b9b5ddaee4fd4db0c919c9fa00000000100000faf
 (`any`)

pumvisible()                                                      *pumvisible()*
		Returns non-zero when the popup menu is visible, zero
		otherwise.  See |ins-completion-menu|.
		This can be used to avoid some things that would remove the
		popup menu.

                Return: ~
                  (`any`)

py3eval({expr})                                                      *py3eval()*
		Evaluate Python expression {expr} and return its result
		converted to Vim data structures.
		Numbers and strings are returned as they are (strings are
		copied though, Unicode strings are additionally converted to
		UTF-8).
		Lists are represented as Vim |List| type.
		Dictionaries are represented as Vim |Dictionary| type with
		keys converted to strings.

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

                Return: ~
                  (`any`)

pyeval({expr})                                              *pyeval()* *E858* *E859*
		Evaluate Python 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.

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

                Return: ~
                  (`any`)

pyxeval({expr})                                                      *pyxeval()*
		Evaluate Python expression {expr} and return its result
		converted to Vim data structures.
		Uses Python 2 or 3, see |python_x| and 'pyxversion'.
		See also: |pyeval()|, |py3eval()|

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

                Return: ~
                  (`any`)

rand([{expr}])                                                          *rand()*
		Return a pseudo-random Number generated with an xoshiro128**
		algorithm using seed {expr}.  The returned number is 32 bits,
		also on 64 bits systems, for consistency.
		{expr} can be initialized by |srand()| and will be updated by
		rand().  If {expr} is omitted, an internal seed value is used
		and updated.
		Returns -1 if {expr} is invalid.

		Examples: >vim
			echo rand()
			let seed = srand()
			echo rand(seed)
			echo rand(seed) % 16  " random number 0 - 15
<

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

                Return: ~
                  (`any`)

range({expr} [, {max} [, {stride}]])                         *range()* *E726* *E727*
		Returns a |List| with Numbers:
		- If only {expr} is specified: [0, 1, ..., {expr} - 1]
		- If {max} is specified: [{expr}, {expr} + 1, ..., {max}]
		- If {stride} is specified: [{expr}, {expr} + {stride}, ...,
		  {max}] (increasing {expr} with {stride} each time, not
		  producing a value past {max}).
		When the maximum is one before the start the result is an
		empty list.  When the maximum is more than one before the
		start this is an error.
		Examples: >vim
			echo range(4)		" [0, 1, 2, 3]
			echo range(2, 4)	" [2, 3, 4]
			echo range(2, 9, 3)	" [2, 5, 8]
			echo range(2, -2, -1)	" [2, 1, 0, -1, -2]
			echo range(0)		" []
			echo range(2, 0)	" error!
<

                Parameters: ~
                  • {expr} (`any`)
                  • {max} (`integer?`)
                  • {stride} (`integer?`)

                Return: ~
                  (`any`)

readblob({fname} [, {offset} [, {size}]])                           *readblob()*
		Read file {fname} in binary mode and return a |Blob|.
		If {offset} is specified, read the file from the specified
		offset.  If it is a negative value, it is used as an offset
		from the end of the file.  E.g., to read the last 12 bytes: >vim
			echo readblob('file.bin', -12)
<		If {size} is specified, only the specified size will be read.
		E.g. to read the first 100 bytes of a file: >vim
			echo readblob('file.bin', 0, 100)
<		If {size} is -1 or omitted, the whole data starting from
		{offset} will

Title: Python Evaluation, Random Numbers, Ranges, and Binary File Reading
Summary
This section describes several functions: `pumvisible()` checks if the popup menu is visible, `py3eval()` and `pyeval()` evaluate Python expressions and convert the results to Vim data structures, `pyxeval()` evaluates Python expressions using Python 2 or 3, `rand()` generates pseudo-random numbers using an xoshiro128** algorithm, `range()` creates a List of numbers within a specified range, and `readblob()` reads a binary file and returns a Blob.