简体   繁体   中英

how to make information on a separate line and the command on a new line in zsh?

I used zsh as my command line.

In my zsh, there is too much information (file path, git status) displayed, so that there is very little space for the commands that can be entered on each line.Enclosed by the red rectangle is the space where I can enter commands.

But I don't want to remove the displayed information. Can I make the information on a separate line and the command on a new line when every time hit the enter?

when i echo $PROMPT , the result is:

%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} 

在此处输入图像描述

Your current bash PROMPT is;

%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} 

Lets add some newlines ( $'\n' ) between those values;

export PROMPT="%m %{${fg_bold[blue]}%}::"$'\n'"%{$reset_color%}%{${fg[green]}%}%3~ "$'\n'"$(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%}"

On my local PROMPT this generates:

在此处输入图像描述

( MBP is my local machine-name)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM