From 29ff3db6dd936515eef1d15b34a42b6ffca4f4a5 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 3 Aug 2011 09:48:50 +0200 Subject: [PATCH 1/1] make zle abbreviations work --- .zsh/zshrc/30_aliases | 2 -- .zsh/zshrc/{80_bindkeys => 79_bindkeys} | 2 +- .zsh/zshrc/80_abbreviations | 36 +++++++++++++++++++++ .zsh/zshrc/{80_prompt => 85_prompt} | 0 .zsh/zshrc/{80_termfonts => 85_termfonts} | 0 .zsh/zshrc/{80_xtermtitle => 85_xtermtitle} | 0 6 files changed, 37 insertions(+), 3 deletions(-) rename .zsh/zshrc/{80_bindkeys => 79_bindkeys} (95%) create mode 100644 .zsh/zshrc/80_abbreviations rename .zsh/zshrc/{80_prompt => 85_prompt} (100%) rename .zsh/zshrc/{80_termfonts => 85_termfonts} (100%) rename .zsh/zshrc/{80_xtermtitle => 85_xtermtitle} (100%) 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 -- 2.39.5