From f129da07fbb2dc21d637558a22ae306b8421dad8 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 12 May 2013 21:50:13 +0900 Subject: [PATCH] add func s --- bashrc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bashrc b/bashrc index e49d697..43b1fb3 100755 --- a/bashrc +++ b/bashrc @@ -292,6 +292,28 @@ clk(){ done } +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 + git grep -n "$1" + elif which ag >/dev/null + then + ag --pager="$PAGER" "$1" + elif which ack >/dev/null + then + ack --pager="$PAGER" "$1" + else + echo "No search command found. Use grep." 2>&1 + return 127 + fi +} + man(){ env \ LESS_TERMCAP_mb=$(printf "\e[1;35m") \