From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16003 invoked by alias); 4 Jun 2011 18:33:07 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29457 Received: (qmail 29279 invoked from network); 4 Jun 2011 18:32:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110604113241.ZM19723@torch.brasslantern.com> Date: Sat, 04 Jun 2011 11:32:41 -0700 In-reply-to: <1307144249-sup-4787@nixos> Comments: In reply to Marc Weber "select item from list in modify-current-argument?" (Jun 4, 1:41am) References: <1307144249-sup-4787@nixos> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Marc Weber , zsh-workers Subject: Re: select item from list in modify-current-argument? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jun 4, 1:41am, Marc Weber wrote: } } select-one first uses echo to show the alternatives, then read to get } the item index from the user. } } However because echo shows many lines the code copied from } modify-current-argument get's confused. I'd probably just do this: _my_quickpath() { [[ -z "${words[CURRENT]}" ]] && (( CURRENT > 0 && --CURRENT )) compadd -Q -U $($HQUICKFILE --echo "${words[CURRENT]}") } compdef -k _my_quickpath menu-select ^g I'm not entirely sure about the --CURRENT part but you get the idea. If you insist on doing it yourself without using a completion widget, then you need to replace line 24-25 of select-one with something along the lines of local -a replies for i ({1..$#@}) { replies+=( "$i: ${${@[$i]}#$strip}" ) } read-from-minibuffer "$(print -c "${replies[@]}")"$'\n' And then replace other calls to "read $opt" with a similar call to read-from-minibuffer. (Oh, it needs to be autoloaded first.) This of course renders select-one unusuable outside of ZLE, so you'll have to make a new function out out it if you want select-one for any other purpose.