From 0ddceb666745c020bba9ae7cd77c6001f3df465e Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 19 Aug 2013 13:58:14 +0900 Subject: [PATCH] update func s --- bashrc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/bashrc b/bashrc index 0ffefee..6afbabc 100755 --- a/bashrc +++ b/bashrc @@ -354,26 +354,23 @@ clk(){ } 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 then - echo ">> Using git-grep" 1>&2 + echo ">> git grep -n $@" 1>&2 git grep -n "$@" elif which ag >/dev/null 2>&1 then - echo ">> Using ag" 1>&2 + echo ">> ag --pager=\"$PAGER\" $@" 1>&2 ag --pager="$PAGER" "$@" elif which ack >/dev/null 2>&1 then - echo ">> Using ack" 1>&2 + echo ">> ack --pager=\"$PAGER\" $@" 1>&2 ack --pager="$PAGER" "$@" else - echo ">> Using grep" 1>&2 + echo \ + ">> grep -nH --color=always" \ + "--exclude=\'.svn/\*\' --exclude=\'.git/\*\'" \ + "$@" "-r ." 1>&2 if test $# -eq 0 then echo "No search word given." 1>&2 @@ -381,8 +378,6 @@ s(){ fi grep -nH --color=always --exclude='.svn/*' --exclude='.git/*' "$@" -r . \ | $PAGER - # echo "No search command found. Use grep." 2>&1 - # return 127 fi }