X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=65f457ff22f938fae1866a3d7a745c985c7006a6;hb=5173aead615141e4e777e692cef94ae86d6a74d6;hp=21ece37767fce78e273569a679e1eba90a0166da;hpb=7ee39bb465be04463af28e41e3689ebfd4c57159;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 21ece37..65f457f 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -2109,6 +2109,8 @@ alias help-zshglob=H-Glob #v1# set number of lines to display per page HELP_LINES_PER_PAGE=20 +#v1# set location of help-zle cache file +HELP_ZLE_CACHE_FILE=~/.cache/zsh_help_zle_lines.zsh #f1# helper function for help-zle, actually generates the help text help_zle_parse_keybindings() { @@ -2119,6 +2121,12 @@ help_zle_parse_keybindings() #v1# choose files that help-zle will parse for keybindings ((${+HELPZLE_KEYBINDING_FILES})) || HELPZLE_KEYBINDING_FILES=( /etc/zsh/zshrc ~/.zshrc.pre ~/.zshrc ~/.zshrc.local ) + if [[ -r $HELP_ZLE_CACHE_FILE ]]; then + local load_cache=0 + for f ($KEYBINDING_FILES) [[ $f -nt $HELP_ZLE_CACHE_FILE ]] && load_cache=1 + [[ $load_cache -eq 0 ]] && . $HELP_ZLE_CACHE_FILE && return + fi + #fill with default keybindings, possibly to be overwriten in a file later #Note that due to zsh inconsistency on escaping assoc array keys, we encase the key in '' which we will remove later local -A help_zle_keybindings @@ -2197,6 +2205,9 @@ help_zle_parse_keybindings() done #sort lines alphabetically help_zle_lines=("${(i)help_zle_lines[@]}") + [[ -d ${HELP_ZLE_CACHE_FILE:h} ]] || mkdir -p "${HELP_ZLE_CACHE_FILE:h}" + echo "help_zle_lines=(${(q)help_zle_lines[@]})" >| $HELP_ZLE_CACHE_FILE + zcompile $HELP_ZLE_CACHE_FILE } typeset -g help_zle_sln typeset -g -a help_zle_lines @@ -2555,8 +2566,10 @@ alias r--='chmod 644' alias r-x='chmod 755' # some useful aliases -#a2# Execute \kbd{mkdir -o} +#a2# Execute \kbd{mkdir -p} alias md='mkdir -p' +#a2# Remove current empty directory. Execute \kbd{cd ..; rmdir $OLDCWD} +alias rmcdir='cd ..; rmdir $OLDPWD || cd $OLDPWD' # console stuff #a2# Execute \kbd{mplayer -vo fbdev} @@ -2799,7 +2812,7 @@ inplaceMkDirs() { bufwords=(${(z)LBUFFER}) iword=${#bufwords} bufwords=(${(z)BUFFER}) - PATHTOMKDIR="$bufwords[iword]" + PATHTOMKDIR="${(Q)bufwords[iword]}" fi [[ -z "${PATHTOMKDIR}" ]] && return 1 if [[ -e "${PATHTOMKDIR}" ]]; then @@ -2977,10 +2990,16 @@ if is439 && [[ -d /dev/disk/by-id/ ]]; then emulate -L zsh setopt extendedglob local -a -U disks + local -A mountinfo disks=( /dev/disk/by-id/*(@:A) ) + [[ -r /proc/mounts ]] && for cline ( "${(f)$(}/${dev:t}/size(N) ) \ + print -f " Size: %.3f GiB (%d Byte)\n" $(($(<$sysdevsize)/(2.0*1024.0*1024.0))) $(($(<$sysdevsize)*512)) + + print -f " Id: %s\n" /dev/disk/by-id/*(@e/'[[ ${REPLY:A} == $dev ]]'/N:t) done } fi @@ -3263,8 +3282,9 @@ vman() { #f5# View all README-like files in current directory in pager readme() { emulate -L zsh + setopt extendedglob local files - files=(./(#i)*(read*me|lue*m(in|)ut)*(ND)) + files=(./(#i)*(read*me|lue*m(in|)ut|lies*mich)*(NDr^/=p%)) if (($#files)) ; then $PAGER $files else