From 08ffd87bc84928ef5ca0792175323d441145f5ce Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 16 Aug 2013 21:45:26 -0300 Subject: Initial code to make zsh-compatible completion --- lib/keyringer/completions/bash | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/keyringer/completions/bash b/lib/keyringer/completions/bash index a8fce92..4459b34 100644 --- a/lib/keyringer/completions/bash +++ b/lib/keyringer/completions/bash @@ -1,7 +1,12 @@ +#!bash # # Keyringer bash completion # +if [[ -n ${ZSH_VERSION-} ]]; then + autoload -U +X bashcompinit && bashcompinit +fi + # Completion for git subcommand _keyringer_git_complete() { if [ -e "/etc/bash_completion.d/git" ]; then @@ -97,11 +102,17 @@ _keyringer() { fi # Avoid annoying bell and extra tab - bind 'set show-all-if-ambiguous on' + if [ -z "$ZSH_VERSION" ]; then + bind 'set show-all-if-ambiguous on' + fi # Return the available options COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - [[ $COMPREPLY == */ ]] && compopt -o nospace + + if [ -z "$ZSH_VERSION" ]; then + [[ $COMPREPLY == */ ]] && compopt -o nospace + fi + return 0 } -- cgit v1.2.3