zsh-users
 help / color / mirror / code / Atom feed
* make zstyle ignore both _* and __* commands
@ 2017-06-30 21:39 Filipe Silva
  2017-07-02 17:20 ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Filipe Silva @ 2017-06-30 21:39 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

Hi,

I have this line in my config, that tells zsh to ignore `_*` commands on
completions:

zstyle ':completion:*:functions' ignored-patterns '_*'

It works well. But I'd like to tell zsh to also ignore `__*' commands

(double undescores)

Is there a way to do that?

thanks in advance.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: make zstyle ignore both _* and __* commands
  2017-06-30 21:39 make zstyle ignore both _* and __* commands Filipe Silva
@ 2017-07-02 17:20 ` Peter Stephenson
  2017-07-02 21:37   ` Filipe Silva
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2017-07-02 17:20 UTC (permalink / raw)
  To: Zsh Users

On Fri, 30 Jun 2017 18:39:18 -0300
Filipe Silva <filipe.silva@gmail.com> wrote:
> I have this line in my config, that tells zsh to ignore `_*` commands on
> completions:
> 
> zstyle ':completion:*:functions' ignored-patterns '_*'
> 
> It works well. But I'd like to tell zsh to also ignore `__*' commands
> 
> (double undescores)
> 
> Is there a way to do that?

It should already do that, for reasons I think ought to be
self-explanatory (famous last words, I know).  Have you found some case
where it doesn't?

pws


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: make zstyle ignore both _* and __* commands
  2017-07-02 17:20 ` Peter Stephenson
@ 2017-07-02 21:37   ` Filipe Silva
  2017-07-03 11:47     ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Filipe Silva @ 2017-07-02 21:37 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]

omg, you are absolutely right. It should do already this because of the
regex.
I'm so ashamed of myself.

All right, I did found a case where this does not work.

if I type d_[tab] it shows this: http://imgur.com/ZSBZHvp (notice the
__fast_highlight...)

here's my full zsh config:
https://github.com/ninrod/dotfiles/tree/master/zsh
here's the completion relevant part:
https://github.com/ninrod/dotfiles/blob/master/zsh/completions.zsh

again, here it is for completeness

autoload -Uz compinit && compinit -u

zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' matcher-list '' \
  'm:{a-z\-}={A-Z\_}' \
  'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \
  'r:[[:ascii:]]||[[:ascii:]]=** r:|=* m:{a-z\-}={A-Z\_}'

zstyle ':completion:*:functions' ignored-patterns '_*'

cheers,

Filipe

On Sun, Jul 2, 2017 at 2:20 PM, Peter Stephenson <
p.w.stephenson@ntlworld.com> wrote:

> On Fri, 30 Jun 2017 18:39:18 -0300
> Filipe Silva <filipe.silva@gmail.com> wrote:
> > I have this line in my config, that tells zsh to ignore `_*` commands on
> > completions:
> >
> > zstyle ':completion:*:functions' ignored-patterns '_*'
> >
> > It works well. But I'd like to tell zsh to also ignore `__*' commands
> >
> > (double undescores)
> >
> > Is there a way to do that?
>
> It should already do that, for reasons I think ought to be
> self-explanatory (famous last words, I know).  Have you found some case
> where it doesn't?
>
> pws
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: make zstyle ignore both _* and __* commands
  2017-07-02 21:37   ` Filipe Silva
@ 2017-07-03 11:47     ` Peter Stephenson
  2017-07-04 11:22       ` Filipe Silva
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2017-07-03 11:47 UTC (permalink / raw)
  To: Filipe Silva, Zsh Users

On Sun, 2 Jul 2017 18:37:14 -0300
Filipe Silva <filipe.silva@gmail.com> wrote:
> omg, you are absolutely right. It should do already this because of the
> regex.
> I'm so ashamed of myself.
> 
> All right, I did found a case where this does not work.
> 
> if I type d_[tab] it shows this: http://imgur.com/ZSBZHvp (notice the
> __fast_highlight...)

__fast_highlight doesn't occur in the zsh source tree, so that's in some
library you've got.  I would guess it's not being matched as a function
at all, otherwise it's no different from the other cases.  Maybe it's a
variable; you can complete those in command position for assignment
purposes.

You'll probably find it helps to have headers for different types of
match turned on for this sort of purpose --- try:

zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''

pws


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: make zstyle ignore both _* and __* commands
  2017-07-03 11:47     ` Peter Stephenson
@ 2017-07-04 11:22       ` Filipe Silva
  2017-07-04 11:39         ` Daniel Shahaf
  0 siblings, 1 reply; 7+ messages in thread
From: Filipe Silva @ 2017-07-04 11:22 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1150 bytes --]

Hi Peter, this is great, did not know about that.

Is there a way to insert a newline after the headers? I tried \n and \\n
but it did not render the expected result.

On Mon, Jul 3, 2017 at 8:47 AM, Peter Stephenson <p.stephenson@samsung.com>
wrote:

> On Sun, 2 Jul 2017 18:37:14 -0300
> Filipe Silva <filipe.silva@gmail.com> wrote:
> > omg, you are absolutely right. It should do already this because of the
> > regex.
> > I'm so ashamed of myself.
> >
> > All right, I did found a case where this does not work.
> >
> > if I type d_[tab] it shows this: http://imgur.com/ZSBZHvp (notice the
> > __fast_highlight...)
>
> __fast_highlight doesn't occur in the zsh source tree, so that's in some
> library you've got.  I would guess it's not being matched as a function
> at all, otherwise it's no different from the other cases.  Maybe it's a
> variable; you can complete those in command position for assignment
> purposes.
>
> You'll probably find it helps to have headers for different types of
> match turned on for this sort of purpose --- try:
>
> zstyle ':completion:*' format 'Completing %d'
> zstyle ':completion:*' group-name ''
>
> pws
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: make zstyle ignore both _* and __* commands
  2017-07-04 11:22       ` Filipe Silva
@ 2017-07-04 11:39         ` Daniel Shahaf
  2017-07-04 14:05           ` Filipe Silva
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Shahaf @ 2017-07-04 11:39 UTC (permalink / raw)
  To: Filipe Silva; +Cc: Zsh Users, Peter Stephenson

Filipe Silva wrote on Tue, 04 Jul 2017 08:22 -0300:
> Is there a way to insert a newline after the headers? I tried \n and \\n
> but it did not render the expected result.

zstyle ':completion:*' format $'Completing %d\n'

You can use prompt coloring sequences there too, e.g., %B...%b for bold.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: make zstyle ignore both _* and __* commands
  2017-07-04 11:39         ` Daniel Shahaf
@ 2017-07-04 14:05           ` Filipe Silva
  0 siblings, 0 replies; 7+ messages in thread
From: Filipe Silva @ 2017-07-04 14:05 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Zsh Users, Peter Stephenson

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

​omg this is absolutely wonderful.

here's the updated screenshot with Daniel's hack:
http://i.imgur.com/YV0s4QR.png​

On Tue, Jul 4, 2017 at 8:39 AM, Daniel Shahaf <d.s@daniel.shahaf.name>
wrote:

> zstyle ':completion:*' format $'Completing %d\n'

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-07-04 14:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 21:39 make zstyle ignore both _* and __* commands Filipe Silva
2017-07-02 17:20 ` Peter Stephenson
2017-07-02 21:37   ` Filipe Silva
2017-07-03 11:47     ` Peter Stephenson
2017-07-04 11:22       ` Filipe Silva
2017-07-04 11:39         ` Daniel Shahaf
2017-07-04 14:05           ` Filipe Silva

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).