set history -a in PROMPT_COMMAND when using __git_ps1. add some functions to change window titles and revert after using ssh/su. add an emoji showing a host is a _remote_ host when using ssh to connect to another machine.

master
Andrew Coleman 2021-02-09 10:33:23 -05:00
parent c4161afe96
commit 0345ae2961
1 changed files with 24 additions and 1 deletions

25
.bashrc
View File

@ -65,7 +65,10 @@ else
GIT_PS1_SHOWUPSTREAM="auto" GIT_PS1_SHOWUPSTREAM="auto"
GIT_PS1_SHOWCOLORHINTS=1 GIT_PS1_SHOWCOLORHINTS=1
GIT_PS1_HIDE_IF_PWD_IGNORED=1 GIT_PS1_HIDE_IF_PWD_IGNORED=1
PROMPT_COMMAND='__git_ps1 "\[\033[01;32m\][\u@\h\[\033[01;34m\] \w\[\033[01;32m\]]\[\033[00m\]" "\\\$ "' if [[ -n $SSH_CLIENT ]] ; then
SSH_CHAR="📡"
fi
PROMPT_COMMAND='history -a; __git_ps1 "\[\033[01;32m\][\u@\h${SSH_CHAR}\[\033[01;34m\] \w\[\033[01;32m\]]\[\033[00m\]" "\\\$ "'
else else
PS1='\[\033[01;32m\][\u@\h\[\033[01;34m\] \w\[\033[01;32m\]]\[\033[00m\]\$ ' PS1='\[\033[01;32m\][\u@\h\[\033[01;34m\] \w\[\033[01;32m\]]\[\033[00m\]\$ '
fi fi
@ -110,4 +113,24 @@ ex ()
fi fi
} }
# change the title of the current window or tab
title()
{
echo -ne "\033]0;$*\007"
}
ssh()
{
echo -ne '\e[22t'
/usr/bin/ssh "$@"
echo -ne '\e[23t'
}
su()
{
echo -ne '\e[22t'
/bin/su "$@"
echo -ne '\e[23t'
}
[[ -e $HOME/.bash.local ]] && . $HOME/.bash.local || true [[ -e $HOME/.bash.local ]] && . $HOME/.bash.local || true