Skip to main content
Module

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

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

Executes an Ex command.

Unlike nvim_command() this command takes a structured Dictionary instead of a String. This allows for easier construction and manipulation of an Ex command. This also allows for things such as having spaces inside a command argument, expanding filenames in a command that otherwise doesn't expand filenames, etc. Command arguments may also be Number, Boolean or String.

The first argument may also be used instead of count for commands that support it in order to make their usage simpler with vim.cmd(). For example, instead of vim.cmd.bdelete{ count = 2 }, you may do vim.cmd.bdelete(2).

On execution error: fails with VimL error, updates v:errmsg.

Parameters:

  • {cmd} Command to execute. Must be a Dictionary that can contain the same values as the return value of nvim_parse_cmd() except "addr", "nargs" and "nextcmd" which are ignored if provided. All values except for "cmd" are optional.
  • {opts} Optional parameters. - output: (boolean, default false) Whether to return command output.

Return: Command output (non-error, non-shell :!) if output is true, else empty string.

See also:

  • nvim_exec2()
  • nvim_command()

Parameters

denops: Denops
cmd: unknown
opts: unknown

Returns

Promise<unknown>