Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to insert completions on command line



On Aug 20,  1:41am, Vincent Lefevre wrote:
} Subject: Re: How to insert completions on command line
}
} On 2006-08-19 11:17:54 -0700, Bart Schaefer wrote:
} >           zle -C all-matches complete-word _generic
} >           bindkey '^Xa' all-matches
} >           zstyle ':completion:all-matches:*' old-matches only
} >           zstyle ':completion:all-matches::::' completer _all_matches
} 
} I've tried for instance: mail ^Xa
} but the ^Xa has no effect, whereas [Tab] lists all the possible
} completions.

I had forgotten (and the manual, from which I copied those lines, doesn't
state directly) how _all_matches works.  You have to first generate the
list of completions with a normal completer (such as by pressing tab) and
then type ^Xa to insert them on the line.  _all_matches doesn't generate
any completions of its own.

To get the effect of having ^Xa both generate and insert completions,
you need:

	zle -C all-matches complete-word _generic
	bindkey '^Xa' all-matches
	zstyle ':completion:all-matches:*' insert yes
	zstyle ':completion:all-matches::::' completer \
		_all_matches _complete

Replace or augment _complete with whatever other completers you want,
but _all_matches must come first.



Messages sorted by: Reverse Date, Date, Thread, Author