dotfiles/.zshrc

58 lines
1.6 KiB
Bash

export GEM_HOME="$HOME/.local/gems"
export PATH="$HOME/.local/bin:$PATH"
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME=""
function prompt_char {
if [ $UID -eq 0 ]; then echo "#"; else echo $; fi
}
DISABLE_UNTRACKED_FILES_DIRTY="true"
plugins=(git)
source $ZSH/oh-my-zsh.sh
export LANG=en_US.UTF-8
export EDITOR='vim'
PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%})(%m)%{%F{24}%} %(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=") "
zle_highlight=( default:fg=default )
parent() { [[ ${1[1,$#2]} == $2 ]] }
sibling() { [[ ${1:a:h} == ${2:a:h} ]] }
function chpwd() {
emulate -L zsh
# Automatically fetch remotes and display Git status information when entering a repository.
if [[ -d .git ]]; then
git status
fi
}
alias git='noglob git'
alias ga='git add'
alias gc='git commit'
alias gd='git diff'
alias gds='git diff --staged'
alias gp='git push'
alias gs='git status'
alias gtree='git log --graph --all --pretty=format:"%Cred%h%Creset - %Cgreen(%cd - %cr)%Creset %s%C(yellow)%d %an%Creset" --abbrev-commit --date=iso'
alias getunicode="perl -C7 -ne 'for(split(//)){print sprintf(\"U\+\%04X\", ord).\" \".\$_.\"\n\"}'"
if [ -z "$SSH_AUTH_SOCK" ]
then
# Check for a currently running instance of the agent
RUNNING_AGENT="`ps -x | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]'`"
if [ "$RUNNING_AGENT" = "0" ]
then
# Launch a new instance of the agent
ssh-agent -s &> ~/.ssh/ssh-agent
eval `cat ~/.ssh/ssh-agent`
fi
fi
prompt_context() {}