From 201e9dea594ea0a477370ae8dba6d09f9ae79149 Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Thu, 24 Feb 2022 13:52:52 +0100 Subject: fix(michelebologna): use `$HOST` variable instead of running `hostname` (#10724) --- themes/michelebologna.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'themes') diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme index 7ff6a7ffe..bb567b3d8 100644 --- a/themes/michelebologna.zsh-theme +++ b/themes/michelebologna.zsh-theme @@ -40,7 +40,7 @@ local username_root_color=$red local hostname_root_color=$red # calculating hostname color with hostname characters -for i in `hostname`; local hostname_normal_color=$color_array[$[((#i))%7+1]] +for i in $HOST; local hostname_normal_color=$color_array[$[((#i))%7+1]] local -a hostname_color hostname_color=%(!.$hostname_root_color.$hostname_normal_color) -- cgit v1.2.3-70-g09d2 From 28dc8c58ef14325d94feb7f34616839c7975e7d0 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 23 Feb 2022 19:55:33 +0100 Subject: refactor(michelebologna): simplify and clean up code --- themes/michelebologna.zsh-theme | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'themes') diff --git a/themes/michelebologna.zsh-theme b/themes/michelebologna.zsh-theme index bb567b3d8..bb86d68db 100644 --- a/themes/michelebologna.zsh-theme +++ b/themes/michelebologna.zsh-theme @@ -35,23 +35,17 @@ local reset="%{$reset_color%}" local -a color_array color_array=($green $red $cyan $yellow $blue $magenta $white) -local username_normal_color=$white -local username_root_color=$red -local hostname_root_color=$red - -# calculating hostname color with hostname characters -for i in $HOST; local hostname_normal_color=$color_array[$[((#i))%7+1]] -local -a hostname_color -hostname_color=%(!.$hostname_root_color.$hostname_normal_color) - +local username_color=$white +local hostname_color=$color_array[$[((#HOST))%7+1]] # choose hostname color based on first character local current_dir_color=$blue -local username_command="%n" -local hostname_command="%m" + +local username="%n" +local hostname="%m" local current_dir="%~" -local username_output="%(!..$username_normal_color$username_command$reset@)" -local hostname_output="$hostname_color$hostname_command$reset" -local current_dir_output="$current_dir_color$current_dir$reset" +local username_output="%(!..${username_color}${username}${reset}@)" +local hostname_output="${hostname_color}${hostname}${reset}" +local current_dir_output="${current_dir_color}${current_dir}${reset}" local jobs_bg="${red}fg: %j$reset" local last_command_output="%(?.%(!.$red.$green).$yellow)" @@ -68,8 +62,18 @@ ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">" ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<" ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="$red<>" -PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)' -GIT_PROMPT='$(out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status);if [[ -n $out ]]; then printf %s " $white($green$out$white)$reset";fi)' -PROMPT+="$GIT_PROMPT" +function michelebologna_git_prompt { + local out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status) + [[ -n $out ]] || return + printf " %s(%s%s%s)%s" \ + "%{$fg_bold[white]%}" \ + "%{$fg_bold[green]%}" \ + "$out" \ + "%{$fg_bold[white]%}" \ + "%{$reset_color%}" +} + +PROMPT="$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)" +PROMPT+='$(michelebologna_git_prompt)' PROMPT+=" $last_command_output%#$reset " RPROMPT='' -- cgit v1.2.3-70-g09d2 From 04b1b75b9da2d0295c40e12e01ed222a4f00ec39 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 3 Mar 2022 17:48:31 +0100 Subject: style: remove VCS_INFO svn settings from themes that don't enable it --- themes/jnrowe.zsh-theme | 1 - themes/linuxonly.zsh-theme | 1 - themes/trapd00r.zsh-theme | 1 - 3 files changed, 3 deletions(-) (limited to 'themes') diff --git a/themes/jnrowe.zsh-theme b/themes/jnrowe.zsh-theme index 9d8fb2488..5a5ab349f 100644 --- a/themes/jnrowe.zsh-theme +++ b/themes/jnrowe.zsh-theme @@ -4,7 +4,6 @@ autoload -Uz vcs_info zstyle ':vcs_info:*' actionformats \ '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' zstyle ':vcs_info:*' formats '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f ' -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' zstyle ':vcs_info:*' enable git add-zsh-hook precmd prompt_vcs diff --git a/themes/linuxonly.zsh-theme b/themes/linuxonly.zsh-theme index 2afae8fc3..98572b904 100644 --- a/themes/linuxonly.zsh-theme +++ b/themes/linuxonly.zsh-theme @@ -28,7 +28,6 @@ zstyle ':vcs_info:*' actionformats \ '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' zstyle ':vcs_info:*' formats \ "%{$c8%}%s%{$c7%}:%{$c7%}(%{$c9%}%b%{$c7%})%f " -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' zstyle ':vcs_info:*' enable git add-zsh-hook precmd prompt_jnrowe_precmd diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme index 849daf30b..260c9e701 100644 --- a/themes/trapd00r.zsh-theme +++ b/themes/trapd00r.zsh-theme @@ -102,7 +102,6 @@ zstyle ':vcs_info:*' actionformats \ zstyle ':vcs_info:*' formats \ "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f " -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' zstyle ':vcs_info:*' enable git add-zsh-hook precmd prompt_jnrowe_precmd -- cgit v1.2.3-70-g09d2 From 46195d3aa7b21c2477e3ddacd57ac82856b3be76 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 3 Mar 2022 17:53:03 +0100 Subject: fix: fix svn branch output in themes: apple, gentoo, kolo, zhann (#10751) Fixes #10751 --- themes/apple.zsh-theme | 18 +++++++----------- themes/gentoo.zsh-theme | 4 +++- themes/kolo.zsh-theme | 16 +++++++++------- themes/zhann.zsh-theme | 16 +++++++++------- 4 files changed, 28 insertions(+), 26 deletions(-) (limited to 'themes') diff --git a/themes/apple.zsh-theme b/themes/apple.zsh-theme index 95e6249fa..0c183258e 100644 --- a/themes/apple.zsh-theme +++ b/themes/apple.zsh-theme @@ -2,27 +2,23 @@ function toon { echo -n "" } -get_git_dirty() { - git diff --quiet || echo '*' -} - autoload -Uz vcs_info zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes -zstyle ':vcs_info:*' actionformats \ - '%F{5}%F{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f ' -zstyle ':vcs_info:*' formats \ - '%F{5}%F{5}[%F{2}%b%c%u%F{5}]%f ' -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' actionformats '%F{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f ' +zstyle ':vcs_info:*' formats '%F{5}[%F{2}%b%c%u%F{5}]%f ' +zstyle ':vcs_info:svn:*' branchformat '%b' +zstyle ':vcs_info:svn:*' actionformats '%F{5}[%F{2}%b%F{1}:%F{3}%i%F{3}|%F{1}%a%c%u%F{5}]%f ' +zstyle ':vcs_info:svn:*' formats '%F{5}[%F{2}%b%F{1}:%F{3}%i%c%u%F{5}]%f ' zstyle ':vcs_info:*' enable git cvs svn theme_precmd () { - vcs_info + vcs_info } setopt prompt_subst PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}' autoload -U add-zsh-hook -add-zsh-hook precmd theme_precmd \ No newline at end of file +add-zsh-hook precmd theme_precmd diff --git a/themes/gentoo.zsh-theme b/themes/gentoo.zsh-theme index 7ac461036..b1aef21df 100644 --- a/themes/gentoo.zsh-theme +++ b/themes/gentoo.zsh-theme @@ -6,7 +6,9 @@ zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unst zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes zstyle ':vcs_info:*' actionformats '%F{5}(%F{2}%b%F{3}|%F{1}%a%c%u%m%F{5})%f ' zstyle ':vcs_info:*' formats '%F{5}(%F{2}%b%c%u%m%F{5})%f ' -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:svn:*' branchformat '%b' +zstyle ':vcs_info:svn:*' actionformats '%F{5}(%F{2}%b%F{1}:%{3}%i%F{3}|%F{1}%a%c%u%m%F{5})%f ' +zstyle ':vcs_info:svn:*' formats '%F{5}(%F{2}%b%F{1}:%F{3}%i%c%u%m%F{5})%f ' zstyle ':vcs_info:*' enable git cvs svn zstyle ':vcs_info:git*+set-message:*' hooks untracked-git diff --git a/themes/kolo.zsh-theme b/themes/kolo.zsh-theme index 51b0af724..e07be75c4 100644 --- a/themes/kolo.zsh-theme +++ b/themes/kolo.zsh-theme @@ -3,16 +3,18 @@ autoload -Uz vcs_info zstyle ':vcs_info:*' stagedstr '%F{green}●' zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' zstyle ':vcs_info:*' check-for-changes true -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' +zstyle ':vcs_info:svn:*' branchformat '%b' +zstyle ':vcs_info:svn:*' formats ' [%b%F{1}:%F{11}%i%c%u%B%F{green}]' zstyle ':vcs_info:*' enable git svn + theme_precmd () { - if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { - zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' - } else { - zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]' - } + if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + zstyle ':vcs_info:git:*' formats ' [%b%c%u%B%F{green}]' + else + zstyle ':vcs_info:git:*' formats ' [%b%c%u%B%F{red}●%F{green}]' + fi - vcs_info + vcs_info } setopt prompt_subst diff --git a/themes/zhann.zsh-theme b/themes/zhann.zsh-theme index 27597ec6c..a00650ac8 100644 --- a/themes/zhann.zsh-theme +++ b/themes/zhann.zsh-theme @@ -3,16 +3,18 @@ autoload -Uz vcs_info zstyle ':vcs_info:*' stagedstr '%F{green}●' zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' zstyle ':vcs_info:*' check-for-changes true -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' +zstyle ':vcs_info:svn:*' branchformat '%b' +zstyle ':vcs_info:svn:*' formats ' [%b%F{1}:%F{11}%i%c%u%B%F{green}]' zstyle ':vcs_info:*' enable git svn + theme_precmd () { - if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { - zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' - } else { - zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]' - } + if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + zstyle ':vcs_info:git:*' formats ' [%b%c%u%B%F{green}]' + else + zstyle ':vcs_info:git:*' formats ' [%b%c%u%B%F{red}●%F{green}]' + fi - vcs_info + vcs_info } setopt prompt_subst -- cgit v1.2.3-70-g09d2