From a2e767e164cb1e8859a30078c89df25e1f611f38 Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Sun, 15 Feb 2015 12:31:57 +0100 Subject: Initial import of own zshrc files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They depend on grml’s zshrc. Signed-off-by: Thomas Schneider --- dot.zshrc.from_grml | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 dot.zshrc.from_grml (limited to 'dot.zshrc.from_grml') diff --git a/dot.zshrc.from_grml b/dot.zshrc.from_grml new file mode 100644 index 0000000..d9050ca --- /dev/null +++ b/dot.zshrc.from_grml @@ -0,0 +1,74 @@ +## 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 +} \ No newline at end of file -- cgit v1.2.3