config/shell: document grep aliases

This commit is contained in:
xeruf 2022-04-04 12:26:13 +02:00
parent a4dece85cc
commit ca048e9dbe
2 changed files with 7 additions and 4 deletions

View File

@ -46,10 +46,11 @@ cd() {
} }
# LOCATE {{{1 # 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() { loci() {
locate --all --ignore-case --basename --existing "$@" | 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 loc='noglob loci'
alias uloc='noglob sudo updatedb && loci' alias uloc='noglob sudo updatedb && loci'

View File

@ -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 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' 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 # 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 # Grep in shell config files
grsh() { grpr --no-ignore-case "$@" $HOME/.{ba,z}sh* $HOME/.local/bin $CONFIG_SHELLS $CONFIG_ZSH; } grsh() { grpr --no-ignore-case "$@" $HOME/.{ba,z}sh* $HOME/.local/bin $CONFIG_SHELLS $CONFIG_ZSH; }