diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-14 13:14:00 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-14 13:14:00 +1300 |
commit | e0ff7ac01d6439d826ff9ef6f134a7638ade714f (patch) | |
tree | 781004065fefcbfd8e543a61de3d168383e71bde /sh/shrc.d/grep.sh | |
parent | Merge branch 'release/v3.1.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-38fa4c8e4f2a2a185777f9438cccbb5f6dadc092.tar.gz (sig) dotfiles-38fa4c8e4f2a2a185777f9438cccbb5f6dadc092.zip |
Merge branch 'release/v3.2.0'v3.2.0
* release/v3.2.0:
Bump VERSION
Refactor some conditionals
Factor out zsh ENV hack into one file
Refactor "path list" not to require a subshell
Correct completion for deep pass(1) directories
Move filetype.vim helper funcs into autoload
Fix a local var name in openssl(1ssl) completion
Correct a variable ref in openssl(1ssl) completion
Disable shellcheck rules for missed definition
Add filenames treatment to mex(1df) completion
Remove unneeded declaration
Refactor some completions to avoid loops
Remove unneeded stdout redirect
Remove unneeded semicolon from sh "for VAR ; do"
Substitute bad `continue` for `return`
Add actual completion matching to git completion
Apply much simpler completion to Git
Diffstat (limited to 'sh/shrc.d/grep.sh')
-rw-r--r-- | sh/shrc.d/grep.sh | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh index 43797ef5..997babc9 100644 --- a/sh/shrc.d/grep.sh +++ b/sh/shrc.d/grep.sh @@ -9,37 +9,43 @@ unset -v GREP_OPTIONS grep() { # Add --binary-files=without-match to gracefully skip binary files - [ -e "$HOME"/.cache/sh/opt/grep/binary-files ] && + if [ -e "$HOME"/.cache/sh/opt/grep/binary-files ] ; then set -- --binary-files=without-match "$@" + fi # Add --color=auto if the terminal has at least 8 colors - [ -e "$HOME"/.cache/sh/opt/grep/color ] && - [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ] && + if [ -e "$HOME"/.cache/sh/opt/grep/color ] && + [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ] ; then set -- --color=auto "$@" + fi # Add --devices=skip to gracefully skip devices - [ -e "$HOME"/.cache/sh/opt/grep/devices ] && + if [ -e "$HOME"/.cache/sh/opt/grep/devices ] ; then set -- --devices=skip "$@" + fi # Add --directories=skip to gracefully skip directories - [ -e "$HOME"/.cache/sh/opt/grep/directories ] && + if [ -e "$HOME"/.cache/sh/opt/grep/directories ] ; then set -- --directories=skip "$@" + fi # Add --exclude to ignore .gitignore and .gitmodules files - [ -e "$HOME"/.cache/sh/opt/grep/exclude ] && + if [ -e "$HOME"/.cache/sh/opt/grep/exclude ] ; then set -- \ --exclude=.gitignore \ --exclude=.gitmodules \ "$@" + fi # Add --exclude-dir to ignore version control dot-directories - [ -e "$HOME"/.cache/sh/opt/grep/exclude-dir ] && + if [ -e "$HOME"/.cache/sh/opt/grep/exclude-dir ] ; then set -- \ --exclude-dir=.cvs \ --exclude-dir=.git \ --exclude-dir=.hg \ --exclude-dir=.svn \ "$@" + fi # Run grep(1) with the concluded arguments command grep "$@" |