Skip to main content
Module

x/denops_std/function/mod.ts>histget

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

The result is a String, the entry with Number {index} from {history}. See hist-names for the possible values of {history}, and :history-indexing for {index}. If there is no such entry, an empty String is returned. When {index} is omitted, the most recent item from the history is used.

Examples: Redo the second last search from history.

:execute '/' .. histget("search", -2)

Define an Ex command ":H {num}" that supports re-execution of the **{num}**th entry from the output of :history.

:command -nargs=1 H execute histget("cmd", 0+<args>)

Can also be used as a method:

GetHistory()->histget()

Parameters

denops: Denops
history: unknown
optional
index: unknown

Returns

Promise<string>