bash_aliases: add search tools

This commit is contained in:
xeruf 2022-04-12 19:00:30 +02:00
parent 32b7433948
commit 34a5b7a326
1 changed files with 19 additions and 2 deletions

View File

@ -1,3 +1,11 @@
export LESS="--RAW-CONTROL-CHARS --ignore-case --LONG-PROMPT --jump-target=5 $(test $(less --version | head -1 | cut -f2 -d' ') -ge 590 && echo --incsearch)"
bind '"\ek":history-search-backward'
bind '"\ej":history-search-forward'
if test -f /etc/bash_completion && ! shopt -oq posix
then . /etc/bash_completion
fi
# ls aliases # ls aliases
export LS_OPTIONS='--human-readable --si --group-directories-first --file-type --dereference-command-line' export LS_OPTIONS='--human-readable --si --group-directories-first --file-type --dereference-command-line'
@ -5,11 +13,20 @@ eval "$(dircolors)"
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias ll='ls $LS_OPTIONS -l --all' alias ll='ls $LS_OPTIONS -l --all'
alias l='ls $LS_OPTIONS --color=always --almost-all' alias l='ls $LS_OPTIONS --color=always --almost-all'
which bat >/dev/null || alias bat=batcat which bat >/dev/null || alias bat="$(which batcat >/dev/null && echo batcat || echo less -FX)"
b() { b() {
test -d "${1:-.}" && l "$@" || bat "$@" test -d "${1:-.}" && l "$@" || bat "$@"
} }
alias v=nvim alias v="$(which nvim >/dev/null && echo nvim || echo ${EDITOR:-vi})"
# Grep aliases
# 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 -FX; }
# Some aliases to avoid making mistakes: # Some aliases to avoid making mistakes: