dotfiles/config/shell/shrc
2019-04-16 19:18:16 +02:00

80 lines
1.4 KiB
Bash

#!/usr/bin/env sh
#
# Shell common aliases and customizations (BusyBox compatible)
#
## COMMAND CONFIGURATION
# Completion for existing commands
alias ls='ls -h --color=auto'
alias mkdir='mkdir -v'
alias cp="cp -i"
alias mv="mv -iv"
alias free='free -h'
alias df='df -h'
alias ffmpeg='ffmpeg -hide_banner'
alias ffprobe='ffprobe -hide_banner'
alias ffplay='ffplay -hide_banner'
# ALIASES
# Frequent mistakes
alias sl=ls
alias al=la
alias mdkir=mkdir
alias systemclt=systemctl
alias please=sudo
# Shortcuts for commonly used commands
alias ll="ls -l"
alias la="ls -la"
alias s='sudo -s -E'
alias n='urxvtc &'
alias x='startx; logout'
alias nx='nvidia-xrun; logout'
# FUNCTIONS
trysource() {
if [ -f "$1" ]
then
. "$1"
else
return 1
fi
}
_i_prefer() { # executables...
for candidate in "$@"
do
if [ -x "$(command -v "$candidate")" ]
then
choice="$candidate"
break
fi
done
if [ -z "$choice" ]
then
return
fi
for candidate in "$@"
do
if [ "$candidate" != "$choice" ]
then
alias "$candidate"="$choice"
fi
done
}
_i_prefer nvim vim vi
_i_prefer gopass pass
_i_prefer wakeonlan wol
_i_prefer neomutt mutt
unset _i_prefer
## COLORS
trysource ~/.local/bin/colorSchemeApply
# Needed because xterm/urxvt won't use the last color, needed for vim