From cb08b74ffa83f47469ad4ccc6d796a4ca4280824 Mon Sep 17 00:00:00 2001 From: Phillip Aldridge Date: Wed, 20 Aug 2014 09:54:52 +1200 Subject: [PATCH] Don't repeat the prompt if it hasn't changed --- themes/iterate/iterate.theme.bash | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/themes/iterate/iterate.theme.bash b/themes/iterate/iterate.theme.bash index ed6d41f2..b417f34f 100644 --- a/themes/iterate/iterate.theme.bash +++ b/themes/iterate/iterate.theme.bash @@ -40,11 +40,17 @@ function git_prompt_info { echo -e "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_GIT_AHEAD$SCM_GIT_BEHIND$SCM_GIT_STASH$SCM_SUFFIX" } +LAST_PROMPT_INFO="" function prompt_command() { - local prompt_info="${bold_cyan}$(scm_char)${yellow}$(ruby_version_prompt)${green}\w $(scm_prompt_info)" + local prompt_info="\n${bold_cyan}$(scm_char)${yellow}$(ruby_version_prompt)${green}\w $(scm_prompt_info)" + if [ "$LAST_PROMPT_INFO" = "$prompt_info" ]; then + prompt_info="" + else + LAST_PROMPT_INFO="$prompt_info" + fi local wrap_char="" [[ ${#prompt_info} -gt $(($COLUMNS/1)) ]] && wrap_char="\n" - PS1="\n${prompt_info}${green}${wrap_char}→${reset_color} " + PS1="${prompt_info}${green}${wrap_char}→${reset_color} " } PROMPT_COMMAND=prompt_command;