From 5aedb0a9f55e4841dd632cac11c258448ea9ce68 Mon Sep 17 00:00:00 2001 From: Kutsan Kaplan Date: Wed, 13 Nov 2024 12:17:50 +0300 Subject: [PATCH] refactor(zsh): remove conflicting git completions --- .config/zsh/config/aliases.zsh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.config/zsh/config/aliases.zsh b/.config/zsh/config/aliases.zsh index 72634ce5..7f79a27a 100644 --- a/.config/zsh/config/aliases.zsh +++ b/.config/zsh/config/aliases.zsh @@ -23,8 +23,6 @@ typeset -A git_aliases=( c commit d diff ds diff - dt difftool - dts difftool f fetch l log ld log @@ -42,3 +40,19 @@ for key in ${(k)git_aliases}; do done unset git_aliases unset key + +# Remove the Homebrew version of `git` completions, as they are incompatible with Zsh aliases. +function remove_conflicting_git_completions() { + local git_completion_bash="$HOMEBREW_PREFIX/share/zsh/site-functions/git-completion.bash" + local git_completion_zsh="$HOMEBREW_PREFIX/share/zsh/site-functions/_git" + + if ([[ -e "$git_completion_bash" ]]) { + command rm "$git_completion_bash" + } + + if ([[ -e "$git_completion_zsh" ]]) { + command rm "$git_completion_zsh" + } +} + +remove_conflicting_git_completions