]> Sergey Matveev's repositories - dotfiles.git/blobdiff - zsh/.zshrc
Exclude binaries and .git/.tags from grep
[dotfiles.git] / zsh / .zshrc
index 0a18bb0288764271526a46dede629a7c5165c7a0..778759a9695789328f15cd2cebb14178e412dae2 100644 (file)
@@ -132,16 +132,23 @@ bindkey -s "\eOR" " git status --short\n" # F3
 # }}}
 
 # grep {{{
-GREP=/usr/local/bin/grep
-GREP_ARGS="--color=always --with-filename --line-number --dereference-recursive"
-LESS_COLORED="less --RAW-CONTROL-CHARS"
+GREP_ARGS=(
+    --colour=always
+    --with-filename
+    --line-number
+    --dereference-recursive
+    --binary-files=without-match
+    --exclude-dir=.git
+    --exclude-dir=.tags
+)
+LESS_COLOURED=(less --RAW-CONTROL-CHARS)
 g() {
-    $GREP ${=GREP_ARGS} $@ | ${=LESS_COLORED}
+    grep $GREP_ARGS $@ | $LESS_COLOURED
 }
 GS() {
-    $GREP ${=GREP_ARGS} $@ | sort --numeric-sort | ${=LESS_COLORED}
+    grep $GREP_ARGS $@ | sort --numeric-sort | $LESS_COLOURED
 }
-alias -g G="| $GREP --color"
+alias -g G="| grep --colour=always"
 alias gg="git grep "
 # }}}