Home Explore Blog CI



neovim

18th chunk of `runtime/doc/vimfn.txt`
b1c0df3017f7c92bae0b24c18c557b13d6f7e3692f7b89970000000100000fb4
     *cos()*
		Return the cosine of {expr}, measured in radians, as a |Float|.
		{expr} must evaluate to a |Float| or a |Number|.
		Returns 0.0 if {expr} is not a |Float| or a |Number|.
		Examples: >vim
			echo cos(100)
<			0.862319 >vim
			echo cos(-4.01)
<			-0.646043

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

                Return: ~
                  (`number`)

cosh({expr})                                                            *cosh()*
		Return the hyperbolic cosine of {expr} as a |Float| in the range
		[1, inf].
		{expr} must evaluate to a |Float| or a |Number|.
		Returns 0.0 if {expr} is not a |Float| or a |Number|.
		Examples: >vim
			echo cosh(0.5)
<			1.127626 >vim
			echo cosh(-0.5)
<			-1.127626

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

                Return: ~
                  (`number`)

count({comp}, {expr} [, {ic} [, {start}]])                        *count()* *E706*
		Return the number of times an item with value {expr} appears
		in |String|, |List| or |Dictionary| {comp}.

		If {start} is given then start with the item with this index.
		{start} can only be used with a |List|.

		When {ic} is given and it's |TRUE| then case is ignored.

		When {comp} is a string then the number of not overlapping
		occurrences of {expr} is returned. Zero is returned when
		{expr} is an empty string.

                Parameters: ~
                  • {comp} (`string|table|any[]`)
                  • {expr} (`any`)
                  • {ic} (`boolean?`)
                  • {start} (`integer?`)

                Return: ~
                  (`integer`)

ctxget([{index}])                                                     *ctxget()*
		Returns a |Dictionary| representing the |context| at {index}
		from the top of the |context-stack| (see |context-dict|).
		If {index} is not given, it is assumed to be 0 (i.e.: top).

                Parameters: ~
                  • {index} (`integer?`)

                Return: ~
                  (`table`)

ctxpop()                                                              *ctxpop()*
		Pops and restores the |context| at the top of the
		|context-stack|.

                Return: ~
                  (`any`)

ctxpush([{types}])                                                   *ctxpush()*
		Pushes the current editor state (|context|) on the
		|context-stack|.
		If {types} is given and is a |List| of |String|s, it specifies
		which |context-types| to include in the pushed context.
		Otherwise, all context types are included.

                Parameters: ~
                  • {types} (`string[]?`)

                Return: ~
                  (`any`)

ctxset({context} [, {index}])                                         *ctxset()*
		Sets the |context| at {index} from the top of the
		|context-stack| to that represented by {context}.
		{context} is a Dictionary with context data (|context-dict|).
		If {index} is not given, it is assumed to be 0 (i.e.: top).

                Parameters: ~
                  • {context} (`table`)
                  • {index} (`integer?`)

                Return: ~
                  (`integer`)

ctxsize()                                                            *ctxsize()*
		Returns the size of the |context-stack|.

                Return: ~
                  (`any`)

cursor({lnum}, {col} [, {off}])                                       *cursor()*
cursor({list})
		Positions the cursor at the column (byte count) {col} in the
		line {lnum}.  The first column is one.

		When there is one argument {list} this is used as a |List|
		with two, three or four item:
			[{lnum}, {col}]
			[{lnum}, {col}, {off}]
			[{lnum}, {col}, {off}, {curswant}]
		This is like the return value of |getpos()| or |getcurpos()|,
		but without the first item.

		To position the cursor using {col} as the character count, use
		|setcursorcharpos()|.

		Does not change the jumplist.
		{lnum} is used like with |getline()|, except that if {lnum}

Title: Vimscript Functions: Count, Context Stack Manipulation, and Cursor Positioning
Summary
This section details several Vimscript functions. It explains count(), which counts the occurrences of an item within a String, List, or Dictionary. Then it covers ctxget(), ctxpop(), ctxpush(), ctxset(), and ctxsize(), which are used for manipulating the context stack. Finally it explains the cursor() function, which positions the cursor at a specific line and column.