Skip to content

Instantly share code, notes, and snippets.

@teepark
Created October 14, 2009 00:49
Show Gist options
  • Save teepark/209702 to your computer and use it in GitHub Desktop.
Save teepark/209702 to your computer and use it in GitHub Desktop.
my .zshrc
# The following lines were added by compinstall
zstyle :compinstall filename '/home/travis/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=5000
SAVEHIST=1000
setopt appendhistory autocd beep extendedglob
bindkey -v
# End of lines configured by zsh-newuser-install
stty stop ''
alias ls="ls --color=auto"
alias vi="vim"
alias slide="screen -S slide -c $HOME/.slidescreenrc"
alias o="gnome-open"
alias gitnp="git --no-pager"
alias grep="grep -n --color"
alias twoscreens="xrandr --output VGA1 --right-of LVDS"
big() { printf '\e]710;%s\007' "xft:DejaVu Sans Mono:pixelsize=17" }
small() { printf '\e]710;%s\007' "xft:DejaVu Sans Mono:pixelsize=11" }
normal() { printf '\e]710;%s\007' "xft:DejaVu Sans Mono:pixelsize=14" }
scr() {
name="$(basename $(pwd))"
screen -DR $name
}
vim() {
VIM=$(/usr/bin/which vim) # vim executable
servers=`$VIM --serverlist` # servers: currently active vim servers
if [ "$(echo "$servers" | grep GVIM)" ]; then
servername=GVIM
server=GVIM
else
name=$(hostname)
servername=$(echo "${name}.${STY}" | tr '[:lower:]' '[:upper:]').VIM # servername: the server we will target
server=$(echo "$servers" | grep $servername) # server: present iff servername is already active
fi
cmd="$(test "$STY" -a "$(pidof X)" && echo "set t_Co=256")"
if [ -z "$server" ]; then
$VIM --cmd "$cmd" --servername $servername $@
else
for file in $@; do
$VIM --servername $servername --remote-send "<Esc>:tabe $(cd $(dirname $file); pwd)/$(basename $file)<Enter>"
done
fi
}
vpn() {
sudo openvpn --config $HOME/.config/vpn/openvpn.conf
}
isgd() {
result=$(curl "http://is.gd/api.php?longurl=$1" 2> /dev/null)
echo $result | xclip
echo $result
}
orig() {
aliasoutput=`alias $1`
if [ "$aliasoutput" ]; then
shift
orig=`echo $aliasoutput | cut -d= -f1`
val=`echo $aliasoutput | sed -e "s/.*='\(.*\)'/\1/"`
alias $orig=$orig
$orig $@
alias $orig="$val"
else $@
fi
}
editwith() {
grep $@ | cut -d: -f1 | sort -u | xargs vim; reset
}
export PATH=$PATH:/opt/java/bin:/usr/local/bin
export EDITOR=vim
export PAGER=less
autoload -U colors; colors;
function precmd {
git rev-parse --git-dir >/dev/null 2>&1
if [ $? -eq 0 ]; then
export branch=`git symbolic-ref HEAD 2>/dev/null | sed 's/refs\\/heads\\///g'`
export RPROMPT="%{$fg[green]%}$branch%{$reset_color%}"
else
export RPROMPT=""
fi
}
_defaultkey() {
[ "`ssh-add -l | grep $HOME/.ssh/id_rsa`" ] || ssh-add $HOME/.ssh/id_rsa
}
alias ssh="_defaultkey && ssh"
export PS1="%? %{$fg[red]%}%M%{$reset_color%}[%{$fg[green]%}%h%{$reset_color%}]:%~> "
source `which virtualenvwrapper_bashrc`
# if we are in a screen, reset the caption so it has the $STY variable
[ "$STY" ] && screen -X caption always "$STY %= %-w%L>%{= BW}%n*%t%{-}%52<%+w %L="
[ -z "`pidof X`" ] && startx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment