Merge remote-tracking branch 'Pound-Hash/execeval'

This commit is contained in:
Maxime Coste 2022-07-28 21:18:39 +10:00
commit de683fea3b

View File

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