dotfiles/bash/.functions

34 lines
544 B
Plaintext

#{- ~/.functions -}#
# Enables or disables kwm hotkeys
hotkeys()
{
case "$1" in
"on") kwmc config hotkeys on; echo "Hotkeys enabled." ;;
"off") kwmc config hotkeys off; echo "Hotkeys disabled." ;;
*) printf "hotkeys: usage: hotkeys {on|off}\n" ;;
esac
}
# Passes basic arithmetic to bc
maths()
{
bc -l <<< "scale=2; $*"
}
cat_with_newline()
{
cat "$@" && echo
}
alias cat="cat_with_newline"
vim_option_select()
{
if which nvim &> /dev/null; then
nvim "$@"
else
vim "$@"
fi
}
alias vim="vim_option_select "