diff options
-rw-r--r-- | conf.d/60-prompt.zsh | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/conf.d/60-prompt.zsh b/conf.d/60-prompt.zsh index 7d46f70..0ec758b 100644 --- a/conf.d/60-prompt.zsh +++ b/conf.d/60-prompt.zsh @@ -74,16 +74,22 @@ git_prompt() { left_prompt() { local last_status=$? + local printed_host= case $USER in "$PRIMARY_USER" | "root") ;; - *) echo -n "$USER " + *) printed_host=1; echo -n "$USER" esac if test -n "$SSH_TTY" \ || [ -f /.dockerenv ]; then zcol "$fg[cyan]" - echo -n "@$(hostname | tr -d '\n') " + echo -n "@$(hostname | tr -d '\n')" + printed_host=1 + fi + + if [ -n "$printed_host" ]; then + echo -n " " fi if test -n "$IN_NIX_SHELL"; then @@ -96,13 +102,8 @@ left_prompt() { echo -n "bwrap " fi - if test -n "$DOCKER_HOST"; then - zcol "$fg[cyan]" - echo -n "$(basename "$DOCKER_HOST") " - fi - zcol "$fg[green]" - { pwd; echo -n " " } | tr -d '\n' | sed -e "s:^$HOME:~:" + { pwd; echo -n " " } | tr -d '\n' | sed -e "s:$HOME:~:" git_prompt |