Zsh - adding a new line in a prompt

less than 1 minute read

The following example will show how to add a newline in zsh prompt.

Update the .zshrc file with below environment variable. Please remove backslash on %, Jekyll cannot parse without a back slash.

1
2
NEWLINE=$'\n'
export PROMPT='%(?:%{\%}➜ :%{\%}➜ ) %{$fg[cyan]%}%~%{$reset_color%} $(git_prompt_info)${NEWLINE}$ '

Example

1
2
➜ ~/dev/src/rust/rust-cell git:(master)$

vim mode in .zshrc

1
2
bindkey -v
bindkey '^R' history-incremental-search-backward

Categories:

Updated: