zsh new line prompt after each command

A variant of some existing solutions, which I find neater than using a magic variable and conditional:

precmd() {
    precmd() {
        echo
    }
}

This puts a blank line before every prompt except the first one: all the first precmd invocation does is replace precmd with a function that calls echo.


Edit ~/.zshrc and add the line precmd() { print "" }. This will simply print an empty line before the PROMPT is rendered.


Another way is by just setting a custom prompt in ~/.zshrc that includes a newline character. For example:

autoload -Uz promptinit
promptinit

PROMPT="
%n@%m:%~ $ "

Tags:

Zsh

Zsh Zle