Skip to content

Instantly share code, notes, and snippets.

@typester
Created February 28, 2013 02:12
Show Gist options
  • Save typester/5053629 to your computer and use it in GitHub Desktop.
Save typester/5053629 to your computer and use it in GitHub Desktop.
HISTFILE="$HOME/.zhistory"
HISTSIZE=1000000
SAVEHIST=1000000
autoload -U compinit
compinit
setopt always_last_prompt
setopt append_history
setopt hist_ignore_space
setopt share_history
setopt auto_list
setopt auto_menu
setopt nobeep
setopt prompt_subst
setopt extended_glob
setopt no_flow_control # disable C-s and C-q
setopt print_eight_bit
setopt auto_cd
setopt autopushd
setopt pushd_ignore_dups
unsetopt promptcr
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' group-name ''
stty -istrip
bindkey -e
bindkey '^R' history-incremental-pattern-search-backward
bindkey '^S' history-incremental-pattern-search-forward
bindkey '^P' history-beginning-search-backward
bindkey '^N' history-beginning-search-forward
autoload colors && colors
function git_prompt() {
local rev=$(git symbolic-ref HEAD 2>/dev/null)
if [[ -n $rev ]]; then
echo -n "${fg[cyan]}:${reset_color}${fg[green]}${rev#refs/heads/}${reset_color}"
fi
if [[ -n $(git status -s --ignore-submodules 2>/dev/null) ]]; then
echo -n "${fg[yellow]}⚡${reset_color}"
fi
}
plenv_perl_version() {
local dir=$PWD
[[ -n $PLENV_VERSION ]] && { echo $PLENV_VERSION; return }
while [[ -n $dir && $dir != "/" && $dir != "." ]]; do
if [[ -f "$dir/.perl-version" ]]; then
head -n 1 "$dir/.perl-version"
return
fi
dir=$(dirname $dir)
done
local plenv_home=$PLENV_HOME
[[ -z $PLENV_HOME && -n $HOME ]] && plenv_home="$HOME/.plenv"
if [[ -f "$plenv_home/version" ]]; then
head -n 1 "$plenv_home/version"
fi
}
plenv_prompt() {
local ver=$(plenv_perl_version)
echo -n "$fg[red]plenv:"
if [[ -n $ver ]]; then
echo -n $ver
else
echo -n "system"
fi
echo -n "$reset_color"
}
rbenv_prompt() {
local ver=$(rbenv version-name 2>/dev/null)
echo -n "$fg_bold[red]rbenv:"
if [[ -n $ver ]]; then
echo -n $ver
else
echo -n "system"
fi
echo -n "$reset_color"
}
precmd() {
PROMPT="%(?..%{$fg[red]%}↵ %?%{$reset_color%})
%{$fg[yellow]%}%~%{$reset_color%}$(git_prompt) $(plenv_prompt) $(rbenv_prompt)
%{$fg[cyan]%}$%{$reset_color%} "
}
alias ls='ls -F -G'
alias ec='emacsclient -n'
alias ldd='echo "otool -L 使え"'
export LANG=ja_JP.UTF-8
export LC_MONETARY=ja_JP.UTF-8
export LC_NUMERIC=ja_JP.UTF-8
export LC_COLLATE=ja_JP.UTF-8
export LC_CTYPE=ja_JP.UTF-8
export LC_TIME=ja_JP.UTF-8
export LC_MESSAGES=C
export EDITOR=emacsclient
if [[ "$TERM" == "screen" || "$TERM" == "screen-bce" ]]; then
keychain --quiet
. ~/.keychain/${HOST}-sh
fi
# homebrew
export PATH=$HOME/homebrew/bin:$PATH
export HOMEBREW_PREFIX=$HOME/homebrew
if [[ -n $CPATH ]]; then
export CPATH="$CPATH:$HOMEBREW_PREFIX/include"
else
export CPATH="$HOMEBREW_PREFIX/include"
fi
if [[ -n $LIBRARY_PATH ]]; then
export LIBRARY_PATH="$LIBRARY_PATH:$HOMEBREW_PREFIX/lib"
else
export LIBRARY_PATH="$HOMEBREW_PREFIX/lib"
fi
# plenv
export PATH=$HOME/.plenv/shims:$PATH
# rbenv
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# pythonbrew
source /Users/typester/.pythonbrew/etc/bashrc
# git-flow completions
source $HOME/homebrew/share/zsh/site-functions/git-flow-completion.zsh
# tmux
if [[ -n "$TMUX" ]]; then
alias pbcopy="ssh 127.0.0.1 pbcopy"
alias pbpaste="ssh 127.0.0.1 pbpaste"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment