diff options
author | Till Höppner | 2018-04-22 17:02:28 +0200 |
---|---|---|
committer | Till Höppner | 2018-04-24 08:32:29 +0200 |
commit | 8df0b7dba9a6f0b724b1cb8a498939ebba769d6e (patch) | |
tree | 36b94912be27cc6404d506a2ffa17038af94c3a3 /conf.d/60-prompt.zsh | |
parent | be97b387ffa73487055095ca8e0762705bb2ac37 (diff) | |
download | zsh-8df0b7dba9a6f0b724b1cb8a498939ebba769d6e.tar.gz zsh-8df0b7dba9a6f0b724b1cb8a498939ebba769d6e.tar.xz zsh-8df0b7dba9a6f0b724b1cb8a498939ebba769d6e.zip |
More prompt tweaking
Diffstat (limited to 'conf.d/60-prompt.zsh')
-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 |