# vim:nospell:foldmethod=marker:foldmarker={{,}}: source ~/.zsh/zshrc_coco autoload -U colors autoload -U compinit #autoload bashcompinit #bashcompinit colors compinit setopt NULL_GLOB setopt auto_pushd setopt extendedglob setopt kshglob setopt prompt_subst setopt share_history setopt autopushd setopt pushdignoredups setopt pushdminus autoload -U url-quote-magic zle -N self-insert url-quote-magic # Set a nice git-prompt (calls git_status()) {{ git_prompt_info() { local git_dir ref br; git_dir=$(git rev-parse --git-dir 2> /dev/null) || return ref=$(git symbolic-ref HEAD 2> /dev/null) || return branch_prompt=${ref#refs/heads/} if [ -n "$branch_prompt" ]; then if [[ $PWD != *".git"* ]]; then status_icon=$(git_status) fi echo "$status_icon%{$fg[yellow]%} [$branch_prompt]" fi } # Show character if index and/or work-tree are dirty git_status() { git diff --cached --quiet if [[ $? == 1 ]]; then output="%{$fg[green]%}+" fi git diff --quiet if [[ $? == 1 ]]; then output="$output%{$fg[red]%}*" fi echo $output } # }} # {{ typeset -A HOST_COLORS HOST_COLORS=(www cyan datenbank magenta fileserver blue guardian green) export RPS1='$(git_prompt_info) %{$reset_color%}%*' if [[ "$USER" == "root" ]] ; then export PS1='[%?]%{$fg[red]%}%n%{$reset_color%}@%m:%~# ' else if [[ -n "$SSH_CLIENT" ]]; then export PS1='[%?]%{$fg[green]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}:%~\$ ' else export PS1='[%?]%{$fg[green]%}%n%{$reset_color%}@%m:%~\$ ' fi if [[ -n "$HOST_COLORS[$(hostname -s)]" ]]; then export PS1='[%?]%{$fg[green]%}%n%{$reset_color%}@%{$fg[$HOST_COLORS[$(hostname -s)]]%}%m%{$reset_color%}:%~\$ ' fi fi local _myhosts _myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#.*}%%\ *}%%,*} ) zstyle ':completion:*:(ssh|scp)' hosts $_myhosts zstyle ':completion:*' special-dirs true zstyle ':completion:*' menu select=3 # source the bash-completion for the newest git #if [ -f ~/.git-completion.bash ] ; then # source ~/.git-completion.bash #fi #}} # mapping of functions keys# {{ bindkey '^A' beginning-of-line # Home bindkey '^E' end-of-line # End bindkey '^D' delete-char # Del bindkey '^R' history-incremental-search-backward # reverse history search bindkey '^[[3~' delete-char # Del bindkey '^[[2~' overwrite-mode # Insert bindkey '^[[5~' history-search-backward # PgUp bindkey '^[[6~' history-search-forward # PgDn bindkey "\e\e[D" backward-word bindkey "\e\e[C" forward-word # }} HISTFILE="$HOME/.zsh_history" HISTSIZE=5000 SAVEHIST=5000 alias ll='ls -l' alias la='ls -A' alias l='ls -CF' alias rm="rm -i" alias mv="mv -i" alias cp_p='rsync -WavP' alias key='eval `ssh-agent -t 3600`; ssh-add' alias grep='grep --color=always' alias keyboard='xmodmap ~/.Xmodmap; xset r rate 500 50; xset dpms 1800 3600; xset m 0.9/1; xset r 113; xset r 116; xset +dpms; xbacklight -display :0 -inc 100' alias gdb='gdb -q' alias dirsize='tee /tmp/du.txt|grep -E "[0123456789]M"|sort -n ; grep -E "[0123456789]G" /tmp/du.txt| sort -n; rm -rf /tmp/du.txt' alias dirsizes=' du -cms .[^.]*/ */ | sort -n' alias myip='wget -q -O - checkip.dyndns.org | sed -e "s/[^[:digit:]|.]//g"' alias config='git --git-dir=$HOME/.config.git/ --work-tree=$HOME' alias llgal_prepare='mkdir -p .llgal; for file in *.{jpg,JPG,png};do convert -resize 800x600 $file .llgal/scaled_$file; convert -resize 160x85 $file .llgal/thumb_$file; done' alias a2ps='a2ps -R --columns=1 -M A4 --line-numbers=1 -s 2 -f9' case $TERM in xterm|rxvt|rxvt-unicode|rxvt-256color) precmd () {print -Pn "\e]0;%n@%m: %~\a"} preexec () {print -Pn "\e]0;%n@%m: %~ - $1\a"} alias news='TERM=xterm-256color slrn -n -C -h news.cis.dfn.de' alias gmane='TERM=xterm-256color slrn -n -C -h news.gmane.org -f ~/.gmanerc' alias halifax='TERM=xterm-256color slrn -n -C -h news.halifax.rwth-aachen.de -f ~/.halifaxrc' alias mutt='TERM=xterm-256color mutt' ;; esac mutti () { mutt -F ~/.mutt/profile.$* } pdfgrep () { for file in $*; do echo "=== $file ===" pdftotext $file - | grep --color -i $1 done } git_sync () { CURDIR=$PWD for dir in $(find $* -name "*.git" -type d) do cd $CURDIR/$dir/../ && if [[ -n $(git remote) ]] then echo "*** Pulling in dir $PWD" && git pull -q && git gc --quiet; fi done cd $CURDIR echo "*** All done!" } git_gc () { CURDIR=$PWD for dir in $(find $* -name "*.git" -type d) do cd $CURDIR/$dir/../ echo "*** GC in dir $PWD" && git gc --quiet done cd $CURDIR echo "*** All done!" } export EDITOR=vim export LESS="$LESS -J" export GREP_COLOR='01;32' export MANPATH=~/local/share/man:$MANPATH export PATH=~/local/bin:~/local/sbin:$PATH:/sbin:/usr/sbin export MAILDIR=~/.Mail export TEXMFHOME=~/.texmf export BROWSER=google-chrome export LC_ALL=en_US.utf8 export LANG=en_US.utf8 if [[ $HOST == "dualtron" || $HOST == "minime" || $HOST == "optiplex" || $HOST == "blackbox" || $HOST == "banff" ]]; then export PATH=$PATH:/usr/kde/3.5/bin export NOCOLOR_PIPE=1 export LANG=en_US.utf8 export G_BROKEN_FILENAMES=1 alias screenstandby='sleep 1; xset dpms force standby' alias shareX='DISPLAY=0:0 x11vnc -shared -forever -scale 0.8 -passwd foobar' alias pidgin_on='purple-remote "setstatus?status=available"' alias pidgin_off='purple-remote "setstatus?status=offline"' alias hibernate_sync='su jojo -c "purple-remote setstatus\?status\=offline"; sync; echo 3 > /proc/sys/vm/drop_caches; su jojo -c "gnome-screensaver-command -l"; hibernate; su jojo -c "purple-remote setstatus\?status\=available"; su jojo -c "killall -USR1 offlineimap"; ntpdate timeserver.rwth-aachen.de' alias suspend_sync='su jojo -c "xscreensaver-command -lock"; pm-suspend' hash -d orga=/home/jojo/git/itsec/orga hash -d lab=/home/jojo/git/itsec/ss13-lab/lab13 fi if [[ $HOST == "minime" ]]; then export LC_ALL=en_US.utf8 alias temp='cat /sys/class/thermal/thermal_zone0/temp' fi if [[ $HOST == "dualtron" ]]; then export LC_ALL=en_US.utf8 export GL_FSAA_MODE=0 # originally set to 4 alias printerenable='/usr/bin/enable laserjet1320' fi if [[ $HOST == "raspberrypi" ]]; then export LC_ALL=en_GB.utf8 fi if [[ $HOST == "optiplex" ]]; then export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/lib export PATH=$PATH:/usr/local/cuda/bin:/usr/lib/mutt fi if [[ $HOST == "blackbox" ]]; then alias single_monitor='xrandr --output HDMI2 --auto --output HDMI2 --primary --output HDMI1 --off --output LVDS1 --off; keyboard; xbacklight -set 100' alias dual_monitor='xrandr --output HDMI2 --auto; xrandr --output LVDS1 --off; xrandr --output HDMI1 --auto --output HDMI2 --auto --output HDMI2 --primary --output HDMI1 --left-of HDMI2; xset dpms force off; xset dpms force on; xsetroot -solid grey6; keyboard; xbacklight -set 100' alias monitor_dock='xrandr --output HDMI2 --auto --output HDMI2 --primary --output HDMI1 --off; xrandr --output LVDS1 --auto --output LVDS1 --right-of HDMI2; xset dpms force off; xset dpms force on; xsetroot -solid grey6; keyboard; xbacklight -set 100' alias undock='xrandr --output HDMI2 --off --output HDMI1 --off; xrandr --output LVDS1 --auto; xset dpms force off; xset dpms force on; xsetroot -solid grey6; keyboard; xbacklight -display :0 -dec 50' alias cpu_save='echo powersave > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor' alias cpu_demand='echo "ondemand" > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor' export PATH=$PATH:/opt/msp430-47/bin fi if [[ `uname` == "Darwin" ]]; then export MANPATH=~/local/share/man:/sw/share/man:/usr/share/man:$MANPATH export PATH=/usr/local/Cellar/ruby/1.9.3-p362/bin:$PATH::/usr/X11/bin:/usr/X11/sbin:/Developer/usr/bin:/usr/local/share/npm/bin export LC_ALL=en_US.UTF-8 export PERL5LIB=$PERLLIB:/sw/lib/perl5 export LSCOLORS="cxfxcxdxbxegedabagacad" if [[ $TERM == "rxvt-unicode" ]] ; then export TERM=rxvt fi alias ls='ls -G -F' alias exiftool='PERL5LIB=/sw/lib/perl5 exiftool' alias temp='/Applications/TemperatureMonitor.app/Contents/MacOS/tempmonitor -a -c -l' alias proxy_off='networksetup -setsocksfirewallproxystate Wi-Fi off' alias proxy_on='networksetup -setsocksfirewallproxystate Wi-Fi on' alias hibernate="osascript -e 'tell application \"Finder\" to sleep' && sleep 5 && sudo /System/Library/StartupItems/NetworkTime/NetworkTime restart" alias xlock='open /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app' alias change_ap='sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -z; sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --associate="heipei" --bssid="00:18:f8:46:3d:68" --password="daheipei02196"' else eval "`dircolors -b ~/.dircolors`" alias ls='ls --color=auto -F' fi