Files
dotfiles/.config/shell/aliasrc
2021-04-07 22:56:28 +01:00

97 lines
2.4 KiB
Bash

#!/bin/sh
# Use neovim for vim if present
[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d"
# Use $XINITRC variable if file exists.
[ -f "$XINITRC" ] && alias startx="startx $XINITRC"
# sudo not required for some system commands
for x in mount umount sv pacman updatedb su ; do
alias $x="sudo $x"
done
# Verbosity and settings that you pretty much just always are going to want.
alias \
cp="cp -iv" \
mv="mv -iv" \
rm="rm -vI" \
bc="bc -ql" \
mkd="mkdir -pv" \
yt="youtube-dl --add-metadata -i" \
yta="yt -x -f bestaudio/best" \
ffmpeg="ffmpeg -hide_banner" \
# Colorize commands when possible.
alias \
ls="ls -hN --color=auto --group-directories-first" \
grep="grep --color=auto" \
diff="diff --color=auto" \
ccat="highlight --out-format=ansi"
# Abbreviating long commands
alias \
ka="killall" \
YT="youtube-viewer" \
sdn="sudo shutdown -h now" \
e="$EDITOR" \
v="$EDITOR" \
p="sudo pacman" \
z="zathura" \
ll="ls -l" \
la="ls -al" \
ag="alias | grep"
# Git aliases
alias \
g="git" \
ga="git add" \
ga="git add --all" \
gb="git branch" \
gba="git branch -a" \
gbd="git branch -d" \
gbD="git branch -D" \
gbs="git bisect" \
gbsb="git bisect bad" \
gbsg="git bisect good" \
gbsr="git bisect reset" \
gbss="git bisect start" \
gc="git commit -v" \
gc!="git commit -v --amend" \
gcn!="git commit -v --no-edit --amend" \
gca="git commit -v -a" \
gca!="git commit -v -a --amend" \
gcan!="git commit -v -a --no-edit --amend" \
gcam="git commit -a -m" \
gcm="git checkout $(git_main_branch)" \
gco="git checkout" \
gcb="git checkout -b" \
gf="git fetch" \
gfa="git fetch --all --prune" \
gd="git diff" \
gl="git pull" \
glg="git log --stat" \
glgg="git log --graph" \
glo="git log --oneline --decorate" \
glgp="git log --stat -p" \
gm="git merge" \
gp="git push" \
grb="git rebase" \
gsb="git status -sb" \
gsh="git show" \
gsps="git show --pretty=short --show-signature" \
gsta="git stash push" \
gstaa="git stash apply" \
gstp="git stash pop" \
gstl="git stash list" \
gsts="git stash show --text" \
gup="git pull --rebase" \
nah="git reset --hard; git clean -df" \
gapa="git add --patch -A" \
gun="git reset --" \
glgm="git log --stat --author=christopher" \
glgpm="git log --stat -p --author=christopher"