## Settings for umask if (( EUID == 0 )); then umask 002 else umask 022 fi # Virtualenv support function virtual_env_prompt () { REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) } } grml_theme_add_token virtual-env -f virtual_env_prompt '%F{magenta}' '%f' zstyle ':prompt:grml:left:setup' items rc virtual-env change-root user at host path vcs percent ## ZLE tweaks ## ## use the vi navigation keys (hjkl) besides cursor keys in menu completion bindkey -M menuselect 'h' vi-backward-char # left bindkey -M menuselect 'k' vi-up-line-or-history # up bindkey -M menuselect 'l' vi-forward-char # right bindkey -M menuselect 'j' vi-down-line-or-history # bottom ## set command prediction from history, see 'man 1 zshcontrib' is4 && zrcautoload predict-on && \ zle -N predict-on && \ zle -N predict-off && \ bindkey "^X^Z" predict-on && \ bindkey "^Z" predict-off # just type '...' to get '../..' rationalise-dot() { local MATCH if [[ $LBUFFER =~ '(^|/| | |'$'\n''|\||;|&)\.\.$' ]]; then LBUFFER+=/ zle self-insert zle self-insert else zle self-insert fi } zle -N rationalise-dot bindkey . rationalise-dot ## without this, typing a . aborts incremental history search bindkey -M isearch . self-insert ## add `|' to output redirections in the history setopt histallowclobber ## alert me if something failed setopt printexitvalue ## Allow comments even in interactive shells setopt interactivecomments ## get top 10 shell commands: alias top10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10' ## miscellaneous code ## ## Use a default width of 80 for manpages for more convenient reading export MANWIDTH=${MANWIDTH:-80} ## List all occurrences of programm in current PATH plap() { emulate -L zsh if [[ $# = 0 ]] ; then echo "Usage: $0 program" echo "Example: $0 zsh" echo "Lists all occurrences of program in the current PATH." else ls -l ${^path}/*$1*(*N) fi }