Home Explore Blog CI



neovim

99th chunk of `runtime/doc/vimfn.txt`
658969e59a290e7391d57332ec9b0d5cdf49e5901c295b7f0000000100000fbf
                                           *remove()*
remove({list}, {idx}, {end})
		Without {end}: Remove the item at {idx} from |List| {list} and
		return the item.
		With {end}: Remove items from {idx} to {end} (inclusive) and
		return a |List| with these items.  When {idx} points to the same
		item as {end} a list with one item is returned.  When {end}
		points to an item before {idx} this is an error.
		See |list-index| for possible values of {idx} and {end}.
		Returns zero on error.
		Example: >vim
			echo "last item: " .. remove(mylist, -1)
			call remove(mylist, 0, 9)
<
		Use |delete()| to remove a file.

                Parameters: ~
                  • {list} (`any[]`)
                  • {idx} (`integer`)
                  • {end} (`integer?`)

                Return: ~
                  (`any`)

remove({blob}, {idx})
remove({blob}, {idx}, {end})
		Without {end}: Remove the byte at {idx} from |Blob| {blob} and
		return the byte.
		With {end}: Remove bytes from {idx} to {end} (inclusive) and
		return a |Blob| with these bytes.  When {idx} points to the same
		byte as {end} a |Blob| with one byte is returned.  When {end}
		points to a byte before {idx} this is an error.
		Returns zero on error.
		Example: >vim
			echo "last byte: " .. remove(myblob, -1)
			call remove(mylist, 0, 9)
<

                Parameters: ~
                  • {blob} (`any`)
                  • {idx} (`integer`)
                  • {end} (`integer?`)

                Return: ~
                  (`any`)

remove({dict}, {key})
		Remove the entry from {dict} with key {key} and return it.
		Example: >vim
			echo "removed " .. remove(dict, "one")
<		If there is no {key} in {dict} this is an error.
		Returns zero on error.

                Parameters: ~
                  • {dict} (`any`)
                  • {key} (`string`)

                Return: ~
                  (`any`)

rename({from}, {to})                                                  *rename()*
		Rename the file by the name {from} to the name {to}.  This
		should also work to move files across file systems.  The
		result is a Number, which is 0 if the file was renamed
		successfully, and non-zero when the renaming failed.
		NOTE: If {to} exists it is overwritten without warning.
		This function is not available in the |sandbox|.

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

                Return: ~
                  (`integer`)

repeat({expr}, {count})                                               *repeat()*
		Repeat {expr} {count} times and return the concatenated
		result.  Example: >vim
			let separator = repeat('-', 80)
<		When {count} is zero or negative the result is empty.
		When {expr} is a |List| or a |Blob| the result is {expr}
		concatenated {count} times.  Example: >vim
			let longlist = repeat(['a', 'b'], 3)
<		Results in ['a', 'b', 'a', 'b', 'a', 'b'].

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

                Return: ~
                  (`any`)

resolve({filename})                                             *resolve()* *E655*
		On MS-Windows, when {filename} is a shortcut (a .lnk file),
		returns the path the shortcut points to in a simplified form.
		On Unix, repeat resolving symbolic links in all path
		components of {filename} and return the simplified result.
		To cope with link cycles, resolving of symbolic links is
		stopped after 100 iterations.
		On other systems, return the simplified {filename}.
		The simplification step is done as by |simplify()|.
		resolve() keeps a leading path component specifying the
		current directory (provided the result is still a relative
		path name) and also keeps a trailing path separator.

                Parameters: ~
                  • {filename} (`string`)

                Return: ~
                  (`string`)

reverse({object})                                                    *reverse()*
		Reverse the order

Title: Remove, Rename, Repeat, Resolve, and Reverse Functions
Summary
This section outlines the functionality of `remove()`, which removes elements from Lists, Blobs, or Dictionaries; `rename()`, which renames files; `repeat()`, which repeats an expression a specified number of times; `resolve()`, which resolves shortcuts and symbolic links; and `reverse()`, which reverses the order of elements in a List or Blob.