]> git.madduck.net Git - etc/zsh.git/blob - .zsh/zshrc/80_abbreviations

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

clear sudo cache on logout
[etc/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