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