typeset -Ag abbreviations abbreviations=( '...' '../..' '....' '../../..' 'BG' '& exit' 'C' '| wc' 'G' '|& grep ' 'H' '| head' 'HL' ' --help |& less -r' 'L' '| less' 'LL' '|& less -r' 'N' '&>/dev/null' 'SL' '| sort | less' 'S' '| sort -u' 'T' '| tail' 'V' '|& vim -' ) magic-abbrev-expand() { local MATCH LBUFFER=${LBUFFER%%(#m)[_a-zA-Z0-9]#} LBUFFER+=${abbreviations[$MATCH]:-$MATCH} zle self-insert } no-magic-abbrev-expand() { LBUFFER+=' ' } zle -N magic-abbrev-expand zle -N no-magic-abbrev-expand bindkey " " magic-abbrev-expand bindkey "^x " no-magic-abbrev-expand bindkey -M isearch " " self-insert # vim:ft=zsh