Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh spinning for ages when I hit tab on directory
- X-seq: zsh-users 16558
- From: Markus Trippelsdorf <markus@xxxxxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: zsh spinning for ages when I hit tab on directory
- Date: Tue, 8 Nov 2011 16:35:07 +0100
- Cc: zsh-users@xxxxxxx
- 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=
- In-reply-to: <111108071341.ZM3017__46451.674323953$1320765436$gmane$org@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- 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>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author