X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=zsh%2Frc;h=4cd696785c37fc1f05edce10e59303bef7a61be2;hb=3e59553875e1437208fe0d3873cfcdafed34676c;hp=8b5a333ccdbbf066c53f68bc5a69e96c31612c6b;hpb=7c8df26e7c76c966e998d1eb9408846ba3fa62fa;p=config%2Fdotfiles.git diff --git a/zsh/rc b/zsh/rc index 8b5a333..4cd6967 100644 --- a/zsh/rc +++ b/zsh/rc @@ -418,6 +418,8 @@ zshrc_prompt_precmd() { local background="%(1j.${yellow}%j${default}.)" # Exit code in bright red in parentheses if not zero. local exitcode="%(?..(${red}%B%?%b${default}%) )" + # Prompt symbol, % for normal users, # in red for root. + local symbol="%(!.${red}#${default}.%%)" # Prefix characters in first and second line. local top_prefix="${blue}%B.-%b${default}" @@ -452,7 +454,7 @@ zshrc_prompt_precmd() { local top_separator="%B${blue}${(l:${width}::-:)}%b${default}" PROMPT="${top_prefix}${top_left}${top_separator}${top_right} -${bottom_prefix}${user}@${host} ${background}%# ${exitcode}" +${bottom_prefix}${user}@${host} ${background}${symbol} ${exitcode}" } precmd_functions+=(zshrc_prompt_precmd) @@ -853,6 +855,15 @@ source_config ~/.zsh/rc.local # RUN COMMANDS +# Make sure the multiplexer is available. Otherwise the exec terminates our +# session. +if [[ -n $zshrc_use_multiplexer ]]; then + if ! (( $+commands[$zshrc_use_multiplexer] )); then + echo "Multiplexer '$zshrc_use_multiplexer' not found." >&2 + zshrc_use_multiplexer= + fi +fi + # If not already in screen or tmux, reattach to a running session or create a # new one. This also starts screen/tmux on a remote server when connecting # through ssh.