Files
server-dotfiles/bashrc
2025-03-11 15:36:25 +11:00

39 lines
1.4 KiB
Bash

# Function to parse git branch
function parse_git_branch {
git branch 2>/dev/null | grep '^*' | colrm 1 2
}
# Function to parse git status
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "✗"
}
# Custom prompt with proper Unicode escapes and hexadecimal notation
PS1=$'\[\e[38;5;10m\]\u\[\e[m\] \[\e[38;5;14m\]\w\[\e[m\] \[\e[38;5;9m\]\uE0B0\[\e[m\] \[\e[38;5;11m\]$(parse_git_branch)$(parse_git_dirty)\[\e[m\] \[\e[38;5;15m\]\uF013\[\e[m\] '
function _update_ps1() {
#PS1="$(/opt/homebrew/bin/powerline-go -hostname-only-if-ssh -cwd-mode fancy -modules direnv,dotenv,rbenv -error $? -jobs $(jobs -p | wc -l))"
PS1="$(/opt/homebrew/bin/powerline-go -hostname-only-if-ssh -cwd-mode fancy -modules="venv,user,host,ssh,cwd,perms,git,hg,jobs,exit,rbenv,root" -error $? -cwd-max-depth 2 -jobs $(jobs -p | wc -l))"
# Uncomment the following line to automatically clear errors after showing
# them once. This not only clears the error for powerline-go, but also for
# everything else you run in that shell. Don't enable this if you're not
# sure this is what you want.
set "?"
}
if [ "$TERM" != "linux" ] && [ -f "/opt/homebrew/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
set -o vi
export RUBY_YJIT_ENABLE=1
HISTSIZE=50000
HISTFILESIZE=100000
shopt -s histappend
eval "$(direnv hook bash)"