Created
September 29, 2020 19:44
-
-
Save TheCleric/10914dd3591ed5cf8a35b26d55bd7294 to your computer and use it in GitHub Desktop.
ZSH Profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIT_PS1_SHOWDIRTYSTATE=1 | |
GIT_PS1_SHOWDIRTYSTATE_COUNT=1 | |
GIT_PS1_SHOWUNTRACKEDFILES=1 | |
GIT_PS1_SHOWUNTRACKEDFILES_COUNT=1 | |
GIT_PS1_SHOWCOLORHINTS=true | |
. ~/git-prompt.sh | |
# venv | |
export VIRTUAL_ENV_DISABLE_PROMPT=1 | |
function virtualenv_info(){ | |
# Get Virtual Env | |
if [[ -n "$VIRTUAL_ENV" ]]; then | |
case `pwd` in | |
*${VIRTUAL_ENV:h}*) venv="${VIRTUAL_ENV##*/}" ;; | |
*) venv="${VIRTUAL_ENV}" ;; | |
esac | |
else | |
# In case you don't have one activated | |
venv="" | |
fi | |
[[ -n "$venv" ]] && echo " (venv:$venv) " | |
} | |
# disable the default virtualenv prompt change | |
export VIRTUAL_ENV_DISABLE_PROMPT=1 | |
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html | |
hostname_short="%m" | |
hostname="%M" | |
username="%n" | |
relative_path="%c" | |
full_path="%~" | |
history_count="%h" | |
job_count="%j" | |
date="%D" | |
time_sec_24="%*" | |
time_24="%T" | |
time_12="%t" | |
# https://scriptingosx.com/2019/07/moving-to-zsh-06-customizing-the-zsh-prompt/ | |
# https://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html | |
setopt PROMPT_SUBST; | |
PS1="%F{blue}[$date $time_24]%f %F{239}$username@%f%F{green}$relative_path%f%F{yellow}\$(__git_ps1 ' (%s)')%f%F{red}\$(virtualenv_info)%f$ " | |
# git auto complete | |
[[ -r "/usr/local/Cellar/git/2.28.0/share/zsh/site-functions/git-completion.bash" ]] && . "/usr/local/Cellar/git/2.28.0/share/zsh/site-functions/git-completion.bash" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment