Created
May 3, 2010 02:33
-
-
Save pedromenezes/387680 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setopt prompt_subst | |
autoload -Uz vcs_info | |
autoload -U compinit | |
#autoload colors | |
autoload -U promptinit | |
compinit | |
promptinit | |
#colors | |
#function prompt_char { | |
# git branch >/dev/null 2>/dev/null && echo '±' && return | |
# echo '$' | |
#} | |
#export PROMPT="%n in %c$(prompt_char) " | |
# at %m shows hostname | |
# get the name of the branch we are on | |
function git_prompt_info() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
} | |
parse_git_dirty () { | |
if [[ $((git status 2> /dev/null) | tail -n1) != "nothing to commit (working directory clean)" ]]; then | |
echo "$ZSH_THEME_GIT_PROMPT_DIRTY" | |
else | |
echo "$ZSH_THEME_GIT_PROMPT_CLEAN" | |
fi | |
} | |
# | |
# Will return the current branch name | |
# Usage example: git pull origin $(current_branch) | |
# | |
function current_branch() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo ${ref#refs/heads/} | |
} | |
# Aliases | |
alias -g ...='../..' | |
alias -g ....='../../..' | |
alias -g G='grep ' | |
alias pgrep='ps x | G' | |
alias g='git' | |
alias gst='git status' | |
alias gl='git pull' | |
alias gup='git fetch && git rebase' | |
alias gp='git push' | |
alias gd='git diff | mate' | |
alias gdv='git diff -w "$@" | vim -R -' | |
alias gc='git commit -v' | |
alias gca='git commit -v -a' | |
alias gb='git branch' | |
alias gba='git branch -a' | |
alias gcount='git shortlog -sn' | |
alias gcp='git cherry-pick' | |
alias rdbm='rake db:migrate' | |
alias sc='script/console' | |
alias ss="script/server" | |
alias _="sudo" | |
alias ss="sudo su -" | |
alias ack-grep=/usr/bin/ack-grep | |
alias ag=ack-grep | |
# Prompt | |
# %~ or %c for path | |
PROMPT='%{$fg_bold[red]%}➜ %{$fg[cyan]%}%~ %{$fg_bold[green]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[cyan]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}) %{$fg[yellow]%}✗%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%})" | |
# Autocomplete | |
## case-insensitive (all),partial-word and then substring completion | |
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then | |
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' | |
unset CASE_SENSITIVE | |
else | |
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' | |
fi | |
zstyle ':completion:*' list-colors '' | |
zstyle ':completion:*:*:*:*:*' menu yes select | |
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' | |
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" | |
# Load known hosts file for auto-completion with ssh and scp commands | |
if [ -f ~/.ssh/known_hosts ]; then | |
zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) | |
zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` | |
fi | |
# History | |
## Command history configuration | |
HISTFILE=$HOME/.zsh_history | |
HISTSIZE=10000 | |
SAVEHIST=10000 | |
setopt hist_ignore_dups # ignore duplication command history list | |
setopt share_history # share command history data | |
setopt hist_verify | |
setopt inc_append_history | |
setopt extended_history | |
setopt hist_expire_dups_first | |
bindkey ';5D' emacs-backward-word | |
bindkey ';5C' emacs-forward-word | |
function go { | |
export GO_SHELL_SCRIPT=$HOME/.__tmp_go.sh | |
python -m go $* | |
if [ -f $GO_SHELL_SCRIPT ] ; then | |
source $GO_SHELL_SCRIPT | |
fi | |
unset GO_SHELL_SCRIPT | |
} | |
export EDITOR=vim | |
if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm ; fi | |
rvm use 1.8.7 > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment