dotfiles/config/shell/shrc

107 lines
2.7 KiB
Plaintext
Raw Normal View History

2019-04-14 17:41:33 +00:00
#!/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'
2020-10-18 11:01:24 +00:00
alias n='alacritty & disown'
2020-01-06 15:23:50 +00:00
alias x='startx $HOME/.config/xinitrc; logout'
alias nx='nvidia-xrun $HOME/.config/xinitrc; logout'
2019-04-14 17:41:33 +00:00
2019-04-25 20:54:51 +00:00
# For programs that think $HOME is a reasonable place to put their junk
# and don't allow the user to change those questionable choices
2019-04-25 20:54:51 +00:00
alias adb='HOME=$JUNKHOME adb'
alias audacity='HOME=$JUNKHOME audacity'
alias binwalk='HOME=$JUNKHOME binwalk' # Should use .config according to the GitHub code though
alias cabal='HOME=$JUNKHOME cabal' # TODO May have options but last time I tried it it crashed
alias cmake='HOME=$JUNKHOME cmake'
alias ddd='HOME=$JUNKHOME ddd'
alias ghidra='HOME=$JUNKHOME ghidra'
alias itch='HOME=$JUNKHOME itch'
alias simplescreenrecorder='HOME=$JUNKHOME simplescreenrecorder' # Easy fix https://github.com/MaartenBaert/ssr/blob/1556ae456e833992fb6d39d40f7c7d7c337a4160/src/Main.cpp#L252
alias vd='HOME=$JUNKHOME vd'
alias wpa_cli='HOME=$JUNKHOME wpa_cli'
2019-04-25 20:54:51 +00:00
# TODO Maybe we can do something about node-gyp
alias bower='bower --config.storage.packages=~/.cache/bower/packages --config.storage.registry=~/.cache/bower/registry --config.storage.links=~/.cache/bower/links'
alias gdb='gdb -x $HOME/.config/gdbinit'
alias iftop='iftop -c $HOME/.config/iftoprc'
alias lmms='lmms --config $HOME/.config/lmmsrc.xml'
2019-07-16 15:43:46 +00:00
alias tmux='tmux -f $HOME/.config/tmux/tmux.conf'
2019-04-25 20:54:51 +00:00
# TODO ruby's gem when I find a use for it
2019-04-14 17:41:33 +00:00
# FUNCTIONS
trysource() {
if [ -f "$1" ]
then
. "$1"
else
return 1
fi
}
2019-04-16 17:18:16 +00:00
_i_prefer() { # executables...
for candidate in "$@"
do
if [ -x "$(command -v "$candidate")" ]
then
choice="$candidate"
break
2019-04-14 17:41:33 +00:00
fi
done
2019-04-16 17:18:16 +00:00
if [ -z "$choice" ]
then
return
fi
for candidate in "$@"
do
if [ "$candidate" != "$choice" ]
then
alias "$candidate"="$choice"
2019-04-14 17:41:33 +00:00
fi
done
}
2019-04-16 17:18:16 +00:00
_i_prefer nvim vim vi
_i_prefer gopass pass
_i_prefer wakeonlan wol
_i_prefer neomutt mutt
unset _i_prefer
2019-04-14 17:41:33 +00:00
## COLORS
2020-10-17 21:47:48 +00:00
# trysource ~/.local/bin/colorSchemeApply
2019-04-14 17:41:33 +00:00
# Needed because xterm/urxvt won't use the last color, needed for vim
2020-09-24 08:47:35 +00:00
## GPG
# Update TTY
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null