Skip to content

Commit

Permalink
feat(zsh): update git aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
kutsan committed Aug 15, 2024
1 parent b3fb943 commit 6839a68
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions .config/zsh/config/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,31 @@ alias la='ls -lAh' # List nodes with their details.
# Custom Shortcuts
alias v="$EDITOR"
alias g='git'
compdef g='git'

# git
foreach key (c d ds l s) {
typeset -A git_aliases=(
a add
b branch
bl branch
c commit
d diff
ds diff
dt difftool
dts difftool
f fetch
l log
ld log
r reflog
rd reflog
s status
sm submodule
sw switch
)

# Loop through each alias, create the alias, and set the compdef
for key in ${(k)git_aliases}; do
alias g$key="git $key"
}
compdef _git "g$key=git-${git_aliases[$key]}"
done
unset git_aliases
unset key

0 comments on commit 6839a68

Please sign in to comment.