import { fn } from "https://deno.land/x/ddu_vim@v4.0.0/deps.ts";
const { execute } = fn;
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()