# vim:nospell: # Prompt File stuff if [ -f ~/.zshrc_local ] ; then source ~/.zshrc_local fi setopt prompt_subst # 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 } # Prompt looks like this: "[returncode]user@host:path$ " for normal users # and the same for root, except root is painted red and '#' instead of '$' export PS1='[%?]%{$fg[green]%}%n%{$reset_color%}@%m:%~\$ ' export RPS1='$(git_prompt_info) %{$reset_color%}%*' if [[ "$USER" == "root" ]] ; then export PS1='[%?]%{$fg[red]%}%n%{$reset_color%}@%m:%~# ' fi export EDITOR=vim export LESS="$LESS -J" export GREP_COLOR='01;32' # color grep matches green alias grep='grep --color' # Completion for "ssh $foo" where foo is in .ssh/known_hosts function ssh_var () { ssh_hosts=(`cut -f 1 -d ' ' -s .ssh/known_hosts* | cut -f 1 -d ','`) compctl -k ssh_hosts ssh reply=($ssh_hosts) } #compctl -K ssh_var ssh; ssh_hosts=() # ssh/scp host completion from .ssh/known_hosts local _myhosts _myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#.*}%%\ *}%%,*} ) #_myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} ) zstyle ':completion:*:(ssh|scp)' hosts $_myhosts setopt share_history autoload compinit compinit autoload bashcompinit setopt extendedglob autoload -U colors colors bashcompinit setopt kshglob 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 # History File stuff HISTFILE="$HOME/.zsh_history" HISTSIZE=5000 SAVEHIST=5000 #autoload -U history-search-end #zle -N history-beginning-search-backward-end history-search-end #zle -N history-beginning-search-forward-end history-search-end #bindkey "\e[A" history-beginning-search-backward-end #bindkey "\e[B" history-beginning-search-forward-end # ls Aliases alias ll='ls -l' alias la='ls -A' alias l='ls -CF' alias rm="rm -i" #alias cp="cp -i" alias mv="mv -i" # SSH Aliases alias key='eval `ssh-agent -t 3600`; ssh-add' alias news='slrn -n -C -h news.cis.dfn.de' alias gmane='slrn -n -C -h news.gmane.org -f ~/.gmanerc' alias halifax='slrn -n -C -h news.halifax.rwth-aachen.de -f ~/.halifaxrc' alias difftool='git difftool --tool=vimdiff -U99999' 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' case $TERM in xterm|rxvt|rxvt-unicode) precmd () {print -Pn "\e]0;%n@%m: %~\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 mutt='TERM=xterm-256color mutt -F ~/.mutt/muttrc_256' ;; esac mutti () { mutt -F ~/.mutt/profile.$* } setopt auto_pushd # 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