zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-users@zsh.org
Subject: Re: zsh spinning for ages when I hit tab on directory
Date: Tue, 8 Nov 2011 16:55:21 +0100	[thread overview]
Message-ID: <CAHYJk3TH18sf1uQEGZyAgRbhN+BcMZu8x0gNvMJfnD6aEjESFA@mail.gmail.com> (raw)
In-Reply-To: <111108071341.ZM3017@torch.brasslantern.com>

On 8 November 2011 16:13, Bart Schaefer <schaefer@brasslantern.com> 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


  reply	other threads:[~2011-11-08 16:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08 13:10 Markus Trippelsdorf
2011-11-08 13:58 ` Markus Trippelsdorf
2011-11-08 14:21   ` Markus Trippelsdorf
2011-11-08 15:13     ` Bart Schaefer
2011-11-08 15:55       ` Mikael Magnusson [this message]
     [not found]     ` <111108071341.ZM3017__46451.674323953$1320765436$gmane$org@torch.brasslantern.com>
2011-11-08 15:35       ` Markus Trippelsdorf
2011-11-08 15:54         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHYJk3TH18sf1uQEGZyAgRbhN+BcMZu8x0gNvMJfnD6aEjESFA@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).