From ca048e9dbeb5fced34fa8b1472f5fba6986ed642 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 4 Apr 2022 12:26:13 +0200 Subject: [PATCH] config/shell: document grep aliases --- .config/shell/browse | 5 +++-- .config/shell/functions | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.config/shell/browse b/.config/shell/browse index 79532d3..ae0dede 100644 --- a/.config/shell/browse +++ b/.config/shell/browse @@ -46,10 +46,11 @@ cd() { } # LOCATE {{{1 -alias fselect='fzf -0 -1 --reverse --height=30% | while read f; do test -d "$f" && cd "$f" || b "$f"; done' +alias fselect='fzf -0 -1 --reverse --height=30% | while read f; do test -d "$f" && cd "$f" || { highlight "$f" && b "$f" }; done' loci() { locate --all --ignore-case --basename --existing "$@" | - command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') | fselect + command grep --extended-regexp --ignore-case --color=always $(echo "$|${@:$#}" | sed 's/ /|/g') | + fselect } alias loc='noglob loci' alias uloc='noglob sudo updatedb && loci' diff --git a/.config/shell/functions b/.config/shell/functions index d76a3a9..0aa48af 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -250,10 +250,12 @@ alias mdox="xclip -o -selection clipboard | mdo | xclip -filter" alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index' -alias grp='grpc --ignore-case' +# Default grep with some niceties 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 -F; } +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; }