Fix prompt for commands over SSH

When executing commands over SSH, such as SCP, the server (tput)
complains that there is no terminal defined. This fix sets the T_*
variables only if the TERM variable is not empty.
vimbundler
nirenjan 2013-06-18 11:31:27 -07:00
parent b42371a079
commit f77b4eeb77
1 changed files with 14 additions and 4 deletions

View File

@ -7,10 +7,20 @@ add_to_path() {
}
# Define the colors used by the prompt
if [[ ! -z $TERM && "$TERM" != "dumb" ]]
then
T_B=$(tput setaf 4) # Blue
T_G=$(tput setaf 2) # Green
T_Y=$(tput setaf 3) # Yellow
T_S=$(tput sgr0) # Reset
else
# We've probably been invoked by an SSH command, there's no terminal
# to deal with. Don't bother coloring the prompt.
T_B=''
T_G=''
T_Y=''
T_S=''
fi
# Import the Git prompt shell functions. These can be found
# @github:git/git/contrib/completion/git_prompt.sh