# Alias definition {{{ ################################################# # the | cmd aliases alias -g L='| less' alias -g H='| head' alias -g T='| tail' alias -g G='| grep' # > aliases alias -g NE='2> /dev/null' alias -g NO='> /dev/null' alias -g NOE='&> /dev/null' # "vim" mappings alias :e='gvim' alias :q='exit' # ls alias ls='ls --color=auto' alias ll='ls -l' alias la='ls -a' # emerge stuff alias AK='ACCEPT_KEYWORDS="~x86"' alias NS='FEATURES="nostrip" CFLAGS="-O0 -ggdb -pipe -march=native" CXXFLAGS="${CFLAGS}"' alias e="eix -e" alias i="eix -I" alias ee='open_ebuild vim' alias eeg='open_ebuild gvim' alias cdu='open_ebuild _cdu' alias unpack='open_ebuild _unpack' # misc alias cdp='cd ~/dev/portato' alias g='git' alias h='history' alias pstart='./portato.py -F' alias quickweb='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"' alias CH='./configure --help | less' alias FF='noglob firefox' alias IE='isabelle emacs -m iff' # suffixes alias -s exe='wine' alias -s pdf='xdg-open' alias -s JPG='feh -F' alias -s jpg='feh -F' alias -s png='feh -F' alias -s zip='unzip' alias -s gz='tar -xf' alias -s bz2='tar -xf' alias -s rar='rar -e' alias -s mp3='mplayer' alias -s ogg='mplayer' alias -s flac='mplayer' # ~/.bins stuff alias sdedit='java -jar ~/.bins/sdedit-3.0.4.jar' # the config management stuff alias config='GIT_DIR=$HOME/.config.git/ git --work-tree=$HOME' alias cstg='GIT_DIR=$HOME/.config.git stg' alias caf='config add -f' # }}} # Functions {{{ ################################################# source ~/.zsh/zshfunctions # }}} # Test for an interactive shell {{{ # There is no need to set anything past this point for scp and rcp, # and it's important to refrain from outputting anything in those cases. if [[ $- != *i* ]] ; then # Shell is non-interactive. Be done now! return fi # }}} # Completion {{{ ################################################# autoload -U compinit compinit zmodload -i zsh/complist zstyle ':completion::complete:*' use-cache 1 # the different style options zstyle ":completion:*" verbose yes # be verbose zstyle ":completion:*:descriptions" format "%S%d%s" # show descriptions zstyle ":completion:*:corrections" format "%S%d%s" zstyle ":completion:*:warnings" format "%S%d%s" zstyle ":completion:*:errors" format "%S%d%s" zstyle ":completion:*" menu select=2 # show menu zstyle ":completion:*:default" select-prompt "%SMatch %M %P%s" # show statusline zstyle ":completion::complete:*" rehash true # rehash always :) # colors [[ -z $LS_COLORS ]] && eval $(dircolors) # needed for next line zstyle ":completion:*:default" list-colors ${(s.:.)LS_COLORS} # make filecompletions being colored # do not show the current directory for e.g. cd ../ zstyle ':completion:*:cd:*' ignore-parents parent pwd # }}} # Prompt {{{ ################################################# autoload -U promptinit promptinit local prompt_color="green red" [[ -n "$SSH_CLIENT" ]] && prompt_color="yellow cyan" prompt necoro blue ${=prompt_color} # remove RPROMPT when command finished setopt transient_rprompt # load colors autoload -U colors colors # show smilies in prompt :) RPROMPT="%(?.%S%{$fg[green]%}:).%S%{$fg[red]%}:()%{$reset_color%}%s" # Screen indication [[ $TERM == "screen" ]] && RPROMPT="${RPROMPT} %B%{$fg[cyan]%}(S #$WINDOW)%{$reset_color%}%b" # vcs stuff for prompt setopt prompt_subst if [[ $ZSH_VERSION == 4.3.<->* ]]; then autoload -Uz vcs_info zstyle ":vcs_info:*" enable bzr cvs svn git hg zstyle ":vcs_info:*" formats "%B%{$fg[yellow]%}[%{$fg[green]%}(%u%c) %{$fg[yellow]%}%b:%1.7i%f%%b (%s)%B%{$fg[yellow]%}]%f%%b" zstyle ":vcs_info:*" branchformat "%b" zstyle ":vcs_info:*" get-revision true zstyle ":vcs_info:*" check-for-changes true zstyle ":vcs_info:*" max-exports 1 # hg stuff zstyle ":vcs_info:hg:*" unstagedstr '*' zstyle ":vcs_info:hg:*" hgrevformat '%r' # bzr stuff zstyle ":vcs_info:bzr:*" unstagedstr '*' zstyle ":vcs_info:bzr:*" use-simple true RPROMPT='${vcs_info_msg_0_:+"${vcs_info_msg_0_} "}'"${RPROMPT}" else vcs_info () {} # dummy fi # }}} # XTerm Window Title {{{ ################################################# autoload promptnl case $TERM in xterm*|rxvt*|Eterm) precmd() { echo -ne "\033]0;${USER}@$(hostname):${PWD/$HOME/~}\007"; promptnl vcs_info } ;; screen|linux) precmd() { echo -ne "\033_${USER}@$(hostname):${PWD/$HOME/~}\033\\"; promptnl vcs_info } ;; esac # }}} # Key bindings {{{ ################################################# bindkey -e # use emacs style :) if [[ $ZSH_VERSION == 4.3.* ]]; then bindkey "^R" history-incremental-pattern-search-backward bindkey "^S" history-incremental-pattern-search-forward else bindkey "^R" history-incremental-search-backward bindkey "^S" history-incremental-search-forward fi bindkey "^[-" copy-prev-word # delete previous word upto next whitespace bindkey "^ew" backward-kill-word # some 'insert x before' things for word c in sudo s vim v AK a; do eval "insert-$word() { LBUFFER=\"$word \$LBUFFER\" }" zle -N insert-$word bindkey "^[i$c" insert-$word done case $TERM in xterm*|aterm|rxvt) bindkey "^[OH" beginning-of-line bindkey "^[OF" end-of-line bindkey "^[[3~" delete-char ;; screen) bindkey "^[[1~" beginning-of-line bindkey "^[[4~" end-of-line bindkey "^[[3~" delete-char ;; esac # }}} # History {{{ ################################################# HISTSIZE=10000 SAVEHIST=12000 HISTFILE=~/.zshhistory setopt hist_no_store # do not store history related commands setopt inc_append_history # append incrementally instead of waiting until the shell exists setopt share_history # share the history between sessions setopt hist_verify # for history related commands: reload the expanded version instead of executing it directly setopt hist_no_functions # do not store function definitions setopt hist_ignore_dups # ignore duplicates setopt hist_ignore_all_dups # ignore _all_ duplicates # }}} # Misc Options {{{ ################################################# setopt no_notify # do not disturb if bg-process has quit setopt no_bg_nice # start bg-processes with the same nice-level as fg-p~ setopt auto_cd # if you type a dir take it as a cd setopt correct # correct possibly wrong command names setopt complete_in_word setopt auto_continue # disown implies 'bg' # }}} # Rest {{{ ################################################# # load zmv autoload -U zmv # }}} # vim: fdm=marker