diff --git a/executable_dot_bash_aliases b/executable_dot_bash_aliases index 87a234d..f88b648 100644 --- a/executable_dot_bash_aliases +++ b/executable_dot_bash_aliases @@ -1,5 +1,93 @@ -alias copy='zsel -ib' -alias cdp='cd $(xsel -b)' -alias vim='nvim' alias nano='micro' alias ch='chezmoi' +alias copy='xsel -ib' +alias cdp='cd $(xsel -b)' +alias spt='spotify_player' +alias lg='lazygit' +alias vim='nvim' +alias gitalias='alias | grep "git "' +alias mousefix='sudo udevadm trigger' +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +# https://docs.gitignore.io/install/command-line +function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;} + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Creates a temporary file with the given +function tempCode() { + if [ -z "$1" ]; then + echo "Must provide filetype argument (ex: py, .xml, html)" + else + # Remove preceding dot, then re-add to support both '.py' and 'py' as arguments + EXTENSION=$(echo $1 | sed 's/^\.//') + TEMP_FILE=$(mktemp "/tmp/XXXXXXXXXXXX_$(uuidgen).$EXTENSION") + echo "Temporary $1 file created at $TEMP_FILE" + code --file-uri "file://$TEMP_FILE" + fi +} + +# Alias to disable/enable bluetooth connection to Galaxy Buds +budsAddress="60:3A:AF:75:61:80" +alias budsOff="bluetoothctl block $budsAddress" +alias budsOn="bluetoothctl unblock $budsAddress && bluetoothctl connect $budsAddress" + +# Alias to disable/enable bluetooth connection to Bose QC45s +maestroAddress="AC:BF:71:66:FE:B2" +alias maestroOff="bluetoothctl block $maestroAddress" +alias maestroOn="bluetoothctl unblock $maestroAddress && bluetoothctl connect $maestroAddress" + +# Touches a file while also creating the parent directory (and any other necessary directories) in order to do so. +function mktouch() { + mkdir -p $(dirname $1) && touch $1; +} + +# When in the appropriate KiTTy terminal, use the SSH kitten +[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh" + +# ---------------------- +# Git Aliases +# ---------------------- +alias ga='git add' +alias gaa='git add .' +alias gaaa='git add --all' +alias gau='git add --update' +alias gb='git branch' +alias gbd='git branch --delete ' +alias gc='git commit' +alias gcm='git commit --message' +alias gcf='git commit --fixup' +alias gco='git checkout' +alias gcob='git checkout -b' +alias gcom='git checkout master' +alias gcos='git checkout staging' +alias gcod='git checkout develop' +alias gd='git diff' +alias gda='git diff HEAD' +# alias gi='git init' +alias glg='git log --graph --oneline --decorate --all' +alias gld='git log --pretty=format:"%h %ad %s" --date=short --all' +alias gm='git merge --no-ff' +alias gma='git merge --abort' +alias gmc='git merge --continue' +alias gp='git pull' +alias gpr='git pull --rebase' +alias gr='git rebase' +alias gs='git status' +alias gss='git status --short' +alias gst='git stash' +alias gsta='git stash apply' +alias gstd='git stash drop' +alias gstl='git stash list' +alias gstp='git stash pop' +alias gsts='git stash save' + +# ---------------------- +# Git Functions +# ---------------------- +# Git log find by commit message +function glf() { git log --all --grep="$1"; }