From ccd82b623514c0be80ed154b6119ccbe1388121d Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Thu, 29 Jun 2023 23:05:17 +0200 Subject: Improve prompt colouring if user is root --- tw/home/files/prompt.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tw/home') diff --git a/tw/home/files/prompt.zsh b/tw/home/files/prompt.zsh index 7cc7342b..e582eb9b 100644 --- a/tw/home/files/prompt.zsh +++ b/tw/home/files/prompt.zsh @@ -89,7 +89,7 @@ prompt_fast_precmd () { local genv_short=${GUIX_ENVIRONMENT##*/} genv_short=${genv_short:0:5} local italic=$'\e[03m' - PROMPT="${TMUX+%F{green\}t }${GUIX_ENVIRONMENT+%F{11\}${genv_short}%u }$prompt_fast_jobs$prompt_fast_host%F{blue}$(prompt_fast_pwd)%F{8}$vcs_info_str$(prompt_fast_git_dirty) %F{yellow}$(prompt_fast_cmd_exec_time)%(?..%B%F{red}%?%f%b )%(?.%F{blue}.%B%F{red})$vimode%#%s%u%f%k%b " + PROMPT="${TMUX+%F{yellow\}t }${GUIX_ENVIRONMENT+%F{11\}${genv_short}%u }$prompt_fast_jobs$prompt_fast_host%F{blue}$(prompt_fast_pwd)%F{8}$vcs_info_str$(prompt_fast_git_dirty) %F{yellow}$(prompt_fast_cmd_exec_time)%(?..%B%F{red}%?%f%b )%(?.%F{blue}.%B%F{red})$vimode%#%s%u%f%k%b " unset cmd_timestamp # reset value since `preexec` isn't always triggered } @@ -117,7 +117,10 @@ prompt_fast_setup () { if [ -n "$SSH_CONNECTION" ]; then prompt_fast_title_host=' - %n@%m' - prompt_fast_host='%F{yellow}%n@%m:' + prompt_fast_host='%(!.%F{red}.%F{green})%n@%m:' + else + prompt_fast_title_host='%(!. - %n@%m.)' + prompt_fast_host='%(!.%F{red}%n@%m:.)' fi return 0 -- cgit v1.2.3