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.
parent
c4161afe96
commit
0345ae2961
25
.bashrc
25
.bashrc
|
@ -65,7 +65,10 @@ else
|
|||
GIT_PS1_SHOWUPSTREAM="auto"
|
||||
GIT_PS1_SHOWCOLORHINTS=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
|
||||
PS1='\[\033[01;32m\][\u@\h\[\033[01;34m\] \w\[\033[01;32m\]]\[\033[00m\]\$ '
|
||||
fi
|
||||
|
@ -110,4 +113,24 @@ ex ()
|
|||
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
|
||||
|
|
Reference in New Issue