Skip to main content
Module

x/denops_std/function/nvim/mod.ts>nvim_paste

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

Pastes at cursor, in any mode.

Invokes the vim.paste handler, which handles each mode appropriately. Sets redo/undo. Faster than nvim_input(). Lines break at LF ("\n").

Errors ('nomodifiable', vim.paste() failure, …) are reflected in err but do not affect the return value (which is strictly decided by vim.paste()). On error, subsequent calls are ignored ("drained") until the next paste is initiated (phase 1 or -1).

Attributes: not allowed when textlock is active

Parameters:

  • {data} Multiline input. May be binary (containing NUL bytes).
  • {crlf} Also break lines at CR and CRLF.
  • {phase} -1: paste in a single call (i.e. without streaming). To "stream" a paste, call nvim_paste sequentially with these phase values: - 1: starts the paste (exactly once) - 2: continues the paste (zero or more times) - 3: ends the paste (exactly once)

Return:

- true: Client may continue pasting.
- false: Client must cancel the paste.

Parameters

denops: Denops
data: unknown
crlf: unknown
phase: unknown

Returns

Promise<unknown>