.zsh/zshrc.d/20-aliases.zsh
#!/usr/bin/env sh

alias quit="exit"

alias dots='git --git-dir=$HOME/.dots.git --work-tree=$HOME'
alias dots-ls='dots ls-files'
alias dots-ls-untracked='dots status -u .'

if command -v compdef >/dev/null; then
  compdef _git dots="git"
fi

alias gpu-on="gpu-change on"
alias gpu-off="gpu-change off"

alias connect.pi="ssh root@pi.local"
alias connect.work="ssh michael@workbox.local"

alias externalip="curl -s checkip.dyndns.org | sed 's/[^0-9.]//g'"
alias hardwareinfo="inxi -F"

alias browser.vimb='vimb'
alias browser.qute='qutebrowser'
alias browser.vimperator='firefox -vimperator "++cmd ''source ${XDG_CONFIG_HOME}/vimperator/vimperatorrc''"'
alias browser.chromium='chromium'
alias browser.tor='tor-browser-en'

alias launch.wm='$X11_HOME/launch'
alias launch.xvnc='$X11_HOME/xvnc'
alias launch.compton='bash -c "$LOCAL_ETC/compton/launch"'
alias launch.sxhkd='bash -c "$LOCAL_ETC/sxhkd/launch &"'
alias launch.dunst='bash -c "$LOCAL_ETC/dunst/launch &"'

alias lemonbuddy='polybar'
alias term.polybar='killall polybar'
alias termkill.polybar='killall -9 polybar'

alias reload.compton='$LOCAL_ETC/compton/reload'
alias reload.sxhkd='$LOCAL_ETC/sxhkd/reload'
alias reload.dunst='$LOCAL_ETC/dunst/reload'
alias reload.bspwm='$LOCAL_ETC/bspwm/reload'
alias reload.polybar='$LOCAL_ETC/polybar/reload'
alias reload.xkbmap='$LOCAL_ETC/xorg/xkbmaprc'
alias reload.i3='$LOCAL_ETC/i3/reload'

alias gosandbox='cd ~/sandbox/c++'
alias goservices='cd $LOCAL_ETC/sv/'
alias gothemes='cd $LOCAL_ETC/themer/themes'
alias gobspwm='cd $LOCAL_ETC/bspwm'
alias gopolybar='cd $LOCAL_ETC/polybar'
alias gosh='cd $LOCAL_SRC/sh'
alias gocpp='cd $LOCAL_SRC/cpp'
alias gomedia='cd /storage/media'

alias errbspwm='vim $XDG_CACHE_HOME/bspwm/stderr'
alias errcompton='vim $XDG_CACHE_HOME/compton/stderr'
alias erri3='vim $XDG_CACHE_HOME/i3/stderr'
alias errsxhkd='vim $XDG_CACHE_HOME/sxhkd/stderr'

alias pastebin='curl -F "sprunge=<-" http://sprunge.us'
alias termite-floating='termite -t floatme'
alias lpass-login='lpass login $(sudo cat /root/lpass_username)'
alias xupd="xbps-install -Su"
alias xquery="xbps-query"
alias xfiles='xbps-query -R $(xreposet) -f'
alias xrem="xbps-remove"
alias xbelongs="xbps-query -o"
alias xrequiredby="xbps-query -X"
alias xlistcontents="xbps-query -f"
alias xbuild="./xbps-src" ;
alias xbuild-clean="./xbps-src zap && ./xbps-src binary-bootstrap"
alias xbuild-test="./xbps-src-testbuild"
alias xcd='cd $XBPS_DISTDIR'

alias xorglog="vim /var/log/Xorg.0.log"
alias xorglogbumblebee="vim /var/log/Xorg.8.log"
alias xorgconf="vim /etc/X11/xorg.conf.d/20-gpu.conf"
alias xorgconfbumblebee="vim /etc/bumblebee/xorg.conf.nvidia"

alias ga="git add"
alias gd="git diff"
alias gds="git diff --staged"
alias gco="git checkout"
alias gst="git status"
alias ggpur="git pull --rebase"
alias grm="git rebase master"

alias hdmi-reload='xrandr --output HDMI-1 --auto --above eDP-1; $XDG_CONFIG_HOME/bspwm/reload'

# TODO: Create a symlink to vim/nvim instead to make
# sure that the same version is used everywhere
alias vim="nvim"
alias vi="nvim"
alias ncmpcpp='ncmpcpp -b $XDG_CONFIG_HOME/ncmpcpp/bindings'
alias xrdb-reload='$LOCAL_ETC/xorg/xrdb_reload'
alias gpg-decrypt-clipboard='xclip -o | gpg --decrypt | xclip'
alias sudo="sudo"
alias reboot="sudo reboot"
alias poweroff="sudo poweroff"
alias halt="sudo halt"
alias tv="tvremote"

alias lemonbar-striptags='sed -u -r "s/%\{[^}]+\}//g"'
alias lemonbar-striptags-trim='lemonbar-striptags | tr -s " "'

alias grepr="grep -r"
alias egrepr="egrep -r"

alias ghub='cd $GITHUB_HOME'
alias ghubl='cd $GITHUB_HOME/jaagr'
alias ghubpolybar='cd $GITHUB_HOME/jaagr/polybar'
alias ghubwmrestack='cd $GITHUB_HOME/jaagr/wmrestack'
alias ghubbarlib='cd $GITHUB_HOME/jaagr/barlib'
alias ghubxlib-drawrect='cd $GITHUB_HOME/jaagr/xlib-drawrect'

alias perlcd='cd $PERL_HOME'
alias cpan="perlcd && perl -MCPAN -e shell"
alias gdb-run="gdb -ex run -args"
alias cgdb-run="cgdb -ex run -args"

alias cmake-gcc="cmake -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++"
alias cmake-clang="cmake -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
alias cmake-debug="cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug"
alias cmake-debug-gcc="cmake-gcc -DCMAKE_BUILD_TYPE=Debug"
alias cmake-debug-clang="cmake-clang -DCMAKE_BUILD_TYPE=Debug"
alias cmake-relwithdebinfo="cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo"
alias cmake-relwithdebinfo-gcc="cmake-gcc -DCMAKE_BUILD_TYPE=RelWithDebInfo"
alias cmake-relwithdebinfo-clang="cmake-clang -DCMAKE_BUILD_TYPE=RelWithDebInfo"
alias cmake-release="cmake -G Ninja -DCMAKE_BUILD_TYPE=Release"
alias cmake-release-gcc="cmake-gcc -DCMAKE_BUILD_TYPE=Release"
alias cmake-release-clang="cmake-clang -DCMAKE_BUILD_TYPE=Release"
alias cmake-purge="rm -rf CMakeFiles CMakeCache.txt"
#alias cmake-uninstall='if [ -e install_manifest.txt ]; then sudo rm -i -v "$(cat install_manifest.txt)" install_manifest.txt; else echo "Cannot find install_manifest.txt"; fi'
#alias cmake-clean='test -e ./CMakeCache.txt && rm -rf * && cmake ..'

# Default command flags
alias mv="mv -v"
alias ln="ln -v"
alias cp="cp -v"
alias rm="rm -v"
alias ls="ls --group-directories-first --dereference-command-line-symlink-to-dir --color=auto"
alias ll="ls --dereference-command-line-symlink-to-dir -lh"
alias l="ls -la --dereference-command-line-symlink-to-dir"
alias info='info --vi-keys --init-file=${XDG_CONFIG_HOME}/infokey'
alias pgrep="pgrep -l"
alias grep="grep -i --color=auto"
alias egrep="egrep --color=auto"

# Sudo cmds
alias sv="sudo sv"
alias lvs="sudo lvs"
alias vgs="sudo vgs"
alias lvdisplay="sudo lvdisplay"
alias vgdisplay="sudo vgdisplay"
alias xbps-install="sudo xbps-install"
alias xbps-query="sudo xbps-query"
alias xbps-remove="sudo xbps-remove"
alias xbps-pkgdb="sudo xbps-pkgdb"
alias xbps-reconfigure="sudo xbps-reconfigure"
alias adb="sudo adb"

## svtools
alias svdisable="sudo -E svdisable"
alias svenable="sudo -E svenable"
alias svlist="sudo -E svlist"
alias svrestart="sudo -E svrestart"
alias svstart="sudo -E svstart"
alias svstop="sudo -E svstop"

# Spelling corrections
alias vmi="vim"
alias exi="exit"
alias exti="exit"
alias eitx="exit"
alias eixt="exit"
alias exiyt="exit"
alias exity="exit"

# vim:ft=sh
