Browse Source

update func s

pull/1/head
10sr 11 years ago
parent
commit
0ddceb6667
1 changed files with 7 additions and 12 deletions
  1. +7
    -12
      bashrc

+ 7
- 12
bashrc View File

@@ -354,26 +354,23 @@ clk(){
} }


s(){ s(){
# 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
echo ">> git grep -n $@" 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
echo ">> ag --pager=\"$PAGER\" $@" 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
echo ">> ack --pager=\"$PAGER\" $@" 1>&2
ack --pager="$PAGER" "$@" ack --pager="$PAGER" "$@"
else else
echo ">> Using grep" 1>&2
echo \
">> grep -nH --color=always" \
"--exclude=\'.svn/\*\' --exclude=\'.git/\*\'" \
"$@" "-r ." 1>&2
if test $# -eq 0 if test $# -eq 0
then then
echo "No search word given." 1>&2 echo "No search word given." 1>&2
@@ -381,8 +378,6 @@ s(){
fi fi
grep -nH --color=always --exclude='.svn/*' --exclude='.git/*' "$@" -r . \ grep -nH --color=always --exclude='.svn/*' --exclude='.git/*' "$@" -r . \
| $PAGER | $PAGER
# echo "No search command found. Use grep." 2>&1
# return 127
fi fi
} }




Loading…
Cancel
Save