kakoune/doc/pages/execeval.asciidoc
Maxime Coste 3d7d0fecca Introduce "local" scope in evaluate-commands
When using `eval` a new scope named 'local' gets pushed for the
whole evaluation, this makes it possible to temporarily set
an option/hook/alias...

Local scopes nest so nested evals do work as expected.

Remove the now trivial with-option command
2024-04-12 15:28:40 +10:00

72 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
*execute-keys* [<switches>] <key> ...::
Run keys as if they were pressed.
*evaluate-commands* [<switches>] <command> ...::
Evaluate specified commands as if they were entered into the command
prompt.
By default, the execution of both commands happens within the context of
the current client, and stops when the last key/command is reached or an
error occurs.
Without the *-save-regs* switch, *execute-keys* saves the following registers, which
are then restored when the keys have been executed: */*, *"*, *|*, *^*,
*@*, *:*. *evaluate-commands* doesn't save any registers by default.
(See <<registers#,`:doc registers`>>)
== Switches for both commands
*-client* <name>::
Execute in the context of the client *name*.
*-try-client* <name>::
Execute in the context of the client *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
making modifications to the buffer without modifying the users
selection.
*-itersel*::
Execute once per selection, each having its own context. This prevents
situations where selections get merged.
*-buffer* <names>::
Execute in the context of each buffer specified in the comma separated
list *names*. `*` can be used as a *name* to iterate over 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).
== Switches specific to *evaluate-commands*
*-no-hooks*::
Disable hook execution while executing the keys/commands.
(See <<hooks#disabling-hooks,`:doc hooks`>>)
*-verbatim*::
Don't reparse and split positional arguments. Forward them exactly
as specified.
== Switches specific to *execute-keys*
*-with-maps*::
Use a custom key mapping instead of the built-in one.
(See <<mapping#,`:doc mapping`>>)
*-with-hooks*::
Execute keys and trigger existing hooks.
(See <<hooks#,`:doc hooks`>>)
== Local scope in *evaluate-commands*
When using *evaluate-commands* a new scope, named `local` is inserted.
See <<scopes#,`:doc scopes`>>