Don't repeat the prompt if it hasn't changed
parent
a6c2e3b765
commit
cb08b74ffa
|
|
@ -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"
|
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() {
|
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=""
|
local wrap_char=""
|
||||||
[[ ${#prompt_info} -gt $(($COLUMNS/1)) ]] && wrap_char="\n"
|
[[ ${#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;
|
PROMPT_COMMAND=prompt_command;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue