From 0c627eb31de1b816e98fa17a11ecf675c4e2b366 Mon Sep 17 00:00:00 2001 From: romkatv Date: Tue, 27 Aug 2019 10:57:54 +0200 Subject: add `proxy` prompt segment --- internal/icons.zsh | 5 +++++ internal/p10k.zsh | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'internal') diff --git a/internal/icons.zsh b/internal/icons.zsh index 425e57c5..c74fe909 100755 --- a/internal/icons.zsh +++ b/internal/icons.zsh @@ -112,6 +112,7 @@ function _p9k_init_icons() { LARAVEL_ICON '' RANGER_ICON '\u2B50' # ⭐ TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ + PROXY_ICON '\u21AF' # ↯ ) ;; 'awesome-fontconfig') @@ -211,6 +212,7 @@ function _p9k_init_icons() { LARAVEL_ICON '' RANGER_ICON '\u2B50' # ⭐ TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ + PROXY_ICON '\u21AF' # ↯ ) ;; 'awesome-mapped-fontconfig') @@ -314,6 +316,7 @@ function _p9k_init_icons() { LARAVEL_ICON '' RANGER_ICON '\u2B50' # ⭐ TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ + PROXY_ICON '\u21AF' # ↯ ) ;; 'nerdfont-complete'|'nerdfont-fontconfig') @@ -414,6 +417,7 @@ function _p9k_init_icons() { LARAVEL_ICON '\ue73f' #  RANGER_ICON '\u2B50' # ⭐ TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ + PROXY_ICON '\u21AF' # ↯ ) ;; *) @@ -513,6 +517,7 @@ function _p9k_init_icons() { LARAVEL_ICON '' RANGER_ICON '\u2B50' # ⭐ TERRAFORM_ICON '\U1F6E0\u00A0' # 🛠️ + PROXY_ICON '\u21AF' # ↯ ) ;; esac diff --git a/internal/p10k.zsh b/internal/p10k.zsh index cff575b0..5caaea15 100755 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -3052,6 +3052,16 @@ function prompt_terraform() { [[ $ws == default ]] || _p9k_prompt_segment $0 $_p9k_color1 blue TERRAFORM_ICON 0 '' $ws } +function prompt_proxy() { + local -U p=( + $all_proxy $http_proxy $https_proxy $ftp_proxy + $ALL_PROXY $HTTP_PROXY $HTTPS_PROXY $FTP_PROXY) + p=(${(@)${(@)${(@)p#*://}##*@}%%/*}) + (( $#p )) || return + (( $#p == 1 )) || p=("") + _p9k_prompt_segment $0 $_p9k_color1 blue PROXY_ICON 0 '' "$p[1]" +} + _p9k_preexec() { if (( $+_p9k_real_zle_rprompt_indent )); then if [[ -n $_p9k_real_zle_rprompt_indent ]]; then -- cgit v1.2.3