From 347995d33e172faea431fc9fa72e40bf5e5f3b88 Mon Sep 17 00:00:00 2001 From: BarbUk Date: Wed, 1 Apr 2020 01:02:01 +0400 Subject: [PATCH] Allow to customize hostname format --- themes/barbuk/barbuk.theme.bash | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/themes/barbuk/barbuk.theme.bash b/themes/barbuk/barbuk.theme.bash index ead0940a..2cba4df7 100644 --- a/themes/barbuk/barbuk.theme.bash +++ b/themes/barbuk/barbuk.theme.bash @@ -11,6 +11,7 @@ EXIT_CODE_ICON=${EXIT_CODE_ICON:=' '} # Ssh user and fqdn display SSH_INFO=${BARBUK_SSH_INFO:=true} +HOST_INFO=${BARBUK_HOST_INFO:=long} # Bash-it default glyphs customization SCM_HG_CHAR='☿ ' @@ -65,7 +66,7 @@ function _exit-code { } function _prompt { - local exit_code="$?" wrap_char=' ' dir_color=$green ssh_info='' + local exit_code="$?" wrap_char=' ' dir_color=$green ssh_info='' host _exit-code exit_code _git-uptream-remote-logo @@ -79,7 +80,12 @@ function _prompt { # Detect ssh if [[ -n "${SSH_CONNECTION}" ]] && [ "$SSH_INFO" = true ]; then - ssh_info="${bold_blue}\u${bold_orange}@${cyan}\H ${bold_orange}in" + if [ "$HOST_INFO" = long ]; then + host="\H" + else + host="\h" + fi + ssh_info="${bold_blue}\u${bold_orange}@${cyan}$host ${bold_orange}in" fi PS1="\\n${ssh_info} ${purple}$(scm_char)${dir_color}\\w${normal}$(scm_prompt_info)${exit_code}"