Home Explore Blog CI



neovim

17th chunk of `runtime/doc/vimfn.txt`
c412413d4147129a356e26269765b7446d7fc4f5917d3e110000000100000faf
	made.  It returns the number of the choice.  For the first
		choice this is 1.

		{msg} is displayed in a dialog with {choices} as the
		alternatives.  When {choices} is missing or empty, "&OK" is
		used (and translated).
		{msg} is a String, use '\n' to include a newline.  Only on
		some systems the string is wrapped when it doesn't fit.

		{choices} is a String, with the individual choices separated
		by '\n', e.g. >vim
			confirm("Save changes?", "&Yes\n&No\n&Cancel")
<		The letter after the '&' is the shortcut key for that choice.
		Thus you can type 'c' to select "Cancel".  The shortcut does
		not need to be the first letter: >vim
			confirm("file has been modified", "&Save\nSave &All")
<		For the console, the first letter of each choice is used as
		the default shortcut key.  Case is ignored.

		The optional {type} String argument gives the type of dialog.
		It can be one of these values: "Error", "Question", "Info",
		"Warning" or "Generic".  Only the first character is relevant.
		When {type} is omitted, "Generic" is used.

		The optional {type} argument gives the type of dialog.  This
		is only used for the icon of the Win32 GUI.  It can be one of
		these values: "Error", "Question", "Info", "Warning" or
		"Generic".  Only the first character is relevant.
		When {type} is omitted, "Generic" is used.

		If the user aborts the dialog by pressing <Esc>, CTRL-C,
		or another valid interrupt key, confirm() returns 0.

		An example: >vim
		   let choice = confirm("What do you want?",
					\ "&Apples\n&Oranges\n&Bananas", 2)
		   if choice == 0
			echo "make up your mind!"
		   elseif choice == 3
			echo "tasteful"
		   else
			echo "I prefer bananas myself."
		   endif
<		In a GUI dialog, buttons are used.  The layout of the buttons
		depends on the 'v' flag in 'guioptions'.  If it is included,
		the buttons are always put vertically.  Otherwise,  confirm()
		tries to put the buttons in one horizontal line.  If they
		don't fit, a vertical layout is used anyway.  For some systems
		the horizontal layout is always used.

                Parameters: ~
                  • {msg} (`string`)
                  • {choices} (`string?`)
                  • {default} (`integer?`)
                  • {type} (`string?`)

                Return: ~
                  (`integer`)

copy({expr})                                                            *copy()*
		Make a copy of {expr}.  For Numbers and Strings this isn't
		different from using {expr} directly.
		When {expr} is a |List| a shallow copy is created.  This means
		that the original |List| can be changed without changing the
		copy, and vice versa.  But the items are identical, thus
		changing an item changes the contents of both |Lists|.
		A |Dictionary| is copied in a similar way as a |List|.
		Also see |deepcopy()|.

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

                Return: ~
                  (`T`)

cos({expr})                                                              *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

Title: Vimscript Function Details: Confirm, Copy, Cos, Cosh, and Count
Summary
This section details several Vimscript functions. It expands on the confirm() function, explaining how to create dialogs with choices, shortcut keys, and different types (Error, Question, Info, Warning, Generic). It also covers the copy() function, which creates shallow copies of Lists and Dictionaries. Then the cos() and cosh() functions are explained, which return the cosine and hyperbolic cosine of a number in radians, respectively. Finally, it begins to introduce the count() function.