Skip to main content
Module

x/denops_std/function/mod.ts>getreg

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

The result is a String, which is the contents of register {regname}. Example:

:let cliptext = getreg('*')

When register {regname} was not set the result is an empty string. The {regname} argument must be a string.

getreg('=') returns the last evaluated value of the expression register. (For use in maps.) getreg('=', 1) returns the expression itself, so that it can be restored with setreg(). For other registers the extra argument is ignored, thus you can always give it.

If {list} is present and TRUE, the result type is changed to List. Each list item is one text line. Use it if you care about zero bytes possibly present inside register: without third argument both NLs and zero bytes are represented as NLs (see NL-used-for-Nul). When the register was not set an empty list is returned.

If {regname} is "", the unnamed register '"' is used. If {regname} is not specified, v:register is used. In Vim9-script {regname} must be one character.

Can also be used as a method:

GetRegname()->getreg()

Parameters

denops: Denops
optional
regname: unknown
optional
v1: unknown
optional
list: unknown

Returns

Promise<string | unknown[]>