From 25f65514bf4733058b3c2f8a1dae026f93c856bf Mon Sep 17 00:00:00 2001 From: srdusr Date: Fri, 23 Jun 2023 17:48:47 +0200 Subject: Improved performance of prompt --- .config/zsh/.zshrc | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to '.config/zsh') diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index ca4787e..aa9e659 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -80,8 +80,8 @@ setopt interactive_comments beep extendedglob nomatch notify completeinword prom ########## Prompt(s) ########## -# Enable colors and change prompt: -autoload -U colors && colors # Load colors +# Enable colors +autoload -U colors && colors # Prompt with Vi insert-mode/normal-mode and blinking '$', note blinking '$' only works on some terminals. terminfo_down_sc=$terminfo[cud1]$terminfo[cuu1]$terminfo[sc]$terminfo[cud1] @@ -102,16 +102,16 @@ git_branch_test_color() { # Job indicator jobs_status_indicator() { - local jobs_output - declare -p jobs_output >/dev/null 2>&1 - if [[ $? -eq 0 ]]; then - unset jobs_output - fi - jobs_output=$(jobs -s) - if [[ -n "$jobs_output" ]]; then - local jobs_count=$(echo "$jobs_output" | wc -l) - echo "jobs: ${jobs_count}" - fi + local jobs_output + declare -p jobs_output >/dev/null 2>&1 + if [[ $? -eq 0 ]]; then + unset jobs_output + fi + jobs_output=$(jobs -s) + if [[ -n "$jobs_output" ]]; then + local jobs_count=$(echo "$jobs_output" | wc -l) + echo "jobs: ${jobs_count}" + fi } remote_indicator() { @@ -128,15 +128,14 @@ zstyle ':vcs_info:*' stagedstr ' +%F{15}staged%f' zstyle ':vcs_info:*' unstagedstr ' -%F{15}unstaged%f' zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' actionformats '%F{5}%F{2}%b%F{3}|%F{1}%a%F{5}%f ' -zstyle ':vcs_info:*' formats \ - '%F{208} '$'\uE0A0'' %f$(git_branch_test_color)%f%F{76}%c%F{3}%u%f ' +zstyle ':vcs_info:*' formats '%F{208} '$'\uE0A0'' %f$(git_branch_test_color)%f%F{76}%c%F{3}%u%f ' zstyle ':vcs_info:git*+set-message:*' hooks git-untracked zstyle ':vcs_info:*' enable git +vi-git-untracked() { if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \ [[ $(git ls-files --other --directory --exclude-standard | sed q | wc -l | tr -d ' ') == 1 ]] ; then - hook_com[unstaged]+='%F{196} !%f%F{15}untracked%f' -fi + hook_com[unstaged]+='%F{196} !%f%F{15}untracked%f' + fi } # Prompt -- cgit v1.2.3