Skip to content

Instantly share code, notes, and snippets.

@fallenhitokiri
Created January 13, 2015 19:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fallenhitokiri/b23099327b6b63d62456 to your computer and use it in GitHub Desktop.
Save fallenhitokiri/b23099327b6b63d62456 to your computer and use it in GitHub Desktop.
autoload -U colors && colors
autoload -U compinit && compinit
autoload -Uz vcs_info
# completion
zstyle ':completion:*' menu select
setopt completealiases
# history
HISTFILE=$HOME/.zsh_history
HISTSIZE=1000
SAVEHIST=1000
setopt inc_append_history
setopt share_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_verify
bindkey '\e[A' history-search-backward
bindkey '\e[B' history-search-forward
# PROMPT
setopt PROMPT_SUBST
function prompt_char {
if [ $UID -eq 0 ]; then echo "#"; else echo $; fi
}
VIRTUAL_ENV_DISABLE_PROMPT=1
function virtualenv_info {
[ $VIRTUAL_ENV ] && echo ${VIRTUAL_ENV##*/}
}
zstyle ':vcs_info:*' actionformats \
'%F{154}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats \
'%F{154}%b'
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn
# or use pre_cmd, see man zshcontrib
vcs_info_wrapper() {
vcs_info
if [ -n "$vcs_info_msg_0_" ]; then
echo "${vcs_info_msg_0_}"
fi
}
PROMPT='%F{153}%m %F{161}%(!.%1~.%~) $(vcs_info_wrapper) %F{135}$(virtualenv_info)%{$reset_color%}
$ '
# chruby
# source /usr/local/share/chruby/chruby.sh
# source /usr/local/share/chruby/auto.sh
# autoenv
source /usr/local/opt/autoenv/activate.sh
use_env() {
typeset venv
venv="$1"
if [[ "${VIRTUAL_ENV##*/}" != "$venv" ]]; then
if workon | grep -q "$venv"; then
workon "$venv"
else
echo -n "Create virtualenv \"$venv\" now? (Y/n) "
read answer
if [[ "$answer" != "n" ]]; then
mkvirtualenv "$venv"
fi
fi
fi
}
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
source /usr/local/bin/virtualenvwrapper.sh
source ~/.nvm/nvm.sh
# aliases
alias lpsql="postgres -D /usr/local/var/postgres"
alias lredis="redis-server /usr/local/etc/redis.conf"
alias lmongo="/usr/local/bin/mongod"
alias fm="foreman run python manage.py"
alias ve="source venv/bin/activate"
alias m="python manage.py"
alias ms="python manage.py shell"
alias msp="python manage.py shell_plus"
alias mt="python manage.py test"
alias mrt="REUSE_DB=1 python manage.py test"
alias mr="python manage.py runserver 0.0.0.0:8000"
alias mr5="python manage.py runserver 0.0.0.0:5000"
alias selenium="java -jar /usr/local/opt/selenium-server-standalone/selenium-server-standalone-2.37.0.jar -p 4444"
alias pu="python -m unittest discover"
# PATH
export GOROOT=/usr/local/go
export GOPATH=$HOME/Projects/go
export PATH=/usr/local/bin:$GOROOT/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:$GOPATH/bin:$HOME/bin
export GIT_EDITOR="subl -n -w"
export WORKON=~/.virtualenvs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment