Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting a newline in a multiline zsh command pulled from history

Tags:

zsh

zsh-zle

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?

like image 424
Sean Mackesey Avatar asked Oct 16 '14 16:10

Sean Mackesey


People also ask

How to go back to previous line in shell script?

This is what worked for me. CTRL + C from the current command . Then press the ↑ .

How do I go to a previous line in putty?

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 .

How do you move up a line in command line?

just press the up arrow on your keyboard once or several times!

Where are zsh commands stored?

ZSH is a popular shell built on top of bash. It stores your command history in the . zsh_history file in your home directory.


1 Answers

You can use ESC-Return.

FWIW, I tested it on Debian Jessie, zsh 5.0.7 and it works there.

like image 78
Kamaraju Kusumanchi Avatar answered Sep 18 '22 08:09

Kamaraju Kusumanchi