typeset -Ag zle_abbrevs zle_abbrevs=( # '...' '../..' # '....' '../../..' # '.....' '../../../..' # '......' '../../../../..' 'WC' '| wc' 'GR' '|& grep ' 'HD' '| head' 'HL' ' --help |& less -r' 'LS' '| less' 'LR' '|& less -r' 'NL' '&>/dev/null' 'SL' '| sort | less' 'SU' '| sort -u' 'TL' '| tail' 'VI' '|& vim -' 'ND' '*(/om[1])' 'NF' '*(.om[1])' ) # the ...## abbrevs are gone in favour of rationalise-dot magic-abbrev-expand() { emulate -L zsh setopt extendedglob local MATCH MBEGIN MEND LBUFFER=${LBUFFER%%(#m)[.A-Z]#} LBUFFER+=${zle_abbrevs[$MATCH]:-$MATCH} } no-magic-abbrev-expand() { emulate -L zsh LBUFFER+=' ' } zle -N magic-abbrev-expand zle -N no-magic-abbrev-expand magic_space_functions+=magic-abbrev-expand accept_line_functions+=magic-abbrev-expand bindkey "^x " no-magic-abbrev-expand bindkey -M isearch " " self-insert function help-show-magic-abbrevs() { zle -M "$(print "Available abbreviations for expansion:"; print -a -C 2 ${(kv)zle_abbrevs})" } zle -N help-show-magic-abbrevs bindkey '\e?' help-show-magic-abbrevs # vim:ft=zsh