mirror of
https://github.com/eliasrenman/dotfiles.git
synced 2026-03-16 20:46:08 +01:00
38 lines
1015 B
Bash
38 lines
1015 B
Bash
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"
|