Skip to main content
Module

x/denops_std/function/mod.ts>histdel

📚 Standard module for denops.vim
Go to Latest
function histdel
import { histdel } from "https://deno.land/x/denops_std@v6.3.0/function/mod.ts";

Clear {history}, i.e. delete all its entries. See hist-names for the possible values of {history}.

If the parameter {item} evaluates to a String, it is used as a regular expression. All entries matching that expression will be removed from the history (if there are any). Upper/lowercase must match, unless "\c" is used /\c. If {item} evaluates to a Number, it will be interpreted as an index, see :history-indexing. The respective entry will be removed if it exists.

The result is TRUE for a successful operation, otherwise FALSE is returned.

Examples: Clear expression register history:

:call histdel("expr")

Remove all entries starting with "*" from the search history:

:call histdel("/", '^\*')

The following three are equivalent:

:call histdel("search", histnr("search"))
:call histdel("search", -1)
:call histdel("search", '^' .. histget("search", -1) .. '$')

To delete the last search pattern and use the last-but-one for the "n" command and 'hlsearch':

:call histdel("search", -1)
:let @/ = histget("search", -1)

Can also be used as a method:

GetHistory()->histdel()

Parameters

denops: Denops
history: unknown
optional
item: unknown

Returns

Promise<number>