initial commit
This commit is contained in:
24
.config/zsh/alias/grep.zsh
Normal file
24
.config/zsh/alias/grep.zsh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/zsh
|
||||
|
||||
z-alt-grep() {
|
||||
local -a a
|
||||
a=( ${(@s:|:)1} )
|
||||
[ ${#a} = 0 ] && a=( "$1" )
|
||||
local n=${#a}
|
||||
[ -z "$1" ] && n=0
|
||||
case "$n" in
|
||||
0) : do nothing ;;
|
||||
*) z-alt-set-static "grep|-q -e ' ' ${ZSHU[d_zdot]}/.zshenv" "$1" "GREP_OPTIONS='' " ;;
|
||||
esac
|
||||
}
|
||||
|
||||
## TODO: add --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}
|
||||
GREP_GNU='--color=auto'
|
||||
|
||||
z-alt-grep "grep ${GREP_GNU}|grep"
|
||||
|
||||
unfunction z-alt-grep
|
||||
unset GREP_GNU
|
||||
|
||||
egrep() { grep -E "$@" ; }
|
||||
fgrep() { grep -F "$@" ; }
|
Reference in New Issue
Block a user