summaryrefslogtreecommitdiff
path: root/zsh/.zshrc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2016-04-14 17:33:23 +0200
committerPatrick Simianer <p@simianer.de>2016-04-14 17:33:23 +0200
commitb8c332698aa30a78e6bdc3d38a6b9083af2b5b1e (patch)
tree8a6c5d4f312939d5c268d14e56cbede2379627b8 /zsh/.zshrc
parent79b7582c400720d0b55e3aed2768a8eb1e3958df (diff)
zsh: spring cleaning
Diffstat (limited to 'zsh/.zshrc')
-rw-r--r--zsh/.zshrc253
1 files changed, 127 insertions, 126 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 0d3f15d..ce6a023 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -1,134 +1,149 @@
-zstyle ':completion:*' completer _complete _ignored
-zstyle :compinstall filename '~/.zshrc'
-fpath=(~/.zsh/completions $fpath)
+# #############################################################################
+# zsh
+# #############################################################################
+
autoload -Uz compinit promptinit
compinit
+fpath=(~/.zsh/completions $fpath)
+compctl -K tln muxa
+compdef mosh=ssh
promptinit
-zstyle ':completion:*' menu select=2
-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 no_multios
+bindkey -v
+bindkey '^R' history-incremental-search-backward
+bindkey '^A' vi-beginning-of-line
+bindkey '^E' vi-end-of-line
+zstyle ':completion:*' completer _complete _ignored
+zstyle ':completion:*' menu select=2
+zstyle :compinstall filename '~/.zshrc'
+zstyle '*' hosts # do not use /etc/hosts
-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
-}
+# #############################################################################
+# exports
+# #############################################################################
umask 0077
-export PATH=~/bin:/home/pks/bin:~/scripts:~/lib/ruby/bin:~/lib/python/site-packages:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
-export RUBYOPT=-Ku
-export CCACHE_PATH=/usr/bin
-export TEXMFHOME='~/.texmf'
+export PATH=~/bin:/home/pks/bin:~/scripts:$PATH
+export PATH=~/lib/ruby/bin:$PATH
+export PATH=~/lib/python/site-packages:$PATH
+export PATH=~/lib/node/bin:$PATH
+export PATH=/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
+
export EDITOR='vim -p'
+
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
+
+export RUBYOPT=-Ku
export GEM_HOME=$HOME/lib/ruby/
export GEM_PATH=$HOME/lib/ruby/:$GEM_PATH
+
export PYTHONPATH=$PYTHONPATH:~/lib/python/site-packages
+
+export TEXMFHOME='~/.texmf'
+
export CFLAGS="-march=native -mtune=native"
export CXXFLAGS="$CFLAGS"
+export CCACHE_PATH=/usr/bin
-case $TERM in
- *256color*)
- precmd () {print -Pn "\e]0;%n@%m%~\a"}
- preexec () {print -Pn "\e]0;%n@%m%~ -- $1\a"}
- ;;
-esac
+# #############################################################################
+# terminal
+# #############################################################################
case $TERM in
- screen-256color)
- ;;
+ screen-256color) ;;
*)
TERM=xterm-256color
;;
esac
+stty -ixon # enable mapping of C-s in vim..
+
+# #############################################################################
+# prompt
+# #############################################################################
+
autoload -U colors && colors
+
case `hostname` in
2pac)
- HOSTCOLOR=green
+ HOSTCOLOR_BG=green
+ HOSTCOLOR_FG=black
;;
CLuster|node*|gpu*)
- HOSTCOLOR=cyan
+ HOSTCOLOR_BG=cyan
+ HOSTCOLOR_FG=black
;;
coltrane)
- HOSTCOLOR=blue
+ HOSTCOLOR_BG=blue
+ HOSTCOLOR_FG=black
;;
donna)
- HOSTCOLOR=red
+ HOSTCOLOR_BG=red
+ HOSTCOLOR_FG=black
;;
vicious)
- HOSTCOLOR=yellow
+ HOSTCOLOR_BG=yellow
+ HOSTCOLOR_FG=black
+ ;;
+ lemmy)
+ HOSTCOLOR_BG=black
+ HOSTCOLOR_FG=white
;;
x|pi*|*.uberspace.de)
- HOSTCOLOR=magenta
+ HOSTCOLOR_BG=magenta
+ HOSTCOLOR_FG=black
;;
*)
- HOSTCOLOR=white
+ HOSTCOLOR_BG=white
+ HOSTCOLOR_FG=black
;;
esac
-case `hostname` in
- 2pac|CLuster|node*|gpu*|coltrane|donna|vicious|lemmy)
- PROMPT="[%m:%~]%{$fg[$HOSTCOLOR]%}%B%%%b%{$reset_color%} "
- export PATH=/home/mitarb/simianer/bin:/home/pks/bin:/opt/java/bin:/toolbox/ruby/bin:$PATH
- export GEM_HOME=/toolbox/ruby/
- export PYTHONPATH=$PYTHONPATH:/toolbox/python/lib/python2.7/site-packages
- export JAVA_HOME=/usr/lib/jvm/java-6-sun/ # debian systems w/ sun-java6
- umask u=rwx,g=rwx,o=rx
- alias tmux="tmux -f ~/.tmux.`hostname`.conf"
+case `whoami` in
+ root)
+ PROMPT="%{$bg[red]%}%{$fg[black]%}%m:%~#%{$reset_color%} "
;;
- x)
- PROMPT="[%~]%{$fg[magenta]%}$B%%%b%{$reset_color%} "
- PATH=/usr/lib/colorgcc/bin:~/src/scripts:~/lib/node/bin:$PATH
+ *)
+ PROMPT="%{$bg[$HOSTCOLOR_BG]%}%{$fg[$HOSTCOLOR_FG]%}%m%{$reset_color%}:%~> "
;;
- pi*|*.uberspace.de)
- PROMPT="[%m:%~]%{$fg[magenta]%}$B%%%b%{$reset_color%} "
- PATH=/usr/lib/colorgcc/bin:~/src/scripts:$PATH
+esac
+
+case $TERM in
+ *256color*)
+ precmd () {print -Pn "\e]0;%n@%m%~\a"}
+ preexec () {print -Pn "\e]0;%n@%m%~ -- $1\a"}
;;
esac
+# #############################################################################
+# host specifics
+# #############################################################################
+
case `hostname` in
- 2pac|CLuster|node*|gpu*)
- export GEM_HOME=$HOME/lib/ruby/
- export GEM_PATH=/toolbox/ruby/:$GEM_PATH
+ 2pac|CLuster|node*|gpu*|coltrane|donna|vicious|lemmy)
+ umask u=rwx,g=rwx,o=rx
+ alias tmux="tmux -f ~/.tmux.`hostname`.conf"
;;
- coltrane|donna|vicious)
- export PATH=/toolbox/scripts:$PATH
+ x|pi*|*.uberspace.de)
+ PATH=/usr/lib/colorgcc/bin:~/src/scripts:$PATH
;;
esac
case `hostname` in
CLuster|node*|gpu*)
- alias tmux="tmux -f ~/.tmux.CLuster.conf"
+ alias tmux="tmux -f ~/.tmux.cluster.conf"
;;
esac
-function youtube() { mplayer -xy 0.5 $(youtube-dl -g "$@") ;}
+# #############################################################################
+# aliases
+# #############################################################################
alias ls='ls -h --color=auto'
alias l='ls'
@@ -138,87 +153,59 @@ 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 git='git -c color.status=always'
+alias grep='grep --color=auto'
+alias pdf='mupdf'
+alias py='bpython'
+alias vi=$EDITOR
+
alias mergepdf='texexec --pdfarrange --noduplex --result merged.pdf '
alias mergepdfgs=' gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=gsmerged.pdf -dBATCH'
alias pdfprevfile='pdftoppm -f 1 -l 1 -singlefile -jpeg'
alias thumb='convert -resize 200x200'
-alias updatedb='sudo updatedb'
+
alias qmv='qmv -evim -fdo'
-alias dusage='du -hs *'
-alias df='df -h'
-alias iwlist='sudo iwlist wlan0 scan'
-alias fumount='fusermount -u'
-alias more='less'
-alias vpnc='sudo vpnc'
+alias radio='mocp ~/.moc/radio.m3u'
+
+alias wifi_list='sudo iwlist wlan0 scan'
+alias kill_wifi='sudo /etc/init.d/dhcpcd stop || sudo killall wpa_supplicant'
+
+alias always_on='xset dpms 0 0 0'
alias vgaoff='xrandr --output VGA1 --off && xrandr --output LVDS1 --mode 1024x768'
alias vgaclone='xrandr --output VGA1 --mode 1024x768'
alias vgaext='xrandr --output VGA1 --mode 1024x768 --left-of LVDS1 --rotate right'
alias vga21='xrandr --output VGA1 --mode 1600x1200 --rate 60 --rotate right && xrandr --output LVDS1 --off'
-alias vga22w='xrandr --output VGA1 --mode 1680x1050 --rate 60 --rotate right && xrandr --output LVDS1 --off'
+alias vga22w='xrandr --output VGA1 --mode 1680x1050 --rate 60 --rotate left && xrandr --output LVDS1 --off'
+
alias reboot='sudo shutdown -r now'
alias halt='sudo shutdown -h now'
-alias lock='slock'
-alias demoterm="urxvt -fn 'xft:Tamsyn:pixelsize=18' -fg #000000 -bg #ffffff"
-alias fwup='sudo ifconfig firewire0 192.168.166.100 up'
-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 lpimg='/usr/bin/lp -o fit-to-page'
+
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 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'
+
alias easy_install_home='easy_install --install-dir=$HOME/lib/python/site-packages'
-alias uberspace='mosh -p 60666 pks@alphard.uberspace.de'
-alias my_ip='echo "$(curl 'https://api.ipify.org' 2>/dev/null)"'
-alias t_timeline='while true; do clear; t timeline -n 13 -C icon; sleep 600; done'
-alias cal='while true; do clear; echo; khal calendar; sleep 600; done'
-alias gitc='git -c color.status=always'
alias npm_install='npm install -g --prefix ./lib/node'
-alias ssh_legacy='ssh -oKexAlgorithms=+diffie-hellman-group1-sha1'
-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
-tln() {
- reply=( $(tmux list-sessions | cut -d: -f1) )
-}
-
-lsof_kill() {
- lsof $1 | grep -v COMMAND | cut -d " " -f 2- | strips | cut -d " " -f 1 | xargs kill
-}
-
-compctl -K tln muxa
+alias my_ip='echo "$(curl 'https://api.ipify.org' 2>/dev/null)"'
-case `whoami` in
- root)
- PROMPT=$'\e[0;31m[%~]# \e[0m'
- ;;
-esac
+alias cal='while true; do clear; echo; khal calendar; sleep 600; done'
+alias t_timeline='while true; do clear; t timeline -n 13 -C icon; sleep 600; done'
-stty -ixon # enable mapping of C-s in vim..
+# #############################################################################
+# functions
+# #############################################################################
-ciff () {
+diff ()
+{
if hash colordiff 2>/dev/null; then
colordiff "$@"
else
@@ -226,3 +213,17 @@ ciff () {
fi
}
+irb ()
+{
+ if hash pry 2>/dev/null; then
+ pry "$@"
+ else
+ irb "$@"
+ fi
+}
+
+lsof_kill()
+{
+ lsof $1 | grep -v COMMAND | cut -d " " -f 2- | strips | cut -d " " -f 1 | xargs kill
+}
+