set window title

This commit is contained in:
foosinn 2020-06-14 11:08:54 +02:00
parent dcc39189b7
commit b8597f51a0

View file

@ -38,15 +38,20 @@ in {
eval $(ssh-agent)
fi
pw () {
set_win_title() {
echo -ne "\033]0;$USER@$HOSTNAME: $PWD\007"
}
starship_precmd_user_func=set_win_title
pw() {
len=''${1:-$(( $RANDOM % 24 + 8 ))}
tr -dc a-zA-Z0-9 < /dev/urandom | head -c $len
echo
}
cdg() {
gitroot=$(until [ -d .git ]; do [ "$PWD" == "/" ] && exit 1; cd ..; done; echo $PWD)
if [ $? == 0 ]; then
precmd_user_func = "title"
cd $gitroot
else
echo "gitroot not found."