summaryrefslogtreecommitdiffstats
path: root/.zfunc/_dotfiles
diff options
context:
space:
mode:
Diffstat (limited to '.zfunc/_dotfiles')
-rw-r--r--.zfunc/_dotfiles21
1 files changed, 15 insertions, 6 deletions
diff --git a/.zfunc/_dotfiles b/.zfunc/_dotfiles
index 1a29842..55ca15a 100644
--- a/.zfunc/_dotfiles
+++ b/.zfunc/_dotfiles
@@ -1,9 +1,18 @@
#compdef dotfiles
-_arguments -C '*:: :->args'
+_dotfiles() {
+ # 1. Define your paths relative to HOME
+ # The :a modifier turns it into an absolute path for Git's internals
+ local -x GIT_DIR="${HOME}/.dotfiles"
+ local -x GIT_WORKTREE="${HOME}"
-oldwords=($words)
-words=(git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME/.dotfiles/" ${words[@]:0})
-CURRENT=$(( CURRENT + $#words - $#oldwords ))
-_normal && return 0
-return 1
+ # 2. Prepare the command line for the real 'git' completion
+ # We replace 'gwrap' (the first word) with 'git'
+ words[1]=git
+
+ # 3. Tell Zsh to use the official git completion logic
+ service=git
+ _git
+}
+
+_dotfiles "$@"