parse_git_branch() { git_status="$(git status 2> /dev/null)" pattern="On branch ([^[:space:]]*)" if [[ ! ${git_status} =~ "(working (tree|directory) clean)" ]]; then state="*" fi if [[ ${git_status} =~ ${pattern} ]]; then branch=${match[1]} branch_cut=${branch:0:35} if (( ${#branch} > ${#branch_cut} )); then echo "[${branch_cut}…${state}]" else echo "[${branch}${state}]" fi fi } setopt PROMPT_SUBST PROMPT='%{%F{blue}%}%9c%{%F{green}%} $(parse_git_branch)%{%F{none}%}$ ' source ~/.antidote/antidote.zsh antidote load export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias .....="cd ../../../.." alias ......="cd ../../../../.." alias vim="nvim" alias vi="nvim" alias oldvim="vim" alias ls="exa" alias cat="batcat" source /home/eliasrenman/alacritty/extra/completions/alacritty.bash PATH="$HOME/.local/bin:$PATH" function cd() { builtin cd "$@" if [[ -z "$VIRTUAL_ENV" ]] ; then ## If env folder is found then activate the vitualenv if [[ -d ./.env ]] ; then source ./.env/bin/activate fi else ## check the current folder belong to earlier VIRTUAL_ENV folder # if yes then do nothing # else deactivate parentdir="$(dirname "$VIRTUAL_ENV")" if [[ "$PWD"/ != "$parentdir"/* ]] ; then deactivate fi fi } function cd() { builtin cd "$@" if [[ -z "$VIRTUAL_ENV" ]] ; then ## If env folder is found then activate the vitualenv if [[ -d ./.env ]] ; then source ./.env/bin/activate fi else ## check the current folder belong to earlier VIRTUAL_ENV folder # if yes then do nothing # else deactivate parentdir="$(dirname "$VIRTUAL_ENV")" if [[ "$PWD"/ != "$parentdir"/* ]] ; then deactivate fi fi }