Skip to main content
Module

x/denops_std/function/mod.ts>execute

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

Execute an Ex command or commands and return the output as a string. {command} can be a string or a List. In case of a List the lines are executed one by one. This is more or less equivalent to:

redir => var
{command}
redir END

Except that line continuation in {command} is not recognized.

The optional {silent} argument can have these values: "" no :silent used "silent" :silent used "silent!" :silent! used The default is "silent". Note that with "silent!", unlike :redir, error messages are dropped. When using an external command the screen may be messed up, use system() instead.

It is not possible to use :redir anywhere in {command}.

To get a list of lines use split() on the result:

execute('args')->split("\n")

To execute a command in another window than the current one use win_execute().

When used recursively the output of the recursive call is not included in the output of the higher level call.

Can also be used as a method:

GetCommand()->execute()

Parameters

denops: Denops
command: unknown
optional
silent: unknown

Returns

Promise<string>