Home Explore Blog CI



neovim

11th chunk of `runtime/doc/vimfn.txt`
b65810a155046bd24c56922888430f86ea162f3d1d8c741e0000000100000fb9
 {dict} (`any?`)

                Return: ~
                  (`any`)

ceil({expr})                                                            *ceil()*
		Return the smallest integral value greater than or equal to
		{expr} as a |Float| (round up).
		{expr} must evaluate to a |Float| or a |Number|.
		Examples: >vim
			echo ceil(1.456)
<			2.0  >vim
			echo ceil(-5.456)
<			-5.0  >vim
			echo ceil(4.0)
<			4.0

		Returns 0.0 if {expr} is not a |Float| or a |Number|.

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

                Return: ~
                  (`number`)

chanclose({id} [, {stream}])                                       *chanclose()*
		Close a channel or a specific stream associated with it.
		For a job, {stream} can be one of "stdin", "stdout",
		"stderr" or "rpc" (closes stdin/stdout for a job started
		with `"rpc":v:true`) If {stream} is omitted, all streams
		are closed. If the channel is a pty, this will then close the
		pty master, sending SIGHUP to the job process.
		For a socket, there is only one stream, and {stream} should be
		omitted.

                Parameters: ~
                  • {id} (`integer`)
                  • {stream} (`string?`)

                Return: ~
                  (`0|1`)

changenr()                                                          *changenr()*
		Return the number of the most recent change.  This is the same
		number as what is displayed with |:undolist| and can be used
		with the |:undo| command.
		When a change was made it is the number of that change.  After
		redo it is the number of the redone change.  After undo it is
		one less than the number of the undone change.
		Returns 0 if the undo list is empty.

                Return: ~
                  (`integer`)

chansend({id}, {data})                                              *chansend()*
		Send data to channel {id}. For a job, it writes it to the
		stdin of the process. For the stdio channel |channel-stdio|,
		it writes to Nvim's stdout.  Returns the number of bytes
		written if the write succeeded, 0 otherwise.
		See |channel-bytes| for more information.

		{data} may be a string, string convertible, |Blob|, or a list.
		If {data} is a list, the items will be joined by newlines; any
		newlines in an item will be sent as NUL. To send a final
		newline, include a final empty string. Example: >vim
			call chansend(id, ["abc", "123\n456", ""])
<		will send "abc<NL>123<NUL>456<NL>".

		chansend() writes raw data, not RPC messages.  If the channel
		was created with `"rpc":v:true` then the channel expects RPC
		messages, use |rpcnotify()| and |rpcrequest()| instead.

                Parameters: ~
                  • {id} (`number`)
                  • {data} (`string|string[]`)

                Return: ~
                  (`0|1`)

char2nr({string} [, {utf8}])                                         *char2nr()*
		Return Number value of the first char in {string}.
		Examples: >vim
			echo char2nr(" ")	" returns 32
			echo char2nr("ABC")	" returns 65
			echo char2nr("á")	" returns 225
			echo char2nr("á"[0])	" returns 195
			echo char2nr("\<M-x>")	" returns 128
<		Non-ASCII characters are always treated as UTF-8 characters.
		{utf8} is ignored, it exists only for backwards-compatibility.
		A combining character is a separate character.
		|nr2char()| does the opposite.

		Returns 0 if {string} is not a |String|.

                Parameters: ~
                  • {string} (`string`)
                  • {utf8} (`any?`)

                Return: ~
                  (`0|1`)

charclass({string})                                                *charclass()*
		Return the character class of the first character in {string}.
		The character class is one of:
			0	blank
			1	punctuation
			2	word character (depends on 'iskeyword')
			3	emoji
			other	specific Unicode class
		The class is used in patterns and word motions.
		Returns 0 if {string} is not a |String|.

                Parameters: ~
                  • {string}

Title: Vimscript Built-in Functions: Ceil, Channel, Char
Summary
This section describes Vimscript functions including `ceil()` for rounding up floats, `chanclose()` and `chansend()` for managing channels, `changenr()` for retrieving the change number, `char2nr()` for converting characters to numbers, and `charclass()` to get the character class of the first character in a string.