Stash a command in zsh with key command

591 Views Asked by At

I'm running using oh-my-zsh. I was writing a fairly long commit message on the command line, and I hit something on the keyboard that caused it to disappear. I pushed the up key, hoping it would remain in the history, but it was not there.

So, I grumbled, rewrote the commit message, and as soon as I executed that command, the command I was writing before populated the command line, ready for editing.

This seems like a handy feature occasionally, to stash a command to run something else first. How do I do this on purpose?

1

There are 1 best solutions below

0
On BEST ANSWER

You probably typed Esc-q, which is bound by default to the push-line command documented in man zshzle:

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.