Home » Questions » Computers [ Ask a new question ]

Default prompt for Zsh in Ubuntu

Default prompt for Zsh in Ubuntu

How can you get the prompt "/home/user@address:/path" for Zsh?

Asked by: Guest | Views: 73
Total answers/comments: 1
Guest [Entry]

"This might be give you what you want (user@host:path):

PROMPT=$'%n@%m:%d%{\e[0m%} '

If you wanted to limit the length of the path (%> from your example), you limit it to only display the last 12 characters like this:

PROMPT=$'%n@%m:%12<...<%d%<<%{\e[0m%} '

If you did not actually want the embedded escape code in there (it is a typical VT100-style command to clear any bold/etc. formatting), you could simplify it to this:

PROMPT='%n@%m:%12<...<%d%<< '"