From 557d53ba1f12e17bc487c555eafb78deef4e4230 Mon Sep 17 00:00:00 2001 From: Evan Pratten Date: Mon, 15 Apr 2024 19:37:13 -0400 Subject: [PATCH] Speed improvements on iSH --- configs/shells/zsh/.zshrc | 5 +++++ configs/shells/zsh/prompt.sh | 36 +++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/configs/shells/zsh/.zshrc b/configs/shells/zsh/.zshrc index 45e05d8..1e2c2f8 100644 --- a/configs/shells/zsh/.zshrc +++ b/configs/shells/zsh/.zshrc @@ -2,6 +2,11 @@ # There are some important env vars that need to exist export EWCONFIG_ROOT="$HOME/.config/ewconfig" +# Auto-detect if we are running inside of ISH (IOS Shell) +if [ $(uname -r | grep -c "\-ish$") -gt 0 ]; then + export EWCONFIG_IN_ISH=1 +fi + # Load my custom prompt and macros . $EWCONFIG_ROOT/configs/shells/zsh/prompt.sh . $EWCONFIG_ROOT/configs/shells/zsh/macros.sh diff --git a/configs/shells/zsh/prompt.sh b/configs/shells/zsh/prompt.sh index d107017..a1986c4 100644 --- a/configs/shells/zsh/prompt.sh +++ b/configs/shells/zsh/prompt.sh @@ -29,20 +29,26 @@ fi # Add the common prompt parts export PROMPT="${PROMPT}%{$fg[cyan]%}%~ ${USER_ICON} %{$reset_color%}" setopt prompt_subst -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{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f ' -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' -zstyle ':vcs_info:*' enable git cvs svn +# Don't bother rendering VCS info on weak systems. Just fallback to the time and status +if [ -n "$EWCONFIG_IN_ISH" ]; then + 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{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f ' + zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' -# or use pre_cmd, see man zshcontrib -vcs_info_wrapper() { - vcs_info - if [ -n "$vcs_info_msg_0_" ]; then - echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del" - fi -} -export RPROMPT=$'%T $(vcs_info_wrapper)%?' + zstyle ':vcs_info:*' enable git cvs svn + + # or use pre_cmd, see man zshcontrib + vcs_info_wrapper() { + vcs_info + if [ -n "$vcs_info_msg_0_" ]; then + echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del" + fi + } + export RPROMPT=$'%T $(vcs_info_wrapper)%?' +else + export RPROMPT=$'%T %?' +fi \ No newline at end of file