config/shell: improve ignoredirs handling

This commit is contained in:
xeruf 2022-05-12 11:32:00 +02:00
parent 14d52ab1e9
commit 18d0354522
2 changed files with 5 additions and 3 deletions

View File

@ -261,15 +261,17 @@ alias mdo="pandoc -f gfm-ascii_identifiers-gfm_auto_identifiers -t org-auto_iden
alias mdox="xclip -o -selection clipboard | mdo | xclip -filter"
alias f="fossil"
alias fs="fossil status"
alias fc="fossil commit -v"
alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index'
# Default grep with some niceties
# Default grep with some convenience flags
alias grpc='grep --color=auto --line-number --binary-files=without-match --directories=skip'
# Default grep with some niceties and ignoring case
alias grp='grpc --ignore-case'
# Grep recursively and paginate
grpr() { grp --color=always --recursive $(echo $DIRS_IGNORE | sed 's/-x/--exclude-dir/g') "$@" | less -FX; }
grpr() { grp --color=always --recursive $(echo $DIRS_IGNORE | sed 's|-x \([^ ]*/\)\?|--exclude-dir |g') "$@" | less -FX; }
# Grep in shell config files
grsh() { grpr --no-ignore-case "$@" $HOME/.{ba,z}sh* $HOME/.local/bin $CONFIG_SHELLS $CONFIG_ZSH; }

View File

@ -68,7 +68,7 @@ export LESS="--RAW-CONTROL-CHARS --ignore-case --LONG-PROMPT --jump-target=5 $(t
# TODO put into config file and use --exclude-from
export DIRS_GENERATED="-x generated -x .gradle -x cmake_build -x dist-newstyle -x node_modules -x __pycache__"
export DIRS_IGNORE_SAFE="-x .cache -x .cpan -x *Cache -x .pyenv -x .local/cache -x share/baloo -x share/cabal -x share/cargo -x share/digikam -x share/gem -x share/JetBrains -x share/tldr -x share/syncthing -x share/Steam/ubuntu* -x share/Steam/package -x share/virtualenv -x share/Zeal -x state/gradle -x state/android -x Ferdi/Partitions -x oh-my-zsh -x wine/drive_c/windows -x vendor/cache $DIRS_GENERATED"
export DIRS_IGNORE="-x .sync -x .stfolder -x *build -x .git -x .idea -x env -x out -x cache -x Partitions $DIRS_IGNORE_SAFE"
export DIRS_IGNORE="-x .sync -x .stfolder -x *build -x .git -x .idea -x env -x out -x cache -x Partitions -x vendor/bundle -x log $DIRS_IGNORE_SAFE"
# red stderr
test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"
# software config