diff zshrc @ 106:cdff2a5e45b2

Add ag completion
author zegervdv <zegervdv@me.com>
date Tue, 12 Aug 2014 09:30:55 +0200
parents afe2d02577c2
children 7e18562d7570
line wrap: on
line diff
--- a/zshrc	Mon Aug 11 19:04:02 2014 +0200
+++ b/zshrc	Tue Aug 12 09:30:55 2014 +0200
@@ -141,9 +141,17 @@
 alias tmux='nocorrect tmux'
 alias mvim="reattach-to-user-namespace mvim"
 alias vim="reattach-to-user-namespace vim"
-alias ag="ag --color"
+# alias ag="ag --color"
 alias dot="cd ~/.dotfiles"
 
+# ag tab complete
+_ag() {
+  if (( CURRENT == 2 )); then
+    compadd $(cut -f 1 .git/tags tmp/tags 2>/dev/null | grep -v '!_TAG')
+  fi
+}
+
+compdef _ag ag
 compctl -g '~/.teamocil/*(:t:r)' teamocil
 
 [[ -f ~/.zshrc.local ]] && source ~/.zshrc.local