From 9f548c417576509deedc5fbe9d44e84e25d5c539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Tue, 20 Aug 2013 22:35:16 +0200 Subject: [PATCH] Basic zsh completion for git_index The script now completes all projects in the index and all files in GIT_PROJECTS directory. --- lib/git/repo_index.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/git/repo_index.sh b/lib/git/repo_index.sh index 41a8dfe..dd8220d 100644 --- a/lib/git/repo_index.sh +++ b/lib/git/repo_index.sh @@ -334,8 +334,15 @@ else case "$state" in projects) - _files -/ -W $GIT_REPO_DIR - ;; + # Only check and rebuild index if necessary + _check_git_index + if [[ $PREFIX == /* ]]; then + PREFIX=$PREFIX[2,-1] + _files -X "Files in project directory" -W $GIT_REPO_DIR + else + compadd -X "Git projects" $(sed -e 's:.*/::' -e 's:$:/:' "$GIT_REPO_DIR/.git_index") && return 0 + fi + ;; git_command) ;; esac