]> git.madduck.net Git - etc/zsh.git/commitdiff

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:

make zle abbreviations work
authormartin f. krafft <madduck@madduck.net>
Wed, 3 Aug 2011 07:48:50 +0000 (09:48 +0200)
committermartin f. krafft <madduck@madduck.net>
Wed, 3 Aug 2011 07:48:50 +0000 (09:48 +0200)
.zsh/zshrc/30_aliases
.zsh/zshrc/79_bindkeys [moved from .zsh/zshrc/80_bindkeys with 95% similarity]
.zsh/zshrc/80_abbreviations [new file with mode: 0644]
.zsh/zshrc/85_prompt [moved from .zsh/zshrc/80_prompt with 100% similarity]
.zsh/zshrc/85_termfonts [moved from .zsh/zshrc/80_termfonts with 100% similarity]
.zsh/zshrc/85_xtermtitle [moved from .zsh/zshrc/80_xtermtitle with 100% similarity]

index 89d2ca864e52e248dfb85bc7998ef08a6bcffb37..982ddbb3f5bc49be168efd5bd8165c48aa3bf7f5 100644 (file)
@@ -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'
similarity index 95%
rename from .zsh/zshrc/80_bindkeys
rename to .zsh/zshrc/79_bindkeys
index 28ea2ce815550bcb47403872d887b4a1ab941a68..5747a2156687612915c0fc2d32af04a31bd908e3 100644 (file)
@@ -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 (file)
index 0000000..06fc9a7
--- /dev/null
@@ -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
similarity index 100%
rename from .zsh/zshrc/80_prompt
rename to .zsh/zshrc/85_prompt