kakoune/doc/pages/execeval.asciidoc
Maxime Coste a49ae162f4 Add a -verbatim switch to evaluate-commands for perfect forwarding
-verbatim will disable argument parsing in evaluate-commands, making
it possible to forward a single command to a different context without
triggering a reparsing of the arguments.

Fixes -try-client support in grep.kak

Closes #3153
2019-10-23 22:30:23 +11:00

71 lines
2.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

= Execute-keys and Evaluate-commands
== Description
The *execute-keys* and *evaluate-commands* commands can be used to run
Kakoune commands:
----------------------------
execute-keys [<switches>] <key> ...
evaluate-commands [<switches>] <command> ...
----------------------------
*execute-keys* runs keys as if they were pressed, whereas *evaluate-commands*
evaluates its given parameters as if they were entered in the command prompt.
By default, their execution happens within the context of the current client,
and stops when the last key/command is reached, or an error is raised.
*execute-keys* also save the following registers, who are then restored
when the commands have been executed: */*, *"*, *|*, *^*, *@*.
*evaluate-commands* does not save any registers by default.
(See <<registers#,`:doc registers`>>)
== Optional switches
*-client* <name>::
execute in the context of the client named *name*
*-try-client* <name>::
execute in the context of the client named *name* if such client
exists, or else in the current context
*-draft*::
execute in a copy of the context of the selected client. Modifications
to the selections or input state will not affect the client. This
permits to make some modification to the buffer without modifying
the users selection
*-itersel*::
execute once per selection, in a context with only the considered
selection. This permits avoiding cases where the selections may
get merged
*-buffer* <names>::
execute in the context of each buffers in the comma separated list
*names*. `*` as a name can be used to iterate on all non-debug buffers
(See <<buffers#debug-buffers, `:doc buffers`>>)
*-save-regs* <regs>::
regs is a string of registers to be restored after execution (overwrites
the list of registers saved by default, c.f. description)
== evaluate-commands specific switches
*-no-hooks*::
disable hook execution while executing the keys/commands
(See <<hooks#disabling-hooks,`:doc hooks`>>)
*-verbatim*::
do not reparse and split positional arguments. Forward them
exactly as given to the `evaluate-commands` command.
== execute-keys specific switches
*-with-maps*::
use user key mapping in instead of built in keys
(See <<mapping#,`:doc mapping`>>)
*-with-hooks*::
the execution of keys will trigger existing hooks
(See <<hooks#,`:doc hooks`>>)