From 8df0b7dba9a6f0b724b1cb8a498939ebba769d6e Mon Sep 17 00:00:00 2001 From: Till Höppner Date: Sun, 22 Apr 2018 17:02:28 +0200 Subject: More prompt tweaking --- conf.d/60-prompt.zsh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'conf.d') 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 -- cgit v1.2.3