Zsh plugin is to enable to run typed zsh command without triggering a new prompt and saving the query to the history
This plugins define 3 zle
widgets:
quiet-accept-line
bound to C-x RET/C-x C-m: run the current typed command, without output a new promptsilent-accept-line
bound to C-x C-j: run the current typed command, without output a new prompt. output wil be suppressedlast-quiet-accept-line
bound to C-x C-k: restore to the prompt the last command that was run with `quiet/silent-accept-line``
Optionaly status code of the quietly runned command can be display.
To do so, set ZLE_QAL_STATUS_DISPLAY
to true
, on
or yes
.
(QAL
stands for Quiet Accept Line)
Just source quiet-accept-line content, or if you use a plugin manager set adrieankhisbe/zsh-quiet-accept-line
as plugin:
- for antigen, just add zsh-quiet-accept-line to your bundles as
adrieankhisbe/zsh-quiet-accept-line
antigen bundle adrieankhisbe/zsh-quiet-accept-line
- for zplug, add
zplug "adrieankhisbe/zsh-quiet-accept-line"
Keys can be configured based on the following variables: ZLE_QAL_QUIET_KEY
, ZLE_QAL_SILENT_KEY
, and ZLE_QAL_LAST_KEY
. (default being ^X^M
, ^X^J
and ^X^K
)
Output of the status code can be customized with the following variable:
ZLE_QAL_STATUS_DURATION
: how long status is displayed, blocking the prompt (default 0.5s)ZLE_QAL_STATUS_OK
: what is output for successful command (default greenβ
with prompt color escape%{%}
)ZLE_QAL_STATUS_KO
: what is output for failing command (default redβ
with prompt color escape%{%}
) note that status is saved toZLE_QAL_STATUS
variable
This plugin was driven by the need to improve tmux-resurrect zsh history saving that was poluting terminal with fc
commands.
After some research I end up on the following stack overflow question, that inspired the initial implementation.