config/bash/bashrc-osx
Bastien Chanot 262862c1b9 fix(bashrc): add ~/.local/bin to PATH in deployed bashrc
The bin/ scripts and pipx CLIs land in ~/.local/bin, which was not on
PATH in either deployed bashrc. Add an idempotent PATH guard to
bashrc-linux and bashrc-osx so dt, claude-provider, pymupdf, etc. are
found after login. Update the install.sh and README notes to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 18:56:56 +02:00

78 lines
2.2 KiB
Plaintext

## Enable color support of ls and also add handy aliases
# Some colors
alias ls='ls -G'
alias grep='grep --color=auto'
# Some utils aliases
alias ll='ls -l'
alias la='ls -A'
alias rmrf='rm -rf'
alias gcl='git clone'
alias vim='vim -p'
# Aliases for executing ~/.script scripts
alias gitan='sh ~/.script/gitan.sh'
alias clean='sh ~/.script/clean.sh'
## Some export
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# Ensure ~/.local/bin is on PATH (pipx CLIs + personal scripts from bin/)
case ":$PATH:" in
*":$HOME/.local/bin:"*) ;;
*) export PATH="$HOME/.local/bin:$PATH" ;;
esac
# Used for vim header
export VIUSER=xuser
export VIMAIL=xuser@student.42.fr
## Activate and custom bash completion
#bind 'TAB:menu-complete'
#bind 'set show-all-if-ambiguous on'
## Setting prompt style
# Get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo " [${BRANCH}${STAT}]"
else
echo ""
fi
}
# get current status of git repo
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
if [ "${renamed}" == "0" ] || [ "${newfile}" == "0" ] || [ "${untracked}" == "0" ] || [ "${dirty}" == "0" ]; then
bits="+${bits}"
fi
if [ "${ahead}" == "0" ]; then
bits="*${bits}"
fi
if [ "${deleted}" == "0" ]; then
bits="-${bits}"
fi
if [ ! "${bits}" == "" ]
then
echo " ${bits}"
else
echo ""
fi
}
export PS1='`if [ $? = 0 ]; then echo "\[\033[01;36m\]✔"; else echo "\[\033[01;31m\]✘"; fi` \[\033[32m\]\w\[\033[34m\]$(parse_git_branch " %s") \[\033[0m\]>\[\033[00m\] '
## Lancement des commandes au demarrages