Adding `ssh` segment back with some minor changes.

This commit is contained in:
Ben Hilburn 2017-02-13 22:07:23 -05:00
parent f68e055f3b
commit 3de352b296
3 changed files with 10 additions and 1 deletions

View File

@ -102,7 +102,7 @@ The segments that are currently available are:
* `swap` - Prints the current swap size. * `swap` - Prints the current swap size.
* [`time`](#time) - System time. * [`time`](#time) - System time.
* [`vi_mode`](#vi_mode)- Your prompt's Vi editing mode (NORMAL|INSERT). * [`vi_mode`](#vi_mode)- Your prompt's Vi editing mode (NORMAL|INSERT).
* `SSH` - Additional Identifier for SSH Sessions. * `ssh` - Indicates whether or not you are in an SSH session.
**Development Environment Segments:** **Development Environment Segments:**
* [`vcs`](#vcs) - Information about this `git` or `hg` repository (if you are in one). * [`vcs`](#vcs) - Information about this `git` or `hg` repository (if you are in one).

View File

@ -79,6 +79,7 @@ case $POWERLEVEL9K_MODE in
SWIFT_ICON '' SWIFT_ICON ''
PUBLIC_IP_ICON '' PUBLIC_IP_ICON ''
LOCK_ICON $'\UE138' #  LOCK_ICON $'\UE138' # 
SSH_ICON '(ssh)'
) )
;; ;;
'awesome-fontconfig') 'awesome-fontconfig')
@ -140,6 +141,7 @@ case $POWERLEVEL9K_MODE in
SWIFT_ICON '' SWIFT_ICON ''
PUBLIC_IP_ICON '' PUBLIC_IP_ICON ''
LOCK_ICON $'\UE138' #  LOCK_ICON $'\UE138' # 
SSH_ICON '(ssh)'
) )
;; ;;
*) *)
@ -201,6 +203,7 @@ case $POWERLEVEL9K_MODE in
SWIFT_ICON 'Swift' SWIFT_ICON 'Swift'
PUBLIC_IP_ICON '' PUBLIC_IP_ICON ''
LOCK_ICON $'\UE0A2' LOCK_ICON $'\UE0A2'
SSH_ICON '(ssh)'
) )
;; ;;
esac esac

View File

@ -933,6 +933,12 @@ prompt_rvm() {
fi fi
} }
prompt_ssh() {
if [[ -n "$SSH_CLIENT" ]] || [[ -n "$SSH_TTY" ]]; then
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "yellow" "" 'SSH_ICON'
fi
}
# Status: return code if verbose, otherwise just an icon if an error occurred # Status: return code if verbose, otherwise just an icon if an error occurred
set_default POWERLEVEL9K_STATUS_VERBOSE true set_default POWERLEVEL9K_STATUS_VERBOSE true
set_default POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE false set_default POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE false