]> git.donarmstrong.com Git - zsh.git/blob - .zsh/zshrc/80_abbreviations
abbreviations are not preceeded by -
[zsh.git] / .zsh / zshrc / 80_abbreviations
1 typeset -Ag abbreviations
2 abbreviations=(
3   '...'  '../..'
4   '....' '../../..'
5   'BG'   '& exit'
6   'WC'   '| wc'
7   'GR'   '|& grep '
8   'HD'   '| head'
9   'HL'   ' --help |& less -r'
10   'LS'   '| less'
11   'LR'   '|& less -r'
12   'NL'   '&>/dev/null'
13   'SL'   '| sort | less'
14   'SU'   '| sort -u'
15   'TL'   '| tail'
16   'VI'   '|& vim -'
17 )
18
19 magic-abbrev-expand() {
20     local MATCH
21     LBUFFER=${LBUFFER%%(#m)[-_a-zA-Z0-9]#}
22     LBUFFER+=${abbreviations[$MATCH]:-$MATCH}
23     zle self-insert
24 }
25
26 no-magic-abbrev-expand() {
27   LBUFFER+=' '
28 }
29
30 zle -N magic-abbrev-expand
31 zle -N no-magic-abbrev-expand
32 bindkey " " magic-abbrev-expand
33 bindkey "^x " no-magic-abbrev-expand
34 bindkey -M isearch " " self-insert
35
36 # vim:ft=zsh