From 9a21a794fe044afb26fea24816f997ddb7fc1412 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Mon, 25 Jul 2022 01:23:43 -0400 Subject: [PATCH] improve zsh theme --- bash_tools/theme_zsh.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bash_tools/theme_zsh.sh b/bash_tools/theme_zsh.sh index de11bd1..f0966a7 100644 --- a/bash_tools/theme_zsh.sh +++ b/bash_tools/theme_zsh.sh @@ -1,5 +1,6 @@ # Autoload zsh add-zsh-hook and vcs_info functions (-U autoload w/o substition, -z use zsh style) autoload -Uz add-zsh-hook vcs_info +autoload -U colors && colors # Enable substitution in the prompt. setopt prompt_subst # Run vcs_info just before a prompt is displayed (precmd) @@ -10,7 +11,13 @@ zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' unstagedstr ' *' zstyle ':vcs_info:*' stagedstr ' +' # Set the format of the Git information for vcs_info -zstyle ':vcs_info:git:*' formats '%F{green}(%b%F{red}%u%c%f%F{green})%f' + +# 3-Digit codes for various colors: +# https://unix.stackexchange.com/a/124409/194343 + +vcs_info='%F{166}(%b%F{204}%u%c%f%F{166})%f' +zstyle ':vcs_info:git:*' formats $vcs_info + zstyle ':vcs_info:git:*' actionformats '(%b|%a%u%c)' #export PS1='%F{green}%1~ %F{cyan}${vcs_info_msg_0_}%f ' @@ -18,13 +25,14 @@ zstyle ':vcs_info:git:*' actionformats '(%b|%a%u%c)' local user="%B%(!.%F{red}.%F{green})%n%f " local user_symbol='%(!.#.$)' -local current_dir="%B%F{cyan}%~ %f" - +local current_dir="%B%~ %b" local vcs_branch='${vcs_info_msg_0_}' #PROMPT="╭─${user}${current_dir}${vcs_branch} #╰─%B${user_symbol}%b " -PROMPT="%F{magenta}› ${current_dir}${vcs_branch} " +#PROMPT="%F{magenta}› ${current_dir}${vcs_branch} " + +PROMPT=" %F{106}${current_dir}%f${vcs_branch} "