f20250910

This commit is contained in:
alex 2025-09-10 11:47:32 +08:00
parent bd44a039e9
commit 37f246d16a

23
.kshrc
View file

@ -12,6 +12,27 @@ alias du='du -sh'
alias ifconfig='/home/alex/color_ifconfig'
alias kitty="GLFW_IM_MODULE=ibus kitty"
# git 分支显示
git_branch() {
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) || return
status=""
if git rev-parse --abbrev-ref @{u} > /dev/null 2>&1; then
ahead=$(git rev-list --count @{u}..HEAD 2>/dev/null)
behind=$(git rev-list --count HEAD..@{u} 2>/dev/null)
if [ "$ahead" -gt 0 ]; then
status="$status↑$ahead"
fi
if [ "$behind" -gt 0 ]; then
status="$status↓$behind"
fi
fi
print " ($branch$status)"
}
#set -o vi
# export PS1='\[\e[32m\]\u@\h:\w\[\e[0m\]$ '
export PS1='\[\e[33m\]\h\w\[\e[0m\]$ '
#export PS1='$(print "\033[1;32m$USER\033[0m@\033[1;34m$(hostname -s)\033[0m:\033[1;33m$PWD\033[0m$(git_branch)\n$ ")'