Sometimes I use multiline commands in zsh
:
❯ echo \ > a \ > multiline \ > command
When editing the command after pulling it from a history search, I can change the content of individual lines. However, I can't figure out how to insert another line:
# I want to insert another line after "multiline"... ❯ echo \ > a \ > multiline \ # but hitting <return> here just runs the command, even though there's a backslash at the end of the line > command
How can I insert a newline in the middle of a multiline command pulled from history?
This is what worked for me. CTRL + C from the current command . Then press the ↑ .
Call it using Alt + X (which executes commands like push-line-or-edit by name) and type in push-line-or-edit and hit Return .
just press the up arrow on your keyboard once or several times!
ZSH is a popular shell built on top of bash. It stores your command history in the . zsh_history file in your home directory.
You can use ESC-Return.
FWIW, I tested it on Debian Jessie, zsh 5.0.7 and it works there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With