|
@@ -354,23 +354,28 @@ clk(){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
s(){ |
|
|
s(){ |
|
|
if test $# -eq 0 |
|
|
|
|
|
then |
|
|
|
|
|
echo "No search word given." 1>&2 |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
# if test $# -eq 0 |
|
|
|
|
|
# then |
|
|
|
|
|
# echo "No search word given." 1>&2 |
|
|
|
|
|
# return 1 |
|
|
|
|
|
# fi |
|
|
|
|
|
|
|
|
if git rev-parse --git-dir >/dev/null 2>&1 |
|
|
if git rev-parse --git-dir >/dev/null 2>&1 |
|
|
then |
|
|
then |
|
|
|
|
|
echo ">> Using git-grep" 1>&2 |
|
|
git grep -n "$@" |
|
|
git grep -n "$@" |
|
|
elif which ag >/dev/null 2>&1 |
|
|
elif which ag >/dev/null 2>&1 |
|
|
then |
|
|
then |
|
|
|
|
|
echo ">> Using ag" 1>&2 |
|
|
ag --pager="$PAGER" "$@" |
|
|
ag --pager="$PAGER" "$@" |
|
|
elif which ack >/dev/null 2>&1 |
|
|
elif which ack >/dev/null 2>&1 |
|
|
then |
|
|
then |
|
|
|
|
|
echo ">> Using ack" 1>&2 |
|
|
ack --pager="$PAGER" "$@" |
|
|
ack --pager="$PAGER" "$@" |
|
|
else |
|
|
else |
|
|
grep -nH --exclude='.svn/*' --exclude='.git/*' "$@" -r . | $PAGER |
|
|
|
|
|
|
|
|
echo ">> Using grep" 1>&2 |
|
|
|
|
|
grep -nH --color=always --exclude='.svn/*' --exclude='.git/*' "$@" -r . \ |
|
|
|
|
|
| $PAGER |
|
|
# echo "No search command found. Use grep." 2>&1 |
|
|
# echo "No search command found. Use grep." 2>&1 |
|
|
# return 127 |
|
|
# return 127 |
|
|
fi |
|
|
fi |
|
|