From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28623 invoked by alias); 8 Nov 2011 16:03:26 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16560 Received: (qmail 16196 invoked from network); 8 Nov 2011 16:03:24 -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=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.214.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=SDeuDxING4OGlrRhWLbxkkR5mu6KaFoqaCgeCQGdOiw=; b=ts8/YfmAsSJk1zEaF1oLU8U/OKa6qNRfv1z1Hz4YCxhAa2rGwHBnhFYMeCFcI3WtB2 XfYmncLH9I7b8/Kc4R8/sjO9bHTxl5UoKIVOwsO3KdGeHu/AI/v57E2XVCl0Cqa/nl8W CHbAp4VkHfglQgh07h4lQJsqj1XmRlNKV3rJo= MIME-Version: 1.0 In-Reply-To: <111108071341.ZM3017@torch.brasslantern.com> References: <20111108131022.GA1621@x4.trippels.de> <20111108135809.GB1621@x4.trippels.de> <20111108142146.GC1621@x4.trippels.de> <111108071341.ZM3017@torch.brasslantern.com> Date: Tue, 8 Nov 2011 16:55:21 +0100 Message-ID: Subject: Re: zsh spinning for ages when I hit tab on directory From: Mikael Magnusson To: zsh-users@zsh.org Content-Type: text/plain; charset=UTF-8 On 8 November 2011 16:13, Bart Schaefer wrote: > On Nov 8, 3:21pm, Markus Trippelsdorf wrote: > } Subject: Re: zsh spinning for ages when I hit tab on directory > } > } > > When position the cursor after the man1/ of > } > > ~ % /usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0/man/man1/ > } > > and hit tab, zsh starts spinning: > } > } zstyle ':completion:::::' completer _complete _approximate > } zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) )' > } zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' > } > } When I comment out the max-errors zstyle, zsh no longer hangs. > } > } So the next question is, how can I get the same behavior as before, but > } without the long hangs? > > You're computing max-errors based on the length of the entire path, but > the effect of correction is applied to each individual component, so > you're allowing 18 corrections per filename in man1/ with the above. > > Try changing to something like > > zstyle -e ':completion:*:approximate:*' \ > max-errors 'reply=( $(( ($#PREFIX:t+$#SUFFIX:h)/3 )) )' > > although that (and your original) allows no corrections unless there > are at least 6 characters already in the current word, so you might > want to use e.g. ($#PREFIX:t+2) or ($#PREFIX:t < 3 ? 3 : $#PREFIX:t). You might also want to set this style: zstyle ':completion:*' accept-exact-dirs 'yes' Then zsh will not attempt to change segments that already match a dir when a later doesn't exist. -- Mikael Magnusson