From 86aa9ff36a3f5e9ab3fcdf79b2da23d1b10cae75 Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Thu, 7 Jul 2011 22:13:29 -1000 Subject: [PATCH 1/2] ip address can be enabled/disabled (default is enabled) --- themes/hawaii50/hawaii50.theme.bash | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 21c0b413..1b0a5998 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -75,6 +75,9 @@ MAX_GIT_HEX_LENGTH=5 # IP address IP_SEPARATOR=', ' +# Show IP +IP_ENABLED=1 + # FUNCS ======================================================================= function ip { @@ -82,6 +85,13 @@ function ip { echo -e "$(ips | sed -e :a -e '$!N;s/\n/${IP_SEPARATOR}/;ta' | sed -e 's/127\.0\.0\.1\${IP_SEPARATOR}//g'), ${myip}" } +# Displays ip prompt +function ip_prompt_info() { + if [[ $IP_ENABLED == 1 ]]; then + echo -e " ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})" + fi +} + # Displays virtual info prompt (virtualenv/rvm) function virtual_prompt_info() { local virtual_env_info=$(virtualenv_prompt) @@ -176,9 +186,9 @@ function prompt() { [ $UID -eq "0" ] && UC=$SUPERUSER_COLOR if [[ $VIRTUAL_PROMPT_ENABLED == 1 ]]; then - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info)${reset_color} \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h$(ip_prompt_info) ${DEFAULT_COLOR}in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(virtual_prompt_info)$(scm_prompt_info)${reset_color} \$ " else - PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR}) in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info)${reset_color} \$ " + PS1="$(scm_char) ${UC}\u ${DEFAULT_COLOR}at ${MACHINE_COLOR}\h$(ip_prompt_info) ${DEFAULT_COLOR}in ${DIRECTORY_COLOR}$(limited_pwd)${DEFAULT_COLOR}$(scm_prompt_info)${reset_color} \$ " fi PS2='> ' PS4='+ ' From caa1bba1298a7dd35b5844e4b18ddb538bd52b7d Mon Sep 17 00:00:00 2001 From: Ryan Kanno Date: Sat, 9 Jul 2011 14:04:08 -1000 Subject: [PATCH 2/2] Moved IP and virtualenv variables to top of file --- themes/hawaii50/hawaii50.theme.bash | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 1b0a5998..93cef469 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -30,6 +30,15 @@ # specific like getting ip, etc. # +# IMPORTANT THINGS TO CHANGE ================================================== + +# Show IP in prompt +# One thing to be weary about if you have slow Internets +IP_ENABLED=1 + +# virtual prompts +VIRTUAL_PROMPT_ENABLED=1 + # COLORS ====================================================================== ORANGE='\[\e[0;33m\]' @@ -60,9 +69,6 @@ RVM_THEME_PROMPT_SUFFIX='' VIRTUALENV_THEME_PROMPT_PREFIX='' VIRTUALENV_THEME_PROMPT_SUFFIX='' -# virtual prompts -VIRTUAL_PROMPT_ENABLED=1 - VIRTUAL_THEME_PROMPT_PREFIX=' using ' VIRTUAL_THEME_PROMPT_SUFFIX='' @@ -75,9 +81,6 @@ MAX_GIT_HEX_LENGTH=5 # IP address IP_SEPARATOR=', ' -# Show IP -IP_ENABLED=1 - # FUNCS ======================================================================= function ip {