Skip to content

Instantly share code, notes, and snippets.

@fallenhitokiri
Created June 16, 2014 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fallenhitokiri/3685e6f6e755beed1403 to your computer and use it in GitHub Desktop.
Save fallenhitokiri/3685e6f6e755beed1403 to your computer and use it in GitHub Desktop.
basic zsh
autoload -U colors && colors
autoload -U compinit && compinit
# 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 "venv"
}
PROMPT='%{$fg[blue]%}%m %{$fg[red]%}%(!.%1~.%~) %{$fg[blue]%}%_$(virtualenv_info)%{$reset_color%}
$ '
# 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
# aliases
alias m="python manage.py"
# PATH
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/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