Skip to content

Instantly share code, notes, and snippets.

@DoZator
Last active December 11, 2015 02:18
Show Gist options
  • Save DoZator/4529147 to your computer and use it in GitHub Desktop.
Save DoZator/4529147 to your computer and use it in GitHub Desktop.
Show git and branch in prompt

Install zsh for OS X wuth Homebrew

brew install zsh zsh-completions

Set as default shell

echo /usr/local/bin/zsh | sudo tee -a /etc/shells

chsh -s $(which zsh)
export PATH=$PATH:/opt/local/bin # macports path
PS1='\[\e[0;33m\]\h:\W [\u]\[\e[m\]$(git_branch) $ '
alias ll='ls -alF'
alias ls='ls -G'
alias st='git status --short'
alias ..='cd ..'
git_branch() {
git branch --no-color 2> /dev/null | grep "*" |\
awk -v "clrp=$txtpur" -v "clrr=$txtrst" \
'{ print clrp ":git/" $2 clrr}'
}
prefix=${HOME}/.npm-packages
## NodeJS, npm
export NPM_PACKAGES="$HOME/.npm-packages"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
export EDITOR="vim"
export HISTSIZE=2000
export SAVEHIST=2000
export HISTFILE="$HOME/.zsh_history"
export GOROOT=/usr/local/opt/go/libexec
export GOPATH=$HOME/go
export PATH="$GOPATH/bin:$PATH"
export PATH="$NPM_PACKAGES/bin:$PATH"
export PATH=/usr/local/bin:$PATH
export HOMEBREW_GITHUB_API_TOKEN=#####################
fpath=(/usr/local/share/zsh-completions $fpath)
autoload -U colors compinit
colors
compinit
PS1="[%{$fg[cyan]%}%n%{$reset_color%}] %{$fg[yellow]%}%~%{$reset_color%} ▶ "
setopt AUTO_CD
setopt GLOB_COMPLETE
# history
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_REDUCE_BLANKS
#aliases
alias ls='ls -G'
alias ll='ls -alF'
alias st='git status --short'
alias ..='cd ..'
alias mostart='mongod --config /usr/local/etc/mongod.conf'
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Add RVM to PATH for scripting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment