1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # grep.zshrc: Setup grep
4 # Make sure that "grep(1)" is installed
5 (( $+commands[grep] )) || return
7 grep-flag-available() {
8 echo | grep "$1" "" >/dev/null 2>&1
12 vcs_folders="{.bzr,.cvs,.git,.hg,.svn}"
15 if grep-flag-available "--color=auto"; then
16 grep_options+=" --color=auto"
20 if grep-flag-available "--exclude-dir=.csv"; then
21 grep_options+=" --exclude-dir=$vcs_folders"
22 elif grep-flag-available "--exclude=.csv"; then
23 grep_options+=" --exclude=$vcs_folders"
26 [[ -n "$options" ]] && alias grep="grep${grep_options}"
28 unfunction grep-flag-available