mirror of
https://gitee.com/hotalexnet/openbsd.git
synced 2025-12-26 17:44:57 +08:00
f20250910
This commit is contained in:
parent
bd44a039e9
commit
37f246d16a
1 changed files with 22 additions and 1 deletions
23
.kshrc
23
.kshrc
|
|
@ -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$ ")'
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue