From 0ec0e95ee1261d79e435ea7d5ae487c741a0ed06 Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 9 Dec 2021 16:00:22 +0100 Subject: [PATCH] shorten pwd if it gets too long and other small changes --- zsh/.zshrc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/zsh/.zshrc b/zsh/.zshrc index 631d822..ea6c9d5 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -49,18 +49,19 @@ zstyle ':vcs_info:*' formats "[%{$fg_bold[cyan]%}%b%{$reset_color%}]" zstyle ':vcs_info:*' actionformats "[%{$fg_bold[cyan]%}%b%{$reset_color%}|%a]" if [[ -f /run/.containerenv && -f /run/.toolboxenv ]]; then - TOOLBOX="%F{13}⬢%f " + PREFIX="%F{13}⬢%f" +elif [[ "$NIX_PATH" && "$NIX_PROFILES" && "$NIX_CONF_DIR" ]]; then + PREFIX="%F{4}❄%f" else - TOOLBOX="" + PREFIX="" fi -if [[ "$NIX_PATH" && "$NIX_PROFILES" && "$NIX_CONF_DIR" ]]; then - NIX_CHROOT="%F{4}❄%f " -else - NIX_CHROOT="" -fi +# cut shown $PWD if depth is 5 or more ('~' counts) +TRUNCATED_PWD="%(5~|.../%3~|%~)" +# cut shown $PWD after 20 characters +#TRUNCATED_PWD="%20<...<%~%<<" -PROMPT="${NIX_CHROOT}${TOOLBOX}(%M) %~ %{$fg[red]%}%(#~#~$)%{$reset_color%} " +PROMPT="${PREFIX} (%M) ${TRUNCATED_PWD} %{$fg[red]%}%(#~#~$)%{$reset_color%} " RPROMPT="\$vcs_info_msg_0_" precmd () {