164 lines
5.4 KiB
Bash
164 lines
5.4 KiB
Bash
#!/bin/sh
|
|
## Short hand programs (ex: sc = shellcheck) >>>
|
|
# use nvim rather than vim if the command exists
|
|
alias \
|
|
vimdiff='nvim -d' \
|
|
|
|
alias sd=sudo
|
|
|
|
alias \
|
|
vv='$EDITOR' \
|
|
e='$EDITOR' \
|
|
svv='sudoedit' \
|
|
|
|
# I do this too much by accident smh my head
|
|
alias \
|
|
:q='exit' \
|
|
q='exit' \
|
|
|
|
# rmdir is long
|
|
alias \
|
|
rmd='rmdir' \
|
|
rd='rmdir' \
|
|
|
|
# opt for trash-cli over rm
|
|
if command -v trash > /dev/null; then
|
|
alias rm=trash
|
|
fi
|
|
|
|
# git
|
|
alias g=git
|
|
|
|
# <<<
|
|
## Program improvements (ex: ls = ls -h) >>>
|
|
alias sudo='sudo VISUAL="$VISUAL" SYSTEMD_EDITOR="$SYSTEMD_EDITOR" ' # allow using aliases in sudo commands and add some env vars
|
|
alias df='df -h' # Human-readable sizes
|
|
alias free='free -m' # Show sizes in MB
|
|
alias bc='bc -ql' # Make bc usable for fast math
|
|
alias ffmpeg='ffmpeg -hide_banner'
|
|
[ -z "$VIMRUNTIME" ] &&
|
|
alias glow='glow -p' # force Glow to preview with `less` if not in vim
|
|
|
|
# I hate it when I get ghost script instead of git status
|
|
alias gs='echo "you don'\''t $(tput sitm)really$(tput sgr0) want ghost script now, do you?"'
|
|
|
|
# tell make to use all cpu cores
|
|
alias make='make -j$(nproc)'
|
|
|
|
# Colors
|
|
alias \
|
|
ls='ls -hN --color=auto --group-directories-first' \
|
|
grep='grep --color=auto' \
|
|
egrep='egrep --color=auto' \
|
|
fgrep='fgrep --color=auto' \
|
|
diff='diff --color=auto' \
|
|
pacman='pacman --color=auto' \
|
|
ip='ip -color=auto' \
|
|
|
|
# super duper paru alias
|
|
# shellcheck disable=SC2139
|
|
command -v paru > /dev/null && alias \
|
|
parue='\paru --color=auto --sudoloop --newsonupgrade --pgpfetch --upgrademenu --bottomup --fm nvim' \
|
|
paru='parue --skipreview' \
|
|
|
|
# TODO: make sure IS_TTY is set to a value in the env file, in case the profile is not installed.
|
|
if command -v lsd > /dev/null && ! ${IS_TTY:-false}; then
|
|
alias ls=lsd
|
|
alias lsd='lsd --group-dirs=first'
|
|
fi
|
|
|
|
# Shorter + more useful mkdir
|
|
alias mkd="mkdir -p"
|
|
|
|
# <<<
|
|
## Mini short-hand scripts (ex: glone = git clone) >>>
|
|
# dotfile management
|
|
alias dot='git --git-dir="$HOME/git/dotfiles" --work-tree="$HOME"'
|
|
alias d='git --git-dir="$HOME/git/dotfiles" --work-tree="$HOME"' # duplicate for auto-complete
|
|
|
|
# quicker shutdown
|
|
alias sdn='shutdown now'
|
|
|
|
# open a new session called 0, but if there is already a session called 0, connect to it
|
|
alias tm='tmux new -As0'
|
|
|
|
# *sigh*...
|
|
alias cd-='cd -'
|
|
|
|
# List available X displays. Useful for finding what display to export when connected over ssh.
|
|
alias lsx='ls /tmp/.X11-unix | tr "X" ":"'
|
|
|
|
# systemctl
|
|
alias \
|
|
scl='sudo systemctl' \
|
|
sclen='sudo systemctl enable --now' \
|
|
scldn='sudo systemctl disable --now' \
|
|
scu='systemctl --user' \
|
|
|
|
# Make ydotool actually usable for short things
|
|
alias ydotool='(sudo ydotoold &) && sleep 0.08 && sudo ydotool'
|
|
|
|
# Update zinit and plugins
|
|
alias zup='zinit self-update && zinit update --parallel'
|
|
|
|
# Run PackerSync in neovim with PS
|
|
alias PS='nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerSync"'
|
|
|
|
# Edit config files
|
|
alias \
|
|
zc='$EDITOR ~/.zshrc' \
|
|
sc='$EDITOR $SHELL_CONFIG_DIR/shrc' \
|
|
fstab='sudoedit /etc/fstab' \
|
|
histe='$EDITOR $HISTFILE' \
|
|
|
|
# Get me to my code faster
|
|
[ -n "$C" ] && alias cdc='cd "$C" && source ../bin/utils.bashrc'
|
|
|
|
# Git cLONE
|
|
alias glone="git clone"
|
|
|
|
# Docker
|
|
alias \
|
|
logs='docker-compose logs --tail=200 -f' \
|
|
dupd='docker-compose up -d' \
|
|
ddwn='docker-compose down' \
|
|
dc='docker-compose' \
|
|
occ='docker exec -u www-data nextcloud php occ --ansi' \
|
|
|
|
# Nix
|
|
alias \
|
|
nsp='nix-shell -p' \
|
|
nx='$EDITOR /etc/nixos/systems/$HOST/default.nix' \
|
|
nxf='$EDITOR /etc/nixos/flake.nix' \
|
|
nxpl='sudo nix-channel --update' \
|
|
nxup='nxpl && sudo nixos-rebuild switch' \
|
|
nxfup='cd /etc/nixos; nix flake update; cd -' \
|
|
|
|
# file copying with a progress bar
|
|
alias cpv="rsync -ah --info=progress2"
|
|
|
|
# lists all open ports, along with some other info
|
|
alias ls-ports='netstat -tulpn'
|
|
|
|
# list all disks and their mount points
|
|
# shellcheck disable=SC2142
|
|
alias mnt="mount | awk -F' ' '{ printf \"%s\t%s\n\",\$1,\$3; }' | column -t | grep -E '^/dev/' | sort"
|
|
|
|
# backs up list of packages
|
|
alias packback='comm -23 <(paru -Qqett | sort) <(paru -Qqg base -g base-devel | sort | uniq) > ~/pkglist.txt'
|
|
|
|
# thoroughly reset the terminal
|
|
alias rce='reset && clear && exec zsh'
|
|
|
|
# find pretty much any file, quickly
|
|
alias fds='fd --no-ignore --hidden --exclude /run --exclude /mnt'
|
|
|
|
# Common ls aliases
|
|
alias \
|
|
l='ls' \
|
|
la='ls -ah' \
|
|
ll='ls -lh' \
|
|
lla='ls -lah' \
|
|
# <<<
|
|
|
|
# vim:fdm=marker:fmr=>>>,<<<:fdl=1:et:ft=bash:sw=3:ts=3
|