dotfiles/shell/aliasrc
2025-05-15 17:49:14 +00:00

71 lines
1.8 KiB
Plaintext

# ~/.aliasrc - Compatible with Bash and Zsh
# Array containing all alias definitions as strings
alias_list=(
# General Shell Aliases
"ll='ls -alF'"
"ls='ls -lah --color'"
# Fix for the grep alias - use \grep to prevent alias recursion
"grep='\\grep --color=auto'"
"vi='vim'"
"lpg='cd ~/git/lucidpoint'"
"ppg='cd ~/git/personal'"
"downloads='cd ~/Downloads'"
"desktop='cd ~/Desktop'"
"docs='cd ~/Documents'"
"pip='pip3'"
"python='python3'"
# PYTHON
"ve='source venv/bin/activate'"
# GIT
"gaa='git add --all'"
"gcm='git commit --all --message'"
"glo='git log --oneline --decorate --graph --all'"
"gl='git pull'"
"gp='git push'"
"gpd='git push --dry-run'"
"gpv='git push --verbose'"
"grb='git rebase'"
"grv='git remote --verbose'"
"gs='git show --pretty=short'"
"gst='git status --short'"
"gd='git diff'"
"gdca='git diff --cached'"
"gdcw='git diff --cached --word-diff'"
"gds='git diff --staged'"
"gdw='git diff --word-diff'"
# SSH
"ed='ssh errol@edesktop.sancaktar.net'"
"fs='ssh errol@fs1.sancaktar.net'"
# Kubernetes
"k='kubectl'"
# Terraform/Tofu
"t='tofu'"
)
# Iterate and define aliases
for alias_def in "${alias_list[@]}"; do
# 'eval alias' works reliably in both Bash and Zsh for these types of aliases.
# We no longer need separate branches for Bash/Zsh due to the eval approach.
eval "alias $alias_def"
done
# Alias Function (these are shell functions, not aliases, and work in both)
# The `gc` function is already shell-compatible as written.
gc() {
git add --all
if [ -n "$1" ]; then
git commit --all --message "$1"
else
git commit -m "update" # Added default message for clarity
fi
git push --verbose
}
unset alias_list alias_def # Clean up temporary variables