Home Explore Blog CI



neovim

61th chunk of `runtime/doc/vimfn.txt`
29a8aac4d95753146f117bd8fb0d31760fae0a6938a26e6e0000000100000fbc
 currently running.  Machine names greater than
		256 characters long are truncated.

                Return: ~
                  (`string`)

iconv({string}, {from}, {to})                                          *iconv()*
		The result is a String, which is the text {string} converted
		from encoding {from} to encoding {to}.
		When the conversion completely fails an empty string is
		returned.  When some characters could not be converted they
		are replaced with "?".
		The encoding names are whatever the iconv() library function
		can accept, see ":!man 3 iconv".
		Note that Vim uses UTF-8 for all Unicode encodings, conversion
		from/to UCS-2 is automatically changed to use UTF-8.  You
		cannot use UCS-2 in a string anyway, because of the NUL bytes.

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

                Return: ~
                  (`string`)

id({expr})                                                                *id()*
		Returns a |String| which is a unique identifier of the
		container type (|List|, |Dict|, |Blob| and |Partial|). It is
		guaranteed that for the mentioned types `id(v1) ==# id(v2)`
		returns true iff `type(v1) == type(v2) && v1 is v2`.
		Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and
		`v:_null_blob` have the same `id()` with different types
		because they are internally represented as NULL pointers.
		`id()` returns a hexadecimal representation of the pointers to
		the containers (i.e. like `0x994a40`), same as `printf("%p",
		{expr})`, but it is advised against counting on the exact
		format of the return value.

		It is not guaranteed that `id(no_longer_existing_container)`
		will not be equal to some other `id()`: new containers may
		reuse identifiers of the garbage-collected ones.

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

                Return: ~
                  (`string`)

indent({lnum})                                                        *indent()*
		The result is a Number, which is indent of line {lnum} in the
		current buffer.  The indent is counted in spaces, the value
		of 'tabstop' is relevant.  {lnum} is used just like in
		|getline()|.
		When {lnum} is invalid -1 is returned.

		To get or set indent of lines in a string, see |vim.text.indent()|.

                Parameters: ~
                  • {lnum} (`integer|string`)

                Return: ~
                  (`integer`)

index({object}, {expr} [, {start} [, {ic}]])                           *index()*
		Find {expr} in {object} and return its index.  See
		|indexof()| for using a lambda to select the item.

		If {object} is a |List| return the lowest index where the item
		has a value equal to {expr}.  There is no automatic
		conversion, so the String "4" is different from the Number 4.
		And the Number 4 is different from the Float 4.0.  The value
		of 'ignorecase' is not used here, case matters as indicated by
		the {ic} argument.

		If {object} is a |Blob| return the lowest index where the byte
		value is equal to {expr}.

		If {start} is given then start looking at the item with index
		{start} (may be negative for an item relative to the end).

		When {ic} is given and it is |TRUE|, ignore case.  Otherwise
		case must match.

		-1 is returned when {expr} is not found in {object}.
		Example: >vim
			let idx = index(words, "the")
			if index(numbers, 123) >= 0
			  " ...
			endif
<

                Parameters: ~
                  • {object} (`any`)
                  • {expr} (`any`)
                  • {start} (`integer?`)
                  • {ic} (`boolean?`)

                Return: ~
                  (`integer`)

indexof({object}, {expr} [, {opts}])                                 *indexof()*
		Returns the index of an item in {object} where {expr} is
		v:true.  {object} must be a |List| or a |Blob|.

		If {object} is a |List|, evaluate {expr} for each item in the
		List until the expression

Title: Documentation for `id()`, `indent()`, `index()`, and `indexof()` Functions
Summary
This section details the `id()`, `indent()`, `index()`, and `indexof()` functions in Vim. `id()` returns a unique identifier for container types like Lists, Dictionaries, Blobs, and Partials. `indent()` returns the indentation of a line in the current buffer, counted in spaces. `index()` finds the index of an item in a List or Blob, considering case sensitivity. `indexof()` returns the index of an item in a List or Blob where a given expression evaluates to true.