My .zshrc file
This page is managed by StJohn Piano.
If you have any questions, comments, corrections, or suggestions - please contact StJohn Piano on Tela:
tela.app/id/stjohn_piano/7c51a6
# Zsh shell theme: Powerlevel10k
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
source ~/powerlevel10k/powerlevel10k.zsh-theme
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Aliases
alias python="python3"
alias pip="pip3"
alias ll="ls -lh"
alias work="cd ~/Desktop/stuff/WORK_treenovum/code"
# Define a function to activate the virtual environment
venv_activate() {
if [ -f .venv/bin/activate ]; then
source .venv/bin/activate
elif [ -f venv/bin/activate ]; then
source venv/bin/activate
else
echo "No virtual environment found."
fi
}
# Alias venv to the venv_activate function
alias venv="venv_activate"
alias g="git"
alias gs="git status"
alias ga="git add --patch"
alias gc="git commit"
alias gr="git reset HEAD"
# git repo history (colored)
git() {
if [[ $@ == "history" ]]; then
command git log --graph --oneline --all --decorate --abbrev-commit --date=format:'%Y-%m-%d %H:%M:%S' --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ad)%C(reset) %C(white)%s%C(reset) %C(bold white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
else
command git "$@"
fi
}
# direnv
eval "$(direnv hook zsh)"