.dotfiles/bash/bash_aliases

83 lines
2.5 KiB
Bash
Raw Permalink Normal View History

2022-04-16 19:54:07 +00:00
# vim: ft=sh
2024-02-01 05:06:01 +00:00
# Enable color support if possible
if [ -x /usr/bin/dircolors ]; then
test -r ${HOME}/.dircolors && eval "$(dircolors -b ${HOME}/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
fi
2022-04-16 19:54:07 +00:00
# Vim stuff
alias vim="${HOME}/.nix-profile/bin/nvim"
2022-04-16 19:54:07 +00:00
alias :q="exit"
alias :wq="exit"
alias q="exit"
alias i="vim -c 'startinsert'"
# shortcuts
alias c="clear"
alias t="date +%T"
2022-05-27 21:07:55 +00:00
alias ll="ls -alh"
2022-04-16 19:54:07 +00:00
alias fuck='sudo "$BASH" -c "$(history -p !!)"'
2022-10-31 20:57:48 +00:00
# improve default options for CLI tools
alias diff="diff --side-by-side --left-column -W \$COLUMNS"
2022-10-31 20:57:48 +00:00
2022-04-16 19:54:07 +00:00
# OS functions (TODO: should be broken out and pulled in based on OS)
alias pip-upgrade="pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U"
# Legacy mappings
2022-05-27 21:07:55 +00:00
alias ifconfig="ip addr"
2022-04-16 19:54:07 +00:00
2023-10-24 17:13:01 +00:00
# SSH hop scripts
alias sshs="${HOME}/.private-scripts/sshs.sh"
2022-05-27 21:07:55 +00:00
alias pgen="ssh -A -t -i ~/.ssh/no_pass 10.10.0.1 ~/bin/pgen"
2022-04-16 19:54:07 +00:00
# Startup scripts
2022-05-27 21:07:55 +00:00
alias startsway="${HOME}/scripts/sway/startsway.sh"
alias starti3="${HOME}/scripts/i3/starti3.sh"
2022-04-16 19:54:07 +00:00
# Web shortcuts
2022-09-12 15:32:24 +00:00
alias papillon="flatpak run com.github.Eloston.UngoogledChromium --app='https://papillon.john.me.tz/hud.php?refresh=3600&theme=dark'"
2022-04-16 19:54:07 +00:00
# Force python3
alias python="python3"
# Backlight control
2022-05-27 21:07:55 +00:00
alias blc="${HOME}/scripts/thinkpad/blc.pl --notify"
2022-09-05 18:55:36 +00:00
# Flatpaks
alias mpv="flatpak run io.mpv.Mpv"
2023-10-05 18:34:34 +00:00
# Detect if I'm in a distrobox, returns name of box, if applicable
alias isdistrobox='[ -f "/run/.containerenv" ] && grep -oP "(?<=name=\")[^\";]+" /run/.containerenv'
# Flag that the directory was just changed (used with prompt)
alias cd='export DIRCHANGED="1"; cd'
if [ -f /etc/os-release ]; then
export OS=`grep -P '^ID=' /etc/os-release | cut -d'=' -f2 | sed 's/"//g'`
if [ -f ${HOME}/.dotfiles/bash/bash_aliases.$OS ]; then
source ${HOME}/.dotfiles/bash/bash_aliases.$OS
fi
OSVARIANT=`grep -P '^VARIANT_ID=' /etc/os-release | cut -d'=' -f2 | sed 's/"//g'`
if [ -z $OSVARIANT ]; then
export OSVARIANT
fi
if [ -f ${HOME}/.dotfiles/bash/bash_aliases.$OS-$OSVARIANT ]; then
source ${HOME}/.dotfiles/bash/bash_aliases.$OS-$OSVARIANT
fi
fi
2023-09-05 16:43:11 +00:00
if [ "$(isdistrobox)" ]; then
source "$HOME/.dotfiles/bash/bash_aliases.distrobox"
else
source "$HOME/.dotfiles/bash/bash_aliases.host"
fi