From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19319 invoked by alias); 8 Nov 2011 15:35:15 -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: 16558 Received: (qmail 15744 invoked from network); 8 Nov 2011 15:35:12 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at trippelsdorf.de does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=mail.ud10.udmedia.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=beta; bh=rvqUoR5Cs8aJlMToZs7MNIEqof 8h6HNKZJznDa2gx7E=; b=Wbaiw/X9iGVodtW8xvZrQYSyMHfOqyJkGedD8dbTDR hr94neuFvYBI4dpfkUtSFmQdfeUp+794pZ6JJyErTPoAY3gKbwJkQdDYxJwDv4ur iNdm+ZSHViEi2E5sM4q5f2Qg3zvC38IrG7RlapaDJZgJ8taj8yOYqzV9MB96BbDc Q= Date: Tue, 8 Nov 2011 16:35:07 +0100 From: Markus Trippelsdorf To: Bart Schaefer Cc: zsh-users@zsh.org Subject: Re: zsh spinning for ages when I hit tab on directory Message-ID: <20111108153507.GD1621@x4.trippels.de> References: <20111108131022.GA1621@x4.trippels.de> <20111108135809.GB1621@x4.trippels.de> <20111108142146.GC1621@x4.trippels.de> <111108071341.ZM3017__46451.674323953$1320765436$gmane$org@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <111108071341.ZM3017__46451.674323953$1320765436$gmane$org@torch.brasslantern.com> On 2011.11.08 at 07:13 -0800, 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). Thanks Bart. This fixes the problem. BTW I copied the lines from the "From bash to Z Shell" book. -- Markus