[PATCH] Escape colons in zsh completion to show url ports

Johannes Altmanninger aclopte at gmail.com
Mon Jul 13 18:48:58 CEST 2020


On Mon, Jul 13, 2020 at 02:00:23PM +0200, Guido Cella wrote:
> zsh completion cuts filenames after colons, for example port numbers.
> This is fixed by escaping colons.
> ---
>  src/completion/pass.zsh-completion | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/completion/pass.zsh-completion b/src/completion/pass.zsh-completion
> index 27ce15a..192bca2 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#\\#\\\\#' -e 's#:#\\:#' | sort):-""}

I believe the last two sed commands should have the "g" modifier to replace all matches:

	... -e 's#\\#\\\\#g' -e 's#:#\\:#g'

>  }
>  
>  _pass_complete_entries_with_subdirs () {
> -- 
> 2.27.0
> 


More information about the Password-Store mailing list