1
1
Fork 0

zshrc: Auto-detect whether to use gls / ggrep

This commit is contained in:
Jonathan Schleifer 2018-07-08 20:14:37 +00:00
parent 07b6d8afc1
commit d5e32eeb9e

28
zshrc
View file

@ -5,10 +5,10 @@ AUDIO_PLAYER_FORMATS=(aac flac it m4a mod mp3 mpc ogg sid spc wma wv xm)
VIDEO_PLAYER_FORMATS=(avi divx flv mkv mov mpeg mp4 mpg ogm wmv)
EDITOR="vim"
PAGER="less"
GREP="ggrep"
GREP=""
GREP_COLOUR="auto"
FGREP=""
LS="gls"
LS=""
LS_COLOUR="auto"
LS_ON_CD="yes"
LS_ON_INIT="no"
@ -43,21 +43,39 @@ compinit -C
zstyle ':completion:*' matcher-list 'm:{A-Z}={a-z} m:{a-z}={A-Z}'
if [ "$GREP" -o "$GREP_COLOUR" ]; then
[ -z "$GREP" ] && GREP="grep"
if [ -z "$GREP" ]; then
if which ggrep &>/dev/null; then
GREP="ggrep"
else
GREP="grep"
fi
fi
[ ! -z "$GREP_COLOUR" -a "$GREP_COLOUR[1]" != "-" ] && \
GREP_COLOUR="--colour=$GREP_COLOUR"
alias grep="$GREP $GREP_COLOUR"
fi
if [ "$FGREP" -o "$GREP_COLOUR" ]; then
[ -z "$FGREP" ] && FGREP="fgrep"
if [ -z "$FGREP" ]; then
if which ggrep &>/dev/null; then
FGREP="ggrep -F"
else
FGREP="fgrep"
fi
fi
[ ! -z "$GREP_COLOUR" -a "$GREP_COLOUR[1]" != "-" ] && \
GREP_COLOUR="--colour=$GREP_COLOUR"
alias fgrep="$FGREP $GREP_COLOUR"
fi
if [ "$LS" -o "$LS_COLOUR" ]; then
[ -z "$LS" ] && LS="ls"
if [ -z "$LS" ]; then
if which gls &>/dev/null; then
LS="gls"
else
LS="ls"
fi
fi
[ ! -z "$LS_COLOUR" -a "$LS_COLOUR[1]" != "-" ] && \
LS_COLOUR="--color=$LS_COLOUR"
alias ls="$LS $LS_COLOUR"