* zsh spinning for ages when I hit tab on directory
@ 2011-11-08 13:10 Markus Trippelsdorf
2011-11-08 13:58 ` Markus Trippelsdorf
0 siblings, 1 reply; 7+ messages in thread
From: Markus Trippelsdorf @ 2011-11-08 13:10 UTC (permalink / raw)
To: zsh-users
Zsh is busy spinning for minutes when I hit tab at the end of an
directory. For example consider:
~ % /usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0/man/man1/
man1 % l
total 1748
drwxr-xr-x 2 root 72 Nov 8 13:37 .
drwxr-xr-x 4 root 28 May 27 15:33 ..
-rw-r--r-- 1 root 42888 Nov 8 13:37 cpp.1
-rw-r--r-- 1 root 824844 Nov 8 13:37 g++.1
-rw-r--r-- 1 root 824844 Nov 8 13:37 gcc.1
-rw-r--r-- 1 root 24554 Nov 8 13:37 gcov.1
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:
96.79% libzsh-4.3.12.so [.] 0x7185f
0.12% [kernel] [k] handle_irq_event_percpu
0.07% libFLAC.so.8.2.0 [.] FLAC__bitreader_read_rice_signed_block
...
And after a few minutes it prints:
---- no match for: `external command', `executable file or directory',
`builtin command', `shell function', `alias', `suffix alias', `reserved
word', `job', `parameter', or `corrections'
Any ideas how to fix this behavior?
Thanks.
--
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: zsh spinning for ages when I hit tab on directory
2011-11-08 13:10 zsh spinning for ages when I hit tab on directory Markus Trippelsdorf
@ 2011-11-08 13:58 ` Markus Trippelsdorf
2011-11-08 14:21 ` Markus Trippelsdorf
0 siblings, 1 reply; 7+ messages in thread
From: Markus Trippelsdorf @ 2011-11-08 13:58 UTC (permalink / raw)
To: zsh-users
On 2011.11.08 at 14:10 +0100, Markus Trippelsdorf wrote:
> Zsh is busy spinning for minutes when I hit tab at the end of an
> directory. For example consider:
> ~ % /usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0/man/man1/
> man1 % l
> total 1748
> drwxr-xr-x 2 root 72 Nov 8 13:37 .
> drwxr-xr-x 4 root 28 May 27 15:33 ..
> -rw-r--r-- 1 root 42888 Nov 8 13:37 cpp.1
> -rw-r--r-- 1 root 824844 Nov 8 13:37 g++.1
> -rw-r--r-- 1 root 824844 Nov 8 13:37 gcc.1
> -rw-r--r-- 1 root 24554 Nov 8 13:37 gcov.1
>
> 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:
>
> 96.79% libzsh-4.3.12.so [.] 0x7185f
> 0.12% [kernel] [k] handle_irq_event_percpu
> 0.07% libFLAC.so.8.2.0 [.] FLAC__bitreader_read_rice_signed_block
When I zoom into zsh with "perf top" I see:
69.44% zsh [.] patmatch
14.15% zsh [.] charrefinc
9.44% zsh [.] charnext
6.66% zsh [.] charref
...
--
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: zsh spinning for ages when I hit tab on directory
2011-11-08 13:58 ` Markus Trippelsdorf
@ 2011-11-08 14:21 ` Markus Trippelsdorf
2011-11-08 15:13 ` Bart Schaefer
[not found] ` <111108071341.ZM3017__46451.674323953$1320765436$gmane$org@torch.brasslantern.com>
0 siblings, 2 replies; 7+ messages in thread
From: Markus Trippelsdorf @ 2011-11-08 14:21 UTC (permalink / raw)
To: zsh-users
On 2011.11.08 at 14:58 +0100, Markus Trippelsdorf wrote:
> On 2011.11.08 at 14:10 +0100, Markus Trippelsdorf wrote:
> > Zsh is busy spinning for minutes when I hit tab at the end of an
> > directory. For example consider:
> > ~ % /usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.0/man/man1/
> > man1 % l
> > total 1748
> > drwxr-xr-x 2 root 72 Nov 8 13:37 .
> > drwxr-xr-x 4 root 28 May 27 15:33 ..
> > -rw-r--r-- 1 root 42888 Nov 8 13:37 cpp.1
> > -rw-r--r-- 1 root 824844 Nov 8 13:37 g++.1
> > -rw-r--r-- 1 root 824844 Nov 8 13:37 gcc.1
> > -rw-r--r-- 1 root 24554 Nov 8 13:37 gcov.1
> >
> > 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:
> >
> > 96.79% libzsh-4.3.12.so [.] 0x7185f
> > 0.12% [kernel] [k] handle_irq_event_percpu
> > 0.07% libFLAC.so.8.2.0 [.] FLAC__bitreader_read_rice_signed_block
>
> When I zoom into zsh with "perf top" I see:
> 69.44% zsh [.] patmatch
> 14.15% zsh [.] charrefinc
> 9.44% zsh [.] charnext
> 6.66% zsh [.] charref
Ah, it's the following lines in my .zshrc that are responsible:
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?
--
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: zsh spinning for ages when I hit tab on directory
2011-11-08 14:21 ` Markus Trippelsdorf
@ 2011-11-08 15:13 ` Bart Schaefer
2011-11-08 15:55 ` Mikael Magnusson
[not found] ` <111108071341.ZM3017__46451.674323953$1320765436$gmane$org@torch.brasslantern.com>
1 sibling, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2011-11-08 15:13 UTC (permalink / raw)
To: zsh-users
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).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: zsh spinning for ages when I hit tab on directory
[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
0 siblings, 1 reply; 7+ messages in thread
From: Markus Trippelsdorf @ 2011-11-08 15:35 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-users
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: zsh spinning for ages when I hit tab on directory
2011-11-08 15:35 ` Markus Trippelsdorf
@ 2011-11-08 15:54 ` Bart Schaefer
0 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2011-11-08 15:54 UTC (permalink / raw)
To: zsh-users
On Nov 8, 4:35pm, Markus Trippelsdorf wrote:
} Subject: Re: zsh spinning for ages when I hit tab on directory
}
} > } zstyle ':completion:::::' completer _complete _approximate
} > } zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) )'
} >
} > zstyle -e ':completion:*:approximate:*' \
} > max-errors 'reply=( $(( ($#PREFIX:t+$#SUFFIX:h)/3 )) )'
}
} Thanks Bart. This fixes the problem.
} BTW I copied the lines from the "From bash to Z Shell" book.
Ah, yes, well, examples in books tend to illustrate isolated concepts.
It's a perfectly good example of how "zstyle -e" works, which in spite
of it being introduced in the section on _approximate is really what
the authors were getting at.
Also it works perfectly well as long as you don't type a really long
path to a directory filled with a lot of files. :-)
[This problem didn't occur to me as a technical reviewer of the book,
either, so ... accept our collective apologies?]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: zsh spinning for ages when I hit tab on directory
2011-11-08 15:13 ` Bart Schaefer
@ 2011-11-08 15:55 ` Mikael Magnusson
0 siblings, 0 replies; 7+ messages in thread
From: Mikael Magnusson @ 2011-11-08 15:55 UTC (permalink / raw)
To: zsh-users
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-11-08 16:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-08 13:10 zsh spinning for ages when I hit tab on directory 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
[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
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).