From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19723 invoked by alias); 5 Aug 2014 22:38:33 -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: 32965 Received: (qmail 28024 invoked from network); 5 Aug 2014 22:38:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=urGSdzc24nfmGO/yc2Bw+RV6uUkqPNna/y5gpuuPo30=; b=CTjJ6xepFe1piu8nzDGgbq34r791RAoGSLB3CkvTcYh4UJk9/VGTYejBoZX7m+0nut 1Qph0psV7p7+y3YbGT26040OsWjNzlcKQfsDL3NIAbk7pCXvt0aFFvW7zDJhtih1qUW7 Bbdpy4FoupXAdMZil7Z2+Q+SNu9lY2z8Oqw2DZPwm2g0cFHyopa9t8ZDXmKEzRCMmctS JbG2BWaU2FrvePAJsI7i0t1n6iEPKz6fxfhisBNI11700Iz4nlbox9uFzCDB5eieZgEE pOJhOwUZlyPz7/eIPt6pO/qupZY4XGJ5iJXWp2ZlSOUtqLAukGfNW9WBH/Bk7x7YI50P 3jxA== X-Received: by 10.194.58.244 with SMTP id u20mr10398310wjq.36.1407278295338; Tue, 05 Aug 2014 15:38:15 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <140804135755.ZM2030@torch.brasslantern.com> References: <140804133941.ZM1946@torch.brasslantern.com> <140804135755.ZM2030@torch.brasslantern.com> From: Domagoj Pintaric Date: Wed, 6 Aug 2014 00:37:55 +0200 Message-ID: Subject: Re: Custom auto complete To: Bart Schaefer Cc: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary=047d7b86cf26e4de4504ffe982c9 --047d7b86cf26e4de4504ffe982c9 Content-Type: text/plain; charset=ISO-8859-1 Hi, The solution you posted sort of dose what I want. With this code I have to type ? in order for it to work. If I just type ? and hit tab it dose not work. I get that's because of ( \?* ) and I tried (\?) but it dose not work. Interesting, if I use for example ( \! ) that works as expected. Is the '?' special for some reason? Also I found another way of getting what I want I think it's a more intuitive solution than the whole '?' idea. I found that I can write my own widget and bind it to a key so this is what I did: zle -C custom-complete menu-expand-or-complete _parse_sb_file _parse_sb_file() { WORDS=( ${(f)"$(<$SB_FILE_PATH)"} ) ARRAY=() integer POS=1 for ITEM in ${WORDS}; do ARRAY[${POS}]=${POS}") "${WORDS[${POS}]} (( POS++ )) done compadd -l -d ARRAY -a -S '' -- WORDS } bindkey ${CTRLTAB_KEY} custom-complete This works but I have some issues with this to: 1) if I press ctrl-tab I can not select the options with arrow keys I can just switch them with ctrl-tab, unless I first run for example "cp " then I get the menu and I can select options. And if I after that (after cp showed the menu with select) use ctrl-tab I get menu with select? Not sure why I first have invoke another menu for ctrl-tab to work in a same manner? 2) if I have this string, for example, in a file "cp file1 file2" it is inserted like this "cp\ file1\ file2". The white spaces are escaped, how can I disable this, and tell zsh to insert a string as it is. Thanks for your help. Regards, Domagoj On Mon, Aug 4, 2014 at 10:57 PM, Bart Schaefer wrote: > On Aug 4, 1:39pm, Bart Schaefer wrote: > } > } # Now anything starting with '?' > } (\?*) _message "Querying answerfile" > } compstate[insert]=menu > } compadd -U -a answers # -U to replace "?" with the result > } ;; > > Hmm, it occurs to me that this should probably be in the order > > compadd -U -a answers # -U to replace "?" with the result > compstate[insert]=menu > > so that the initial value of compstate[insert] is visible to compadd > before we change it. I don't know exactly when that would matter, but > the doc for compstate[insert] implies that it might. > --047d7b86cf26e4de4504ffe982c9--