Skip to content

Instantly share code, notes, and snippets.

@eFrane
Created August 31, 2016 11:58
Show Gist options
  • Save eFrane/e814a2c88595f0e94760593544a945f1 to your computer and use it in GitHub Desktop.
Save eFrane/e814a2c88595f0e94760593544a945f1 to your computer and use it in GitHub Desktop.
# general consideration: store as much of the shell config as feasible in
# ~/.zsh to keep this file concise
# requirements:
# - z
# - git
# optionals:
# - zsh syntax highlighting
# - iterm2 for shell integration
HISTFILE=~/.zsh/history
HISTSIZE=1000
SAVEHIST=10000
REPORTTIME=10 # execution time reporting on commands running longer than 10 seconds
setopt appendhistory autocd beep extendedglob nomatch notify prompt_subst
bindkey -e # me wants emacs/readline key bindings on zsh
PROMPT='%(?..%B%F{red}%?%f%b )%n@%2m:%B%1~%(!.%F{red}>%f.%F{green}>%f)%b '
# Load environment configuration from .zsh/
if [ -d ~/.zsh ]
then
source ~/.zsh/paths
source ~/.zsh/env
source ~/.zsh/aliases
else
print "Cannot initialize shell, missing configuration."
exit 1
fi
# minimalistic git status display
function git_status
{
if [ -d ".git" ]
then
if [ -f ".git/refs/heads/master" ]
then
branch="%B[$(git rev-parse --abbrev-ref HEAD)]%b"
if [ $(git status --porcelain | wc -l) -gt 0 ]
then
gst="%F{red}±%f"
else
gst="%F{green}±%f"
fi
echo "$gst$branch"
else
echo "%F{blue}±%f"
fi
fi
}
RPROMPT='$(git_status)'
export _Z_DATA=~/.zsh/z
source `brew --prefix`/etc/profile.d/z.sh
test -e "${HOME}/.zsh/iterm2_shell_integration.zsh" && source "${HOME}/.zsh/iterm2_shell_integration.zsh"
# TODO: check wether this is necessary to get root shell integration in iterm
#test $(whoami) = root && source "${HOME}/.zsh/iterm2_shell_integration.zsh
test -e "/usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" && source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment