From c137cf2b48865125449cee38302b66da190468b9 Mon Sep 17 00:00:00 2001 From: Yogeshwaran Rajendran Date: Sun, 28 Jul 2024 17:21:36 +0530 Subject: [PATCH] Update agnoster theme add plugins --- .gitmodules | 6 ++++++ custom/plugins/zsh-autosuggestions | 1 + custom/plugins/zsh-syntax-highlighting | 1 + themes/agnoster.zsh-theme | 29 ++++++++++++++++++-------- 4 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 .gitmodules create mode 160000 custom/plugins/zsh-autosuggestions create mode 160000 custom/plugins/zsh-syntax-highlighting diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..a05327622 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "custom/plugins/zsh-autosuggestions"] + path = custom/plugins/zsh-autosuggestions + url = https://github.com/zsh-users/zsh-autosuggestions +[submodule "custom/plugins/zsh-syntax-highlighting"] + path = custom/plugins/zsh-syntax-highlighting + url = https://github.com/zsh-users/zsh-syntax-highlighting.git diff --git a/custom/plugins/zsh-autosuggestions b/custom/plugins/zsh-autosuggestions new file mode 160000 index 000000000..c3d4e576c --- /dev/null +++ b/custom/plugins/zsh-autosuggestions @@ -0,0 +1 @@ +Subproject commit c3d4e576c9c86eac62884bd47c01f6faed043fc5 diff --git a/custom/plugins/zsh-syntax-highlighting b/custom/plugins/zsh-syntax-highlighting new file mode 160000 index 000000000..e0165eaa7 --- /dev/null +++ b/custom/plugins/zsh-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit e0165eaa730dd0fa321a6a6de74f092fe87630b0 diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index adeffe8c2..545eb3c81 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -165,7 +165,7 @@ git_toplevel() { # Context: user@hostname (who am I and where am I) prompt_context() { if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then - prompt_segment "$AGNOSTER_CONTEXT_BG" "$AGNOSTER_CONTEXT_FG" "%(!.%{%F{$AGNOSTER_STATUS_ROOT_FG}%}.)%n@%m" + prompt_segment black default "%(!.%{%F{yellow}%}.)%n" fi } @@ -304,12 +304,7 @@ prompt_hg() { # Dir: current working directory prompt_dir() { - if [[ $AGNOSTER_GIT_INLINE == 'true' ]] && $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then - # Git repo and inline path enabled, hence only show the git root - prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" "$(git_toplevel | sed "s:^$HOME:~:")" - else - prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" '%~' - fi + prompt_segment blue $CURRENT_FG '%2d' } # Virtualenv: current working virtualenv @@ -345,16 +340,32 @@ prompt_status() { prompt_aws() { [[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return case "$AWS_PROFILE" in - *-prod|*production*) prompt_segment "$AGNOSTER_AWS_PROD_BG" "$AGNOSTER_AWS_PROD_FG" "AWS: ${AWS_PROFILE:gs/%/%%}" ;; - *) prompt_segment "$AGNOSTER_AWS_BG" "$AGNOSTER_AWS_FG" "AWS: ${AWS_PROFILE:gs/%/%%}" ;; + *prod|*production*) prompt_segment red black "AWS: ${AWS_PROFILE:gs/%/%%}" ;; + *) prompt_segment green black "AWS: ${AWS_PROFILE:gs/%/%%}" ;; esac } +prompt_shell() { + [[ -z "$SHELL_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return + local ENV_PRPT="$SHELL_PROFILE" + case "$TERA_PROFILE" in + *qa*) ENV_PRPT="${SHELL_PROFILE}-qa" ;; + *stage*) ENV_PRPT="${SHELL_PROFILE}-st" ;; + esac + case "$SHELL_PROFILE" in + *prod|*production*) + prompt_segment red black "${ENV_PRPT:gs/%/%%}" ;; + *dev*) + prompt_segment green black "${ENV_PRPT:gs/%/%%}" ;; + # *) prompt_segment green black "" ;; + esac +} ## Main prompt build_prompt() { RETVAL=$? prompt_status prompt_virtualenv + prompt_shell prompt_aws prompt_context prompt_dir