fpath=(~/.zsh/completion $fpath) # initialize zsh auto completion system autoload -Uz compinit vcs_info; compinit zmodload -i zsh/complist autoload -U bashcompinit bashcompinit # history settings #HISTFILE=~/.histfile SAVEHIST=0 HISTSIZE=1000 source /etc/profile # no beep setopt prompt_subst autocd unsetopt beep # sane keybindings bindkey -e # define colors BLACK="%{"$'\033[01;30m'"%}" GREEN="%{"$'\033[01;32m'"%}" RED="%{"$'\033[01;31m'"%}" YELLOW="%{"$'\033[01;33m'"%}" BLUE="%{"$'\033[01;34m'"%}" BOLD="%{"$'\033[01;39m'"%}" NORM="%{"$'\033[00m'"%}" # my prefered prompt with color # %n = Username # %m = Hostname # %~ = Current Directory # %# = Shell Icon % for User, # for root PROMPT="${GREEN}%n@%m ${BLUE}%~ "'${vcs_info_msg_0_}'"${BLUE}%# ${NORM}" # continued prompt PROMPT2="${BLUE}%_> ${NORM}" # enable color in some commands eval "`dircolors -b`" export LS_COLORS="$LS_COLORS*.wmv=01;35:*.m4a=01;35:" alias ls='ls --color=auto' alias grep='grep --color=auto' alias less="less -r" alias anki='anki -b' # method to load xilinx env alias xilinx-env="emulate sh ; source /opt/Xilinx/14.7/ISE_DS/settings64.sh ; emulate zsh" alias vivado-env="emulate sh ; source /opt/Xilinx/Vivado/2014.1/settings64.sh ; emulate zsh" # debian quilt alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg" # shortcut for some commands alias l=ls alias ll=ls -la alias gq="background geeqie" alias ev="background evince" alias mpa="mpv -vo=null" alias cdg="cd \$(git root)" # vim: open multiple files in tabs by default alias vim="vim -p" # improved calender alias cal="ccal -e -f" # connect to USB tty with 115200 baud alias cusb="cu -s 115200 -l /dev/ttyUSB0" alias cacm="cu -s 115200 -l /dev/ttyACM0" # suffix aliases alias -s jpg="background gpicview" alias -s gif="background gpicview" alias -s png="background gpicview" alias -s svg="background gpicview" alias -s svgz="background eog" alias -s pdf="background evince" alias -s mkv="background mpv" alias -s m4v="background mpv" alias -s webm="background mpv" alias -s ogg="background mpv" alias -s ogv="background mpv" alias -s wmv="background mpv" alias -s mpg="background mpv" alias -s avi="background mpv" alias -s mp4="background mpv" alias -s flv="background mpv" alias -s exe="wine" alias -s vala="vim" alias -s txt="vim" alias -s doc="libreoffice" alias -s pho="gerbv" # iptv (HD) alias -g tv:ard="rtp://239.35.10.1:10000" alias -g tv:zdf="rtp://239.35.10.2:10000" alias -g tv:arte="rtp://239.35.10.3:10000" alias -g tv:kika="rtp://239.35.10.11:10000" alias -g tv:3sat="rtp://239.35.10.47:10000" alias -g tv:phoenix="rtp://239.35.10.48:10000" alias -g tv:ndr="rtp://239.35.10.50:10000" alias -g tv:sdr="rtp://239.35.10.52:10000" alias -g tv:wdr="rtp://239.35.10.53:10000" alias -g tv:zdfkultur="rtp://239.35.10.54:10000" alias -g tv:zdfneo="rtp://239.35.10.55:10000" alias -g tv:zdfinfo="rtp://239.35.10.56:10000" # usage: 'aptitude search non-debian' alias -g non-debian='~S~i!~Odebian' # function to set terminal title title() { if [[ $TERM == "xterm" || $TERM == "xterm-256color" || $TERM == "rxvt" || $TERM == "screen" ]]; then print -Pn "\e]2;$*\a" fi } # set default programs if [ $TERM = "xterm" ] ; then export TERM=xterm-256color elif [ $TERM = "screen" ] ; then export TERM=screen-256color fi export EDITOR=vim export PAGER=vimpager export BROWSER=chromium # path /sbin for ifconfig etc. export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin # function to spawn a program in the background background() { $1 $2 /dev/null 2>&1 &! } CHPWD_PROFILE='default' function chpwd_profiles() { local -x profile zstyle -s ":chpwd:profiles:${PWD}" profile profile || profile='default' if (( ${+functions[chpwd_profile_$profile]} )) ; then chpwd_profile_${profile} fi CHPWD_PROFILE="${profile}" return 0 } chpwd_functions=( ${chpwd_functions} chpwd_profiles ) # update title function precmd { vcs_info title "%n@%m %~" if [ $TMUX ] ; then export `tmux showenv WINDOWID` fi if [[ "x$WINDOWID" != "x" ]] ; then xseticon -id $WINDOWID "/usr/share/pixmaps/terminal-tango.png" fi } function preexec { title "$1" if [ "x$WINDOWID" = "x" ] ; then return 0 fi if [[ "$1" == "mutt" ]] ; then xseticon -id $WINDOWID "/usr/share/icons/Tango/22x22/apps/email.png" elif [[ `echo "$1" | grep "vim"` != "" ]] ; then xseticon -id $WINDOWID "/usr/share/pixmaps/vim-32.png" elif [[ `echo "$1" | grep "ssh"` != "" ]] ; then xseticon -id $WINDOWID "/usr/share/pixmaps/openssh.png" elif [[ `echo "$1" | grep "apt-get "` != "" ]] ; then xseticon -id $WINDOWID "/usr/share/icons/Tango/22x22/apps/system-installer.png" elif [[ `echo "$1" | grep "mpv"` != "" ]] ; then xseticon -id $WINDOWID "/usr/share/icons/hicolor/32x32/apps/mpv.png" elif [[ `echo "$1" | grep "mpa "` != "" ]] ; then xseticon -id $WINDOWID "/usr/share/icons/hicolor/32x32/apps/mpv.png" elif [[ "$1" == "htop" ]] ; then xseticon -id $WINDOWID "/usr/share/pixmaps/htop.png" elif [[ `echo "$1" | grep "make"` != "" ]] ; then xseticon -id $WINDOWID "/usr/share/icons/gnome/24x24/categories/package_development.png" elif [[ `echo "$1" | grep "git-pbuilder"` != "" ]] ; then xseticon -id $WINDOWID "/usr/share/icons/gnome/24x24/categories/package_development.png" elif [[ `echo "$1" | grep "gbp buildpackage"` != "" ]] ; then xseticon -id $WINDOWID "/usr/share/icons/gnome/24x24/categories/package_development.png" elif [[ `echo "$1" | grep "git "` != "" ]] ; then xseticon -id $WINDOWID "/usr/share/pixmaps/git.png" elif [[ "$1" == "cusb" ]] ; then xseticon -id $WINDOWID "/usr/share/pixmaps/serial.png" fi } # menus for mutt and less zstyle ':completion:*:*:less:*' menu yes select zstyle ':completion:*:*:mutt:*' menu yes select # menu for Processes zstyle ':completion:*:*:*:*:processes' menu yes select zstyle ':completion:*:*:*:*:processes' force-list always # use colors in completion zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} # VCS Info zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' zstyle ':vcs_info:*' formats '%F{5}[%F{2}%b%F{5}]%f ' zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' zstyle ':vcs_info:*' enable bzr git hg svn # tinyos directory specific configuration zstyle ':chpwd:profiles:/home/sre/src/linux(|/|/*)' profile linux zstyle ':chpwd:profiles:/home/sre/src/linux-next(|/|/*)' profile linux zstyle ':chpwd:profiles:/home/sre/src/linux-stable(|/|/*)' profile linux zstyle ':chpwd:profiles:/home/sre/src/linux-hsi(|/|/*)' profile linux zstyle ':chpwd:profiles:/home/sre/src/linux-n900(|/|/*)' profile linux zstyle ':chpwd:profiles:/home/sre/src/linux-power-supply(|/|/*)' profile linux zstyle ':chpwd:profiles:/home/sre/src/zybo/linux(|/|/*)' profile linux chpwd_profile_linux() { [[ ${profile} == ${CHPWD_PROFILE} ]] && return 1 print "Switching to profile: $profile" export PATH="/usr/lib/ccache:$PATH" export CROSS_COMPILE="arm-linux-gnueabihf-" export ARCH=arm } chpwd_profile_default() { [[ ${profile} == ${CHPWD_PROFILE} ]] && return 1 print "chpwd(): Switching to profile: $profile" export PATH=$(echo $PATH | sed "s~/usr/lib/ccache:~~g") unset CROSS_COMPILE unset ARCH } # export some variables export EMAIL="sre@ring0.de" export DEBEMAIL="sre@debian.org" export DEBSIGN_MAINT="sre@debian.org" export DEBCHANGE_RELEASE_HEURISTIC=changelog # fix java fonts export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp' # bash completion scripts have() { unset -v have PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null && have="yes" } source /etc/bash_completion.d/pmount source /etc/bash_completion.d/youtube-dl.bash-completion