1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-01-19 00:37:35 +08:00

Compare commits

..

No commits in common. "9ce7de9f16ba894423bc5105c7e959894ca2e751" and "498cd722b39215be04468f291a23b6a76b75b095" have entirely different histories.

2 changed files with 24 additions and 39 deletions

View File

@ -133,12 +133,6 @@ ZSH_THEME_RANDOM_CANDIDATES=(
)
```
If you only know which themes you don't like, you can add them similarly to a blacklist:
```shell
ZSH_THEME_RANDOM_BLACKLIST=(pygmalion tjkirch_mod)
```
### FAQ
If you have some more questions or issues, you might find a solution in our [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ).

View File

@ -1,37 +1,28 @@
__GREP_CACHE_FILE="$ZSH_CACHE_DIR"/grep-alias
# is x grep argument available?
grep-flag-available() {
echo | grep $1 "" >/dev/null 2>&1
}
# See if there's a cache file modified in the last day
__GREP_ALIAS_CACHES=("$__GREP_CACHE_FILE"(Nm-1))
if [[ -z "$__GREP_ALIAS_CACHES" ]]; then
grep-flags-available() {
command grep "$@" "" &>/dev/null <<< ""
}
GREP_OPTIONS=""
# Ignore these folders (if the necessary grep flags are available)
EXC_FOLDERS="{.bzr,CVS,.git,.hg,.svn,.idea,.tox}"
# Check for --exclude-dir, otherwise check for --exclude. If --exclude
# isn't available, --color won't be either (they were released at the same
# time (v2.5): http://git.savannah.gnu.org/cgit/grep.git/tree/NEWS?id=1236f007
if grep-flags-available --color=auto --exclude-dir=.cvs; then
GREP_OPTIONS="--color=auto --exclude-dir=$EXC_FOLDERS"
elif grep-flags-available --color=auto --exclude=.cvs; then
GREP_OPTIONS="--color=auto --exclude=$EXC_FOLDERS"
fi
{
if [[ -n "$GREP_OPTIONS" ]]; then
# export grep, egrep and fgrep settings
echo "alias grep='grep $GREP_OPTIONS'"
echo "alias egrep='egrep $GREP_OPTIONS'"
echo "alias fgrep='fgrep $GREP_OPTIONS'"
fi
} > "$__GREP_CACHE_FILE"
# Clean up
unset GREP_OPTIONS EXC_FOLDERS
unfunction grep-flags-available
# color grep results
if grep-flag-available --color=auto; then
GREP_OPTIONS+=" --color=auto"
fi
source "$__GREP_CACHE_FILE"
unset __GREP_CACHE_FILE __GREP_ALIAS_CACHES
# ignore VCS folders (if the necessary grep flags are available)
VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
if grep-flag-available --exclude-dir=.cvs; then
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
elif grep-flag-available --exclude=.cvs; then
GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
fi
# export grep settings
alias grep="grep $GREP_OPTIONS"
# clean up
unset GREP_OPTIONS
unset VCS_FOLDERS
unfunction grep-flag-available