This commit is contained in:
Geoffrey Frogeye 2018-08-13 12:20:09 +02:00
parent fe27b3b960
commit 86bc146125
6 changed files with 380 additions and 37 deletions

64
bashrc
View file

@ -43,6 +43,9 @@ alias rm='rm -Iv --one-file-system'
alias free='free -m'
alias df='df -h'
alias dmesg='dmesg --ctime'
alias ffmpeg='ffmpeg -hide_banner'
alias ffprobe='ffprobe -hide_banner'
alias ffplay='ffplay -hide_banner'
# Frequent mistakes
alias sl=ls
@ -62,31 +65,48 @@ alias tracefiles="strace -f -t -e trace=file"
alias n='urxvtc &'
# Superseding commands with better ones if they are present
function vi() {
if which vim &> /dev/null; then
alias vi='vim'
fi
vim "$@"
function _do_rank() { # executables... -- arguments...
for ex in "$@"
do
[ "$ex" == "--" ] && break
if which "$ex" &> /dev/null
then
for al in "$@"
do
shift
[ "$al" == "--" ] && break
alias "$al"="$ex"
done
"$ex" "$@"
return $?
fi
done
for ex in "$@"
do
[ "$al" == "--" ] && break
if -z "$list"
then
list=$ex
else
list=$list, $ex
fi
done
echo "Not installed: $list"
}
function pass() {
if which gopass &> /dev/null; then
alias pass='gopass'
fi
gopass "$@"
}
function wol() {
if which wakeonlan &> /dev/null; then
alias wol='wakeonlan'
fi
wakeonlan "$@"
}
function mutt() {
if which neomutt &> /dev/null; then
alias mutt='neomutt'
fi
neomutt "$@"
function _install_rank() { # executables...
for ex in "$@"
do
list=$@
alias "$ex"="_do_rank $list --"
done
}
_install_rank nvim vim vi
_install_rank gopass pass
_install_rank wakeonlan wol
_install_rank neomutt mutt
# SHELL CUSTOMIZATION
complete -cf sudo