zsh-users
 help / color / mirror / code / Atom feed
* Ignore patterns for alias
@ 2017-01-24  8:23 ` Sebastian Blask
  2017-01-24  9:53   ` Peter Stephenson
       [not found]   ` <CAFOazAM3L6foz81aDxHmd7AqZeJ1baXen_sMH-BH+Nokgg9e0Q@mail.gmail.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Sebastian Blask @ 2017-01-24  8:23 UTC (permalink / raw)
  To: zsh-users

Hi,

I was trying to ignore some files during completion like this:

zstyle ':completion:*:*:vim:*:*files' ignored-patterns '*.pyc'

and could not get it to work. After a while i figured out that it's 
because I use scm-breeze which aliases vim so it accepts indexes:

$ which vim
vim: aliased to exec_scmb_expand_args /usr/bin/vim

I tried

zstyle ':completion:*:*:exec_scmb_expand_args:*:*files' ignored-patterns 
'*.pyc'

which ignores the files, but as there are others aliases for rm, mv, ... 
it is not specific enough. Something like:

zstyle ':completion:*:*:exec_scmb_expand_args:/usr/bin/vim:*files' 
ignored-patterns '*.pyc'

does not work at all.

Is this the expected behaviour? I expected completions to work on what 
is actually written on the command line and not on what it is aliased 
to. Is there a way to get it to work? Ideally so that this:

zstyle ':completion:*:*:vim:*:*files' ignored-patterns '*.pyc'

works out of the box?

Thanks!


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

* Re: Ignore patterns for alias
  2017-01-24  8:23 ` Ignore patterns for alias Sebastian Blask
@ 2017-01-24  9:53   ` Peter Stephenson
       [not found]   ` <CAFOazAM3L6foz81aDxHmd7AqZeJ1baXen_sMH-BH+Nokgg9e0Q@mail.gmail.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2017-01-24  9:53 UTC (permalink / raw)
  To: zsh-users

On Tue, 24 Jan 2017 09:23:29 +0100
Sebastian Blask <blask@gmx.de> wrote:
> $ which vim
> vim: aliased to exec_scmb_expand_args /usr/bin/vim

You can get this to work with

compdef _precommand exec_smb_expand_args

which tells it that that's a precommand modifier and it should look
further along for the command to complete.  Then any alias using
that command will spring into life.

Unless you have a lot of these, that's probably less work than
telling it to use aliases as a basis for completion and then ensuring
you have a completion for all your aliases,  However, the option
COMPLETE_ALIASES is also available.

pws


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

* Re: Ignore patterns for alias
       [not found]   ` <CAFOazAM3L6foz81aDxHmd7AqZeJ1baXen_sMH-BH+Nokgg9e0Q@mail.gmail.com>
@ 2017-01-31  2:02     ` Sebastian Blask
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Blask @ 2017-01-31  2:02 UTC (permalink / raw)
  To: Jérémie Roquet; +Cc: Zsh Users

Hi Jérémie,

works perfectly, thank you!

/Sebastian

On 24/01/17 10:32, Jérémie Roquet wrote:
> Hi Sebastian,
>
> 2017-01-24 9:23 GMT+01:00 Sebastian Blask <blask@gmx.de>:
>> I expected completions to work on what is
>> actually written on the command line and not on what it is aliased to. Is
>> there a way to get it to work? Ideally so that this:
>>
>> zstyle ':completion:*:*:vim:*:*files' ignored-patterns '*.pyc'
>>
>> works out of the box?
>
> Not exactly what you are looking for, but using functions instead of
> aliases solves a bunch of various issues in zsh (not only related to
> completion).
>
> So, if instead of “alias vim="exec_scmb_expand_args /usr/bin/vim"” you
> had something like “vim() { exec_scmb_expand_args /usr/bin/vim $@ }”,
> things might behave the way you want.
>
> Best regards,
>


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

end of thread, other threads:[~2017-01-31  2:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170124082451epcas3p217bdb55a1d8a6de091e29eff5f980eea@epcas3p2.samsung.com>
2017-01-24  8:23 ` Ignore patterns for alias Sebastian Blask
2017-01-24  9:53   ` Peter Stephenson
     [not found]   ` <CAFOazAM3L6foz81aDxHmd7AqZeJ1baXen_sMH-BH+Nokgg9e0Q@mail.gmail.com>
2017-01-31  2:02     ` Sebastian Blask

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