# Controlled by chezmoi # System alias sctl='systemctl' alias sctlu='systemctl --user' alias jctl='journalctl' # Core aliases alias ll='ls -AlFh' alias la='ls -Ah' alias l='ls -CF' alias nano='micro' alias lg='lazygit' alias vim='nvim' alias chlg='lazygit --path ~/.local/share/chezmoi' alias es='exec $SHELL' # Chezmoi alias cha='chezmoi apply --interactive' alias ch='chezmoi' chshow() { target=$(find {{ .chezmoi.sourceDir | quote }} -name "*.tmpl" -type f | fzf) cat $target | chezmoi execute-template } # Remote Management alias romanlog="ssh roman 'tail -F /var/log/syslog' --lines 100" # Other aliases alias gpt='chatgpt' alias copilot='gh copilot' alias suggest='gh copilot suggest -t shell' alias spt='spotify_player' alias gitalias='alias | grep "git "' alias mousefix='sudo udevadm trigger' # helped with mouse issues on laptop alias bw_login='export BW_SESSION=$(bw unlock --raw)' # Clipboard aliases {{ if not .wsl -}} alias copy='xsel -ib' alias paste='xsel -b' alias cdp='cd $(xsel -b)' {{- else -}} alias copy='clip.exe' alias paste='powershell.exe -noprofile Get-Clipboard' alias cdp='cd $(xsel -b)' {{- end }} # fast chmod execute alias function chfix() { last_command=$(history | tail -n 1 | awk '{$1=""; sub(/^ /, ""); print $0}') if [[ -f $last_command ]]; then chmod +x $last_command else echo "Error: $last_command is not a valid file" fi } # https://docs.gitignore.io/install/command-line function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@; } function chcode() { EDITOR="code --wait" # If no arguments are provided, the chezmoi directory is opened if [[ "$@" == *"--watch"* ]]; then for arg in "$@"; do if [[ ! $arg == -* ]]; then chezmoi edit $@ return fi done echo "--watch requires a file to be provided, directories aren't supported with watch mode" fi chezmoi edit $@ } # 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" function lastRuns() { if [ -z "$1" ]; then RUNS=10; else RUNS=$1; fi gh run list -L $RUNS --json name,url | jq -c '.[] | [.name, .url] | join(" ")' -r } # Touches a file while also creating the parent directory (and any other necessary directories) in order to do so. 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"; }