From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-request@euclid.skiles.gatech.edu Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.6/8.7.3) with ESMTP id UAA01843 for ; Fri, 15 Nov 1996 20:04:57 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id EAA14646; Fri, 15 Nov 1996 04:00:08 -0500 (EST) Resent-Date: Fri, 15 Nov 1996 03:46:49 -0500 (EST) From: "Bart Schaefer" Message-Id: <961115005040.ZM7720@candle.brasslantern.com> Date: Fri, 15 Nov 1996 00:50:40 -0800 In-Reply-To: Matthew Braun "Re: tcsh's autocorrect functionality wanted" (Nov 14, 6:18pm) References: <199611142318.SAA02669@sassy.aa.ans.net> Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.820 20aug96) To: Matthew Braun , zsh-users@math.gatech.edu Subject: Re: tcsh's autocorrect functionality wanted MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"00YuW2.0.0Z3.ut2Zo"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/505 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Nov 14, 6:18pm, Matthew Braun wrote: } Subject: Re: tcsh's autocorrect functionality wanted } } > } autocorrect (+) } > } > That would be pretty trivial to add, I think, except for the bugs in } > spell-word described below. } } Trivial for someone who already knows the code. Any maintainers out } there listening? Please add this. Thanks! I already sent a partial patch to zsh-workers for consideration. No one has bitten yet. } Bart, mind giving me some examples of how completeinword and awaystoend } work? I tried setting these and hitting tab in a few instances, but it } didn't seem to change the behavior. I can see where it would be nice if } COMPLETE_IN_WORD worked for spell-word, but I don't see it actually } affecting anything right now. First, note that complete_in_word works only with expand-or-complete, not with expand-or-complete-prefix. If you have tab bound to complete prefixes, you won't see any change in behavior. Complete_in_word lets you place the cursor in the middle of a word (it's really only interesting for file paths) and do completion on the part of the word to the left of the cursor. Normally, the cursor is left in the middle of the word when this happens; but if you also set always_to_end, the cursor moves to the end of the word when the completion is unique. Complete_in_word succeeds on the left portion only if continuing the completion with the right portion would also succeed. This is the desired behavior (otherwise it'd just be expand-or-complete-prefix), but it means that it is nearly useless unless you also set glob_complete (so that partial file (or directory) names may appear to the right). Here's an example, starting from "zsh -f". zagzig% ls -dF ~/*/farm* /home/schaefer/homepage/farm/ /home/schaefer/tmp/farm1.xbm /home/schaefer/public_html/farm/ /home/schaefer/tmp/farm2.xbm /home/schaefer/tmp/farm.gif zagzig% setopt completeinword menucomplete zagzig% xv ~//farm At this point, if I move the cursor to the second slash (so insertion is between the two slashes) and press TAB, I first see: zagzig% xv ~/homepage/farm with cursor still on the second slash. Press TAB again: zagzig% xv ~/public_html/farm with cursor still on the second slash. Repeated presses of TAB cycle back and forth through these two choices. Now: zagzig% setopt alwaystoend zagzig% xv ~//farm Again move the cursor to the second slash and press TAB. This time: zagzig% xv ~/homepage/farm/ and the cursor is at the end of the word. TAB again cycles to zagzig% xv ~/public_html/farm/ Next: zagzig% setopt globcomplete zagzig% xv ~//farm Now "farm" can act as a partial word, and I can cycle THREE choices: zagzig% xv ~/homepage/farm/ zagzig% xv ~/public_html/farm/ zagzig% xv ~/tmp/farm The cursor moves to the end of each path because of always_to_end; with that unset, the cursor would stay at the second slash, but I'd still be cycling the same three choices. Again, the difference vs. bindkey \\t expand-or-complete-prefix is that your choices for the completion of the left part of the word are limited by what appears in the right part of the word. Personally, what I'd really like is to be able to attempt this kind of behavior, and then revert to expand-or-complete-prefix only if this finds no possible completions. But zsh doesn't support that kind of conditional action in bindkey sequences; instead, you have to write a custom function and figure out a compctl for it, which can be a lot slower and can't be bound directly to a key. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.nbn.com/people/lantern