From b289b28054f9f3764ff575b7c2abd6d023cb04cb Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 7 May 2008 19:27:34 +0100 Subject: [PATCH 01/16] no need for semicolons at eol --- .zsh/zshrc/20_compsys | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.zsh/zshrc/20_compsys b/.zsh/zshrc/20_compsys index 3003f88..76243ca 100644 --- a/.zsh/zshrc/20_compsys +++ b/.zsh/zshrc/20_compsys @@ -48,9 +48,9 @@ zstyle ':completion:*:(all-|)files' ignored-patterns \ '*.bk' '*.bak' '*.old' '*~' '.*.sw?' # populate hosts completion with SSH's known_hosts -local _myhosts; +local _myhosts _myhosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*}) -zstyle ':completion:*' hosts $_myhosts; +zstyle ':completion:*' hosts $_myhosts zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3)) numeric )' -- 2.39.5 From fde91cf5d1d61794601427b1be18535d2787b934 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 7 May 2008 19:28:53 +0100 Subject: [PATCH 02/16] commend bindkeys --- .zsh/zshrc/80_bindkeys | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.zsh/zshrc/80_bindkeys b/.zsh/zshrc/80_bindkeys index c107147..999d2db 100644 --- a/.zsh/zshrc/80_bindkeys +++ b/.zsh/zshrc/80_bindkeys @@ -8,7 +8,9 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # +# use emacs keybindings by default bindkey -e + # history expansion on pressing space bindkey ' ' magic-space -- 2.39.5 From af0c689d498bcb9620503480fac4a399540eaa7e Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 7 May 2008 19:29:35 +0100 Subject: [PATCH 03/16] remove unneeded variable --- .zsh/zshrc/80_history | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.zsh/zshrc/80_history b/.zsh/zshrc/80_history index e515b51..708ea41 100644 --- a/.zsh/zshrc/80_history +++ b/.zsh/zshrc/80_history @@ -8,8 +8,7 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -DEFAULT_HISTFILE=$ZVAR/history -HISTFILE=$DEFAULT_HISTFILE +HISTFILE=$ZVAR/history HISTSIZE=10000 SAVEHIST=$HISTSIZE LISTMAX=1000 -- 2.39.5 From 94d636df611af7488796321ab0eddd1d5710f5a7 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 7 May 2008 19:30:01 +0100 Subject: [PATCH 04/16] use local variables and do not unset --- .zsh/zshrc/80_prompt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.zsh/zshrc/80_prompt b/.zsh/zshrc/80_prompt index 8c86514..dfedff9 100644 --- a/.zsh/zshrc/80_prompt +++ b/.zsh/zshrc/80_prompt @@ -8,15 +8,13 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -_MIDDLE="%1v%(2v.|%B%2v%b|.)%(3v.%3v.)" +local _MIDDLE="%1v%(2v.|%B%2v%b|.)%(3v.%3v.)" +local _PS1_HL if is_root; then _MIDDLE="%25<..<%~%<<" _PS1_HL=U fi PS1="%${_PS1_HL:=B}%m%${(L)_PS1_HL}:${_MIDDLE}%# " -unset _PS1_HL -unset _MIDDLE - RPS1="#%(0?..%?,)%!" # vim:ft=zsh -- 2.39.5 From e4b0055e84227e2cc7a6572a609a15b5e98e0bf5 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 7 May 2008 20:01:14 +0100 Subject: [PATCH 05/16] add some options from the guide --- .zsh/zshrc/99_TODO | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.zsh/zshrc/99_TODO b/.zsh/zshrc/99_TODO index d84e91e..af4faec 100644 --- a/.zsh/zshrc/99_TODO +++ b/.zsh/zshrc/99_TODO @@ -23,18 +23,24 @@ setopt autopushd pushdminus pushdsilent pushdtohome # brace expansion setopt braceccl -# print backgrounded jobs when they finish +# report immediately when background jobs finish setopt notify -# bg-processes should not be nice -unsetopt bgnice -# send no HUP signal to running jobs when the shell exits +# do not auto-nice background processes +setopt no_bgnice +# do not send HUP signal to jobs when the shell exits setopt nohup -# don't bother me with running jobs (only wize with setopt nohup) -unsetopt checkjobs +# do alert me of running jobs before exiting +setopt checkjobs # disable backslashed escape sequences unless -e is given to echo setopt bsd_echo +# don't bitch about bad patterns, just use them verbatim +setopt no_bad_pattern + +# don't bitch about no matches, just the glob character verbatim +setopt no_nomatch + [ "$(umask)" = 022 ] && umask 0077 eval `lesspipe 2>/dev/null` -- 2.39.5 From 470a84de742d5b803ae217ad4b282bfbce1c1e6a Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 7 May 2008 20:01:43 +0100 Subject: [PATCH 06/16] prefix prompt with + for subshells --- .zsh/zshrc/80_prompt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zsh/zshrc/80_prompt b/.zsh/zshrc/80_prompt index dfedff9..41763ac 100644 --- a/.zsh/zshrc/80_prompt +++ b/.zsh/zshrc/80_prompt @@ -14,7 +14,7 @@ if is_root; then _MIDDLE="%25<..<%~%<<" _PS1_HL=U fi -PS1="%${_PS1_HL:=B}%m%${(L)_PS1_HL}:${_MIDDLE}%# " +PS1="%(2L.+.)%${_PS1_HL:=B}%m%${(L)_PS1_HL}:${_MIDDLE}%# " RPS1="#%(0?..%?,)%!" # vim:ft=zsh -- 2.39.5 From f925367a557a1544bc54b808833789ea2ed59f81 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 7 May 2008 20:20:12 +0100 Subject: [PATCH 07/16] add some options from the guide --- .zsh/zshrc/99_TODO | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.zsh/zshrc/99_TODO b/.zsh/zshrc/99_TODO index af4faec..83a8412 100644 --- a/.zsh/zshrc/99_TODO +++ b/.zsh/zshrc/99_TODO @@ -41,6 +41,9 @@ setopt no_bad_pattern # don't bitch about no matches, just the glob character verbatim setopt no_nomatch +# do. not. ever. beep. +setopt no_beep + [ "$(umask)" = 022 ] && umask 0077 eval `lesspipe 2>/dev/null` -- 2.39.5 From d4d4aa99cf780f86aae1ba1b49067e4d3782b30e Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 7 May 2008 21:15:57 +0100 Subject: [PATCH 08/16] purer implementation of ldir --- .zsh/zshrc/99_TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zsh/zshrc/99_TODO b/.zsh/zshrc/99_TODO index 83a8412..63cf6c4 100644 --- a/.zsh/zshrc/99_TODO +++ b/.zsh/zshrc/99_TODO @@ -9,7 +9,7 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -ldir() { eval $1="$PWD" ; : ~$1 } +ldir() { eval hash -d $1="$PWD"; cd .; } alias Q='exec zsh' alias ozsh='ZDOTDIR=$HOME/.etc/zsh exec zsh' -- 2.39.5 From 77bc157163da3f5f9fd2c300733f505ffce8763c Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 8 May 2008 11:45:18 +0100 Subject: [PATCH 09/16] fix up rdir names --- .zsh/{zshenv => zprofile}/00_fpath | 2 +- .zsh/zprofile/40_zcompile | 4 ++-- .zsh/zshenv/00_rdirs | 14 +++++++++----- .zsh/zshrc/00_recompile | 2 +- .zsh/zshrc/20_compsys | 4 ++-- .zsh/zshrc/80_history | 2 +- 6 files changed, 16 insertions(+), 12 deletions(-) rename .zsh/{zshenv => zprofile}/00_fpath (90%) diff --git a/.zsh/zshenv/00_fpath b/.zsh/zprofile/00_fpath similarity index 90% rename from .zsh/zshenv/00_fpath rename to .zsh/zprofile/00_fpath index d977983..37bd6e5 100644 --- a/.zsh/zshenv/00_fpath +++ b/.zsh/zprofile/00_fpath @@ -8,6 +8,6 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -FPATH="$ZDOTDIR/func:$FPATH" +fpath=($ZDOTDIR/func $fpath) # vim:ft=zsh diff --git a/.zsh/zprofile/40_zcompile b/.zsh/zprofile/40_zcompile index 4ebd4db..0074768 100644 --- a/.zsh/zprofile/40_zcompile +++ b/.zsh/zprofile/40_zcompile @@ -9,8 +9,8 @@ # if [ -n "$ZDOTDIR" ]; then - command rm -f $ZDOTDIR/**/*.zwc(.N) $ZDOTDIR/**/.*.zwc(.N) $ZVAR/**/*.zwc(.N) - for f ($ZDOTDIR/.*(@) $ZDOTDIR/*(.) $ZDOTDIR/**/*(.) $ZVAR/comp-$HOST) \ + command rm -f $ZDOTDIR/**/*.zwc(.N) $ZDOTDIR/**/.*.zwc(.N) $ZVARDIR/**/*.zwc(.N) + for f ($ZDOTDIR/.*(@) $ZDOTDIR/*(.) $ZDOTDIR/**/*(.) $ZVARDIR/comp-$HOST) \ zcompile $f fi diff --git a/.zsh/zshenv/00_rdirs b/.zsh/zshenv/00_rdirs index 062c011..b830a95 100644 --- a/.zsh/zshenv/00_rdirs +++ b/.zsh/zshenv/00_rdirs @@ -8,10 +8,14 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -export VAR_RELATIVE=.var -export VAR=$HOME/$VAR_RELATIVE -export ZVAR=$VAR/zsh -export BIN_RELATIVE=.bin -export BIN=$HOME/$BIN_RELATIVE +export VARDIR_REL=.var +export VARDIR=$HOME/$VARDIR_REL +export ZVARDIR=$VARDIR/zsh + +export BINDIR_REL=.bin +export BINDIR=$HOME/$BINDIR_REL + +export TMPDIR_REL=.tmp +export TMPDIR=$HOME/$TMPDIR_REL # vim:ft=zsh diff --git a/.zsh/zshrc/00_recompile b/.zsh/zshrc/00_recompile index 05bb0f5..37c607c 100644 --- a/.zsh/zshrc/00_recompile +++ b/.zsh/zshrc/00_recompile @@ -8,7 +8,7 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -zrecompile $ZDOTDIR/** $ZVAR/** | while read pre file post; do +zrecompile $ZDOTDIR/** $ZVARDIR/** | while read pre file post; do case "$post" in succeeded) rm -f "${file%:}".old;; *) :;; diff --git a/.zsh/zshrc/20_compsys b/.zsh/zshrc/20_compsys index 76243ca..bb4c7c1 100644 --- a/.zsh/zshrc/20_compsys +++ b/.zsh/zshrc/20_compsys @@ -31,11 +31,11 @@ zmodload zsh/complist # initialise the completion system autoload -U compinit -compinit -d $VAR/zsh/comp-$HOST +compinit -d $ZVARDIR/comp-$HOST # cache results zstyle ':completion:*' use-cache on -zstyle ':completion:*' cache-path $ZVAR/compcache +zstyle ':completion:*' cache-path $ZVARDIR/compcache #zstyle ':completion:*' completer _list _expand _complete _ignored _match _correct _approximate _prefix zstyle ':completion:*' completer _complete _ignored _match _approximate diff --git a/.zsh/zshrc/80_history b/.zsh/zshrc/80_history index 708ea41..4a80f06 100644 --- a/.zsh/zshrc/80_history +++ b/.zsh/zshrc/80_history @@ -8,7 +8,7 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -HISTFILE=$ZVAR/history +HISTFILE=$ZVARDIR/history HISTSIZE=10000 SAVEHIST=$HISTSIZE LISTMAX=1000 -- 2.39.5 From 1b92289b17509336e85613d96bfdef8827c3465c Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 8 May 2008 11:45:29 +0100 Subject: [PATCH 10/16] improve path manipulation --- .zsh/zprofile/00_path | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.zsh/zprofile/00_path b/.zsh/zprofile/00_path index bac01d4..230e94f 100644 --- a/.zsh/zprofile/00_path +++ b/.zsh/zprofile/00_path @@ -8,18 +8,27 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -for p in $HOME/bin $HOME/.bin; do - case "$PATH" in - "*:${p}:*"|"${p}:*"|"*:${p}") :;; - *) PATH="${p}:$PATH";; - esac -done +__prepend_dir_to_path() +{ + for dir; do + case "$PATH" in + "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; + *) test -d "$dir" && path=("$dir" $path);; + esac + done +} -for p in /usr/lib/surfraw; do - case "$PATH" in - "*:${p}:*"|"${p}:*"|"*:${p}") :;; - *) PATH="${PATH}:$p";; - esac -done +__append_dir_to_path() +{ + for dir; do + case "$PATH" in + "*:${dir}:*"|"${dir}:*"|"*:${dir}") :;; + *) test -d "$dir" && path+="$dir";; + esac + done +} + +__prepend_dir_to_path $BINDIR +__append_dir_to_path /usr/lib/surfraw # vim:ft=zsh -- 2.39.5 From 1fc934e9c212b32ecc3257130e52d9f557e1e428 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 8 May 2008 12:00:18 +0100 Subject: [PATCH 11/16] clear the screen on logout --- .zsh/zlogout/99_cls | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .zsh/zlogout/99_cls diff --git a/.zsh/zlogout/99_cls b/.zsh/zlogout/99_cls new file mode 100644 index 0000000..6367838 --- /dev/null +++ b/.zsh/zlogout/99_cls @@ -0,0 +1,13 @@ +# zlogout/99_cls +# +# clear the screen +# +# Copyright © 1994–2008 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: http://git.madduck.net/v/etc/zsh.git +# + +clear + +# vim:ft=zsh -- 2.39.5 From 73589763f38502cac02edc4efd742c98ab88f75e Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 8 May 2008 12:04:17 +0100 Subject: [PATCH 12/16] disable rationalise-dot for now --- .zsh/zshrc/99_TODO | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.zsh/zshrc/99_TODO b/.zsh/zshrc/99_TODO index 63cf6c4..e7f8b98 100644 --- a/.zsh/zshrc/99_TODO +++ b/.zsh/zshrc/99_TODO @@ -63,8 +63,8 @@ rationalise-dot() { LBUFFER+=. fi } -zle -N rationalise-dot -bindkey . rationalise-dot +#zle -N rationalise-dot +#bindkey . rationalise-dot : -- 2.39.5 From b123d7b2d67f62598a68a2367cbac85386491017 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 8 May 2008 12:04:53 +0100 Subject: [PATCH 13/16] define core zsh variables early --- .zsh/zshenv/10_zvars | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .zsh/zshenv/10_zvars diff --git a/.zsh/zshenv/10_zvars b/.zsh/zshenv/10_zvars new file mode 100644 index 0000000..8886be3 --- /dev/null +++ b/.zsh/zshenv/10_zvars @@ -0,0 +1,14 @@ +# zshenv/10_zvars +# +# set a number of core zsh variables +# +# Copyright © 1994–2008 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: http://git.madduck.net/v/etc/zsh.git +# + +# use $TMPDIR for TMPPREFIX +TMPPREFIX="$TMPDIR/zsh" + +# vim:ft=zsh -- 2.39.5 From b9574517452ddcb25f147833da0f7f3d03dbd2a3 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 8 May 2008 12:20:21 +0100 Subject: [PATCH 14/16] just use rm, do not insist on command --- .zsh/zprofile/40_zcompile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zsh/zprofile/40_zcompile b/.zsh/zprofile/40_zcompile index 0074768..967199a 100644 --- a/.zsh/zprofile/40_zcompile +++ b/.zsh/zprofile/40_zcompile @@ -9,7 +9,7 @@ # if [ -n "$ZDOTDIR" ]; then - command rm -f $ZDOTDIR/**/*.zwc(.N) $ZDOTDIR/**/.*.zwc(.N) $ZVARDIR/**/*.zwc(.N) + rm -f $ZDOTDIR/**/*.zwc(.N) $ZDOTDIR/**/.*.zwc(.N) $ZVARDIR/**/*.zwc(.N) for f ($ZDOTDIR/.*(@) $ZDOTDIR/*(.) $ZDOTDIR/**/*(.) $ZVARDIR/comp-$HOST) \ zcompile $f fi -- 2.39.5 From c4435c2102114c87ea2f7c2bc117c7676f66ac0d Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 8 May 2008 12:22:15 +0100 Subject: [PATCH 15/16] more sophisticated cleaning --- .zsh/zlogout/90_cleanfiles | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .zsh/zlogout/90_cleanfiles diff --git a/.zsh/zlogout/90_cleanfiles b/.zsh/zlogout/90_cleanfiles new file mode 100644 index 0000000..3bc5bd8 --- /dev/null +++ b/.zsh/zlogout/90_cleanfiles @@ -0,0 +1,44 @@ +# zlogout/90_cleanfiles +# +# remove files we never want to keep around +# +# Copyright © 1994–2008 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: http://git.madduck.net/v/etc/zsh.git +# + +typeset -la rmfiles + +cd ~ + +rmfiles+=plugin131.trace +rmfiles+=minicom.log +rmfiles+=.cshrc +rmfiles+=java.log.* +rmfiles+=unison.log +rmfiles+=.bzr.log +rmfiles+=.fonts.cache-1 +rmfiles+=.gksu.lock +rmfiles+=.*.sw[mnop] +rmfiles+=.viminfo +rmfiles+=.bash_history +rmfiles+=.xsession-errors + +typeset -la _rmfiles + +for f in ${~rmfiles[@]}; do + [[ -f $f ]] || continue + _rmfiles+="$f" +done + +unset rmfiles + +if [[ -n $_rmfiles ]]; then + info "Removing files: ${_rmfiles[@]}..." + rm -f ${_rmfiles[@]} +fi + +unset _rmfiles + +# vim:ft=zsh -- 2.39.5 From 0db2a9bc0ab6233396a1011d1318563ea36642d5 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 8 May 2008 21:53:09 +0100 Subject: [PATCH 16/16] fix compilation globs --- .zsh/zprofile/40_zcompile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.zsh/zprofile/40_zcompile b/.zsh/zprofile/40_zcompile index 967199a..01c73b6 100644 --- a/.zsh/zprofile/40_zcompile +++ b/.zsh/zprofile/40_zcompile @@ -9,8 +9,8 @@ # if [ -n "$ZDOTDIR" ]; then - rm -f $ZDOTDIR/**/*.zwc(.N) $ZDOTDIR/**/.*.zwc(.N) $ZVARDIR/**/*.zwc(.N) - for f ($ZDOTDIR/.*(@) $ZDOTDIR/*(.) $ZDOTDIR/**/*(.) $ZVARDIR/comp-$HOST) \ + rm -f $ZDOTDIR/**/*.zwc(D.N) $ZVARDIR/**/*.zwc(.N) + for f ($ZDOTDIR/.*(@) $ZDOTDIR/*(D.,@) $ZDOTDIR/**/*(.) $ZVARDIR/comp*(.)) \ zcompile $f fi -- 2.39.5