From: martin f. krafft Date: Wed, 3 Aug 2011 07:48:50 +0000 (+0200) Subject: make zle abbreviations work X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/29ff3db6dd936515eef1d15b34a42b6ffca4f4a5?hp=-c;pf=etc make zle abbreviations work --- 29ff3db6dd936515eef1d15b34a42b6ffca4f4a5 diff --git a/.zsh/zshrc/30_aliases b/.zsh/zshrc/30_aliases index 89d2ca8..982ddbb 100644 --- a/.zsh/zshrc/30_aliases +++ b/.zsh/zshrc/30_aliases @@ -56,8 +56,6 @@ alias w='w|cat' alias -g ND='*(/om[1])' # newest directory alias -g NF='*(.om[1])' # newest file -alias -g L='|less' - alias egrep='egrep --color=auto -d skip' alias fgrep='fgrep --color=auto -d skip' alias grep='grep --color=auto -d skip' diff --git a/.zsh/zshrc/80_bindkeys b/.zsh/zshrc/79_bindkeys similarity index 95% rename from .zsh/zshrc/80_bindkeys rename to .zsh/zshrc/79_bindkeys index 28ea2ce..5747a21 100644 --- a/.zsh/zshrc/80_bindkeys +++ b/.zsh/zshrc/79_bindkeys @@ -12,7 +12,7 @@ bindkey -e # history expansion on pressing space -bindkey ' ' magic-space +#bindkey ' ' magic-space # repeat the previous shell-word ($WORDCHARS) bindkey '\e=' copy-prev-shell-word diff --git a/.zsh/zshrc/80_abbreviations b/.zsh/zshrc/80_abbreviations new file mode 100644 index 0000000..06fc9a7 --- /dev/null +++ b/.zsh/zshrc/80_abbreviations @@ -0,0 +1,36 @@ +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 diff --git a/.zsh/zshrc/80_prompt b/.zsh/zshrc/85_prompt similarity index 100% rename from .zsh/zshrc/80_prompt rename to .zsh/zshrc/85_prompt diff --git a/.zsh/zshrc/80_termfonts b/.zsh/zshrc/85_termfonts similarity index 100% rename from .zsh/zshrc/80_termfonts rename to .zsh/zshrc/85_termfonts diff --git a/.zsh/zshrc/80_xtermtitle b/.zsh/zshrc/85_xtermtitle similarity index 100% rename from .zsh/zshrc/80_xtermtitle rename to .zsh/zshrc/85_xtermtitle