summaryrefslogtreecommitdiff
path: root/.zshrc
blob: d38ef419f79d90d609df6df85347283bb393cf92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
if [[ ! "$TERM" == "screen-256color" ]]; then
  TERM="xterm-256color" #hack
fi

zstyle ':completion:*' completer _complete _ignored
zstyle :compinstall filename '~/.zshrc'
autoload -Uz compinit promptinit
compinit
promptinit
zstyle ':completion:*' completer _complete _ignored
HISTFILE=~/.zshistory
HISTSIZE=1000
SAVEHIST=1000
zstyle ':completion:*' menu select
setopt completealiases
compdef mosh=ssh
zstyle '*' hosts # do not use /etc/hosts
#setopt multios
setopt no_multios

ex () {
  if [ -f $1 ] ; then
    case $1 in
      *.tar.bz2) tar xvjf $1 && cd $(basename "$1" .tar.bz2) ;;
      *.tar.gz)  tar xvzf $1 && cd $(basename "$1" .tar.gz) ;;
      *.tar.xz)  tar Jxvf $1 && cd $(basename "$1" .tar.xz) ;;
      *.bz2)     bunzip2 $1 && cd $(basename "$1" .bz2) ;;
      *.rar)     unrar x $1 && cd $(basename "$1" .rar) ;;
      *.gz)      gunzip $1 && cd $(basename "$1" .gz) ;;
      *.tar)     tar xvf $1 && cd $(basename "$1" .tar) ;;
      *.tbz2)    tar xvjf $1 && cd $(basename "$1" .tbz2) ;;
      *.tgz)     tar xvzf $1 && cd $(basename "$1" .tgz) ;;
      *.zip)     unzip $1 && cd $(basename "$1" .zip) ;;
      *.Z)       uncompress $1 && cd $(basename "$1" .Z) ;;
      *.7z)      7zr x $1 && cd $(basename "$1" .7z) ;;
      *)         echo "Don't know how to extract '$1'..." ;;
    esac
  else
    echo "'$1' is not a file!"
  fi 
}

umask 0077
export PATH=~/bin:~/src/scripts:~/lib/ruby/bin:/usr/sbin/:$PATH
export RUBYOPT=-Ku
export CCACHE_PATH=/usr/bin
export TEXMFHOME='~/.texmf'
export EDITOR='vim -p'
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export GEM_HOME=$HOME/lib/ruby/
export TERM=rxvt-256color
export PYTHONPATH=$PYTHONPATH:~/lib/python/
export CFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer -Wall"
export CXXFLAGS="$CFLAGS"

case $TERM in
  *rxvt*|xterm*)
     precmd () {print -Pn "\e]0;%n@%m%~\a"}
    preexec () {print -Pn "\e]0;%n@%m%~ -- $1\a"}
  ;;
  screen*)
     precmd () {print -Pn "\e]0;%n@%m%~\a"}
    preexec () {print -Pn "\e]0;%n@%m%~\a"}
  ;;
esac

autoload -U colors && colors
case `hostname` in
  2pac*)
    HOSTCOLOR=green
    alias tmux='TERM=screen-256color tmux -f ~/.tmux.2pac.conf'
  ;;
  CLuster)
    HOSTCOLOR=cyan
    alias tmux='TERM=screen-256color tmux -f ~/.tmux.cluster.conf'
  ;;
  coltrane*)
    HOSTCOLOR=blue
    alias tmux='TERM=screen-256color tmux -f ~/.tmux.coltrane.conf'
  ;;
  donna*)
    HOSTCOLOR=red
    alias tmux='TERM=screen-256color tmux -f ~/.tmux.donna.conf'
  ;;
  vicious*)
    HOSTCOLOR=yellow
  ;;
  x)
    HOSTCOLOR=magenta
  ;;
  *)
    alias tmux='TERM=screen-256color tmux'
  ;;
esac

case `hostname` in
  2pac*|CLuster|coltrane*|donna*|vicious*)
    export GEM_HOME=/toolbox/ruby/
    export GEM_PATH=/toolbox/ruby
    export PYTHONPATH=$PYTHONPATH:/toolbox/python/lib/python2.7/site-packages
    export PATH=~/vim/bin:/toolbox/scripts:/opt/java/bin/:/toolbox/ruby/bin/:$PATH
    export JAVA_HOME=/usr/lib/jvm/java-6-sun/ # debian systems
    alias tmux='TERM=screen-256color tmux -f ~/.tmux.vicious.conf'
    PROMPT="[%m:%~]%{$fg[$HOSTCOLOR]%}%B%%%b%{$reset_color%} "
  ;;
  x)
    PROMPT="[%~]%{$fg[magenta]%}$B%%%b%{$reset_color%} "
  ;;
esac

function youtube() { mplayer -xy 0.5 $(youtube-dl -g "$@") ;}

alias ls='ls -h --color=auto'
alias l='ls'
alias la='ls -lA'
alias ll='ls -l'
alias lla='ls -A'
alias lsc='ls -1 | wc -l'
alias less='less -R'
alias lh='ls --color=always -lasth | less'
alias vi=$EDITOR
alias pdf='mupdf'
alias py='bpython'
alias grep='grep --color=auto'
alias equery='sudo equery -N'
alias feh='feh -F'
alias gitweb='git instaweb --httpd webrick'
alias gitwebstop='git instaweb stop'
alias netcfg='sudo netcfg'
alias mergepdf='texexec --pdfarrange --noduplex --result merged.pdf '
alias mergepdfgs=' gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=gsmerged.pdf -dBATCH'
alias updatedb='sudo updatedb'
alias qmv='qmv -evim -fdo'
alias dusage='du -hs *'
alias df='df -h'
alias diff='colordiff'
alias iwlist='sudo iwlist wlan0 scan'
alias fumount='fusermount -u'
alias more='less'
alias vpnc='sudo vpnc'
alias vgaoff='xrandr --output VGA1 --off'
alias vgaclone='xrandr --output VGA1 --mode 1024x768'
alias vgaext='xrandr --output VGA1 --mode 1024x768 --left-of LVDS1 --rotate right'
alias suspend='sudo suspend'
alias hibernate='suspend'
alias reboot='sudo shutdown -r now'
alias halt='sudo shutdown -h now'
alias lock='slock'
alias demoterm="urxvt -fn 'xft:courier:pixelsize=16' -fg #000000 -bg #ffffff"
alias fwup='sudo ifconfig firewire0 192.168.166.100 up'
alias gzip='pigz'
alias gunzip='pigz -d'
alias fastltx='pdflatex -interaction=batchmode --shell-escape -parse-first-line'
alias lp2p='/usr/bin/lp -o sides=two-sided-long-edge'
alias lp4p='/usr/bin/lp -o sides=two-sided-short-edge -o number-up=2'
alias lp8p='/usr/bin/lp -o sides=two-sided-short-edge -o number-up=4 -o landscape'
alias tmux="TERM=screen-256color tmux"
alias muxn='tmux new -s'
alias muxl='tmux list-sessions'
alias muxa='tmux attach -t'
alias biew='TERM=vt100 biew filename'
alias dmesg='dmesg -T'
alias always_on='xset dpms 0 0 0'
alias ruby="ruby20"
alias irb="irb20"
alias gem="gem20"
alias quotes='curl -s "http://download.finance.yahoo.com/d/quotes.csv?s=AAPL+AMD+GOOG&f=l1"'
alias irb='pry'
alias watch_d='while true; do clear; ps ax | grep -P "\sD\+?\s"; sleep 5; done'
if [[ -f ~/.zshrcp ]]; then
  source ~/.zshrcp
fi

bindkey -v
bindkey '^R' history-incremental-search-backward
bindkey '^A' vi-beginning-of-line
bindkey '^E' vi-end-of-line