Fix bash completion with colons

Roderik Muit rm at wyz.biz
Thu Mar 25 13:59:43 UTC 2021


I started using zsh yesterday, and my command completion broke. 

It happens at least with filenames containing colons. The details of the
breakage are: "the completion suggestions are all weird so they are
useless". (I haven't looked at further details.)

The completion command contains a $@, and I my first guess was maybe
trying to quote it would help. Lo and behold, it did! So I stopped trying
to understand much about zsh completion after that. Here's the patch that
worked for me.
-------------- next part --------------
diff --git a/src/completion/pass.zsh-completion b/src/completion/pass.zsh-completion
index 27ce15a..cc8c39f 100644
--- a/src/completion/pass.zsh-completion
+++ b/src/completion/pass.zsh-completion
@@ -124,7 +124,7 @@ _pass_complete_entries_helper () {
 	local IFS=$'\n'
 	local prefix
 	zstyle -s ":completion:${curcontext}:" prefix prefix || prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
-	_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#' | sort):-""}
+	_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o "$@" -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#' | sort):-""}
 }
 
 _pass_complete_entries_with_subdirs () {


More information about the Password-Store mailing list