Home Explore Blog CI



neovim

70th chunk of `runtime/doc/vimfn.txt`
99fed092b11489ac222db5169d09fce9eadeaff0985d211e0000000100000fb9
       *keys()*
		Return a |List| with all the keys of {dict}.  The |List| is in
		arbitrary order.  Also see |items()| and |values()|.

                Parameters: ~
                  • {dict} (`table`)

                Return: ~
                  (`string[]`)

keytrans({string})                                                  *keytrans()*
		Turn the internal byte representation of keys into a form that
		can be used for |:map|.  E.g. >vim
			let xx = "\<C-Home>"
			echo keytrans(xx)
<			<C-Home>

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

                Return: ~
                  (`string`)

len({expr})                                                         *len()* *E701*
		The result is a Number, which is the length of the argument.
		When {expr} is a String or a Number the length in bytes is
		used, as with |strlen()|.
		When {expr} is a |List| the number of items in the |List| is
		returned.
		When {expr} is a |Blob| the number of bytes is returned.
		When {expr} is a |Dictionary| the number of entries in the
		|Dictionary| is returned.
		Otherwise an error is given and returns zero.

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

                Return: ~
                  (`integer`)

libcall({libname}, {funcname}, {argument})                 *libcall()* *E364* *E368*
		Call function {funcname} in the run-time library {libname}
		with single argument {argument}.
		This is useful to call functions in a library that you
		especially made to be used with Vim.  Since only one argument
		is possible, calling standard library functions is rather
		limited.
		The result is the String returned by the function.  If the
		function returns NULL, this will appear as an empty string ""
		to Vim.
		If the function returns a number, use libcallnr()!
		If {argument} is a number, it is passed to the function as an
		int; if {argument} is a string, it is passed as a
		null-terminated string.

		libcall() allows you to write your own 'plug-in' extensions to
		Vim without having to recompile the program.  It is NOT a
		means to call system functions!  If you try to do so Vim will
		very probably crash.

		For Win32, the functions you write must be placed in a DLL
		and use the normal C calling convention (NOT Pascal which is
		used in Windows System DLLs).  The function must take exactly
		one parameter, either a character pointer or a long integer,
		and must return a character pointer or NULL.  The character
		pointer returned must point to memory that will remain valid
		after the function has returned (e.g. in static data in the
		DLL).  If it points to allocated memory, that memory will
		leak away.  Using a static buffer in the function should work,
		it's then freed when the DLL is unloaded.

		WARNING: If the function returns a non-valid pointer, Vim may
		crash!	This also happens if the function returns a number,
		because Vim thinks it's a pointer.
		For Win32 systems, {libname} should be the filename of the DLL
		without the ".DLL" suffix.  A full path is only required if
		the DLL is not in the usual places.
		For Unix: When compiling your own plugins, remember that the
		object code must be compiled as position-independent ('PIC').
		Examples: >vim
			echo libcall("libc.so", "getenv", "HOME")

                Parameters: ~
                  • {libname} (`string`)
                  • {funcname} (`string`)
                  • {argument} (`any`)

                Return: ~
                  (`any`)

libcallnr({libname}, {funcname}, {argument})                       *libcallnr()*
		Just like |libcall()|, but used for a function that returns an
		int instead of a string.
		Examples: >vim
			echo libcallnr("/usr/lib/libc.so", "getpid", "")
			call libcallnr("libc.so", "printf", "Hello World!\n")
			call libcallnr("libc.so", "sleep", 10)
<

                Parameters: ~
                  • {libname} (`string`)
                  • {funcname} (`string`)
                  • {argument} (`any`)

Title: Vim Function Documentation: keys(), keytrans(), len(), libcall(), and libcallnr()
Summary
This documentation describes several Vim functions. `keys()` returns a list of keys from a dictionary. `keytrans()` converts internal key representations for use with `:map`. `len()` returns the length of strings, lists, blobs or the number of entries in a dictionary. `libcall()` calls a function in a runtime library and returns a string. `libcallnr()` is similar to `libcall()` but expects the function to return an integer.