使用 key 命令在 zsh 中存储命令

Stash a command in zsh with key command

我运行正在使用 oh-my-zsh。我在命令行上写了一个相当长的提交消息,我在键盘上敲了一些东西导致它消失了。我按了向上键,希望它能留在历史中,但它不在那里。

所以,我抱怨着,重写了提交消息,并且当我执行那个命令时,我之前写的命令填充了命令行,准备编辑。

这有时似乎是一个方便的功能,可以先将命令隐藏到 运行 其他东西。我如何故意这样做?

您可能键入了 Esc-q,它默认绑定到 [=12] 中记录的 push-line 命令=]:

push-line (^Q ESC-Q ESC-q) (unbound) (unbound)
       Push the current buffer onto the  buffer  stack  and  clear  the
       buffer.   Next  time  the  editor  starts up, the buffer will be
       popped off the top of the buffer stack and loaded into the edit-
       ing buffer.