Reputation: 13811
My oh my zsh prompt reads something like:
tenant-application git:(beta-4-1)
I want it to read something like:
homestead tenant-application git:(beta-4-1)
Or something similar where I can understand the hostname of the machine
When I do echo $PROMPT
, it says
${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)
I tried:
export PROMPT=${ret_status} ${hostname} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)
But the error said:
zsh: not an identifier: %{^[[36m%}%c%{^[[00m%}
What am I doing wrong and how to make the right thing permanent?
Upvotes: 7
Views: 18665
Reputation: 523
Add quotes to avoid immediate expansion of your expressions. Further the hostname up to the first dot can be inserted by using %m
or the full hostname with %M
(see http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html)
So this command should work:
export PROMPT='${ret_status} %m %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
To make this permanent you can just add this line to your .zshrc
file in your home directory.
Upvotes: 14