Home Explore Blog CI



neovim

69th chunk of `runtime/doc/vimfn.txt`
d0e5940ae67c166892b43d21c6b0179dc7f469618cbc5f230000000100000fb3
 status of a job: >vim
			let running = jobwait([{job-id}], 0)[0] == -1
<
		During jobwait() callbacks for jobs not in the {jobs} list may
		be invoked. The screen will not redraw unless |:redraw| is
		invoked by a callback.

		Returns a list of len({jobs}) integers, where each integer is
		the status of the corresponding job:
			Exit-code, if the job exited
			-1 if the timeout was exceeded
			-2 if the job was interrupted (by |CTRL-C|)
			-3 if the job-id is invalid

                Parameters: ~
                  • {jobs} (`integer[]`)
                  • {timeout} (`integer?`)

                Return: ~
                  (`integer[]`)

join({list} [, {sep}])                                                  *join()*
		Join the items in {list} together into one String.
		When {sep} is specified it is put in between the items.  If
		{sep} is omitted a single space is used.
		Note that {sep} is not added at the end.  You might want to
		add it there too: >vim
			let lines = join(mylist, "\n") .. "\n"
<		String items are used as-is.  |Lists| and |Dictionaries| are
		converted into a string like with |string()|.
		The opposite function is |split()|.

                Parameters: ~
                  • {list} (`any[]`)
                  • {sep} (`string?`)

                Return: ~
                  (`string`)

json_decode({expr})                                              *json_decode()*
		Convert {expr} from JSON object.  Accepts |readfile()|-style
		list as the input, as well as regular string.  May output any
		Vim value. In the following cases it will output
		|msgpack-special-dict|:
		1. Dictionary contains duplicate key.
		2. String contains NUL byte.  Two special dictionaries: for
		   dictionary and for string will be emitted in case string
		   with NUL byte was a dictionary key.

		Note: function treats its input as UTF-8 always.  The JSON
		standard allows only a few encodings, of which UTF-8 is
		recommended and the only one required to be supported.
		Non-UTF-8 characters are an error.

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

                Return: ~
                  (`any`)

json_encode({expr})                                              *json_encode()*
		Convert {expr} into a JSON string.  Accepts
		|msgpack-special-dict| as the input.  Will not convert
		|Funcref|s, mappings with non-string keys (can be created as
		|msgpack-special-dict|), values with self-referencing
		containers, strings which contain non-UTF-8 characters,
		pseudo-UTF-8 strings which contain codepoints reserved for
		surrogate pairs (such strings are not valid UTF-8 strings).
		Non-printable characters are converted into "\u1234" escapes
		or special escapes like "\t", other are dumped as-is.
		|Blob|s are converted to arrays of the individual bytes.

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

                Return: ~
                  (`string`)

keys({dict})                                                            *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.

Title: Documentation for join(), json_decode(), json_encode(), keys(), keytrans(), and len() Functions
Summary
This section details several Vim functions. `join()` concatenates list items into a string with an optional separator. `json_decode()` converts a JSON object string into a Vim value, with special handling for duplicate keys and NUL bytes using `msgpack-special-dict`. `json_encode()` converts a Vim value into a JSON string, handling various data types and encoding non-printable characters. `keys()` returns a list of keys from a dictionary in arbitrary order. `keytrans()` transforms internal key byte representations for use with `:map`. Finally, `len()` returns the length of a string, list, or blob.