mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
23 lines
573 B
Bash
23 lines
573 B
Bash
#
|
|
# Color grep results
|
|
# Examples: http://rubyurl.com/ZXv
|
|
#
|
|
|
|
GREP_OPTIONS="--color=auto"
|
|
|
|
# avoid VCS folders (if the necessary grep flags are available)
|
|
grep-flag-available() {
|
|
echo | grep $1 "" >/dev/null 2>&1
|
|
}
|
|
if grep-flag-available --exclude-dir=.cvs; then
|
|
for PATTERN in .cvs .git .hg .svn; do
|
|
GREP_OPTIONS+=" --exclude-dir=$PATTERN"
|
|
done
|
|
elif grep-flag-available --exclude=.cvs; then
|
|
for PATTERN in .cvs .git .hg .svn; do
|
|
GREP_OPTIONS+=" --exclude=$PATTERN"
|
|
done
|
|
fi
|
|
unfunction grep-flag-available
|
|
|
|
alias grep="grep $GREP_OPTIONS"
|