zsh-workers
 help / color / mirror / code / Atom feed
* Options for Completion/Zsh/Command/_cd?
@ 2003-01-02 16:06 James Devenish
  2003-01-02 16:43 ` Oliver Kiddle
  0 siblings, 1 reply; 2+ messages in thread
From: James Devenish @ 2003-01-02 16:06 UTC (permalink / raw)
  To: zsh-workers

Hi,

I always use a 'custom' version of _cd because:

 - I don't want tab completion to consider $cdpath
   (in fact, I hate when that happens!)
 - I like CVS and .svn directories to be ignored.

I achieve this by scrubbing out portions of _cd and then adding an -F
option to _path_files. It would probably be better if I were to be able
to set some options in my .zshrc rather than rolling a new _cd with each
release. What is the canonical or preferred way of passing options to
completion functions? I can envisage being able to solve my $cdpath
problem by being able to do, say,
    setopt comp_cd_nocdpath
and do my directory exclusions by setting
    COMP_CD_PATH_OPTIONS=-F "(*CVS *.svn)"

I assume completion scripts can could pick up the environment variable,
but is there a way to convey the setopt to the function? If not, would
it be necessary to set some environment variable, ala
    COMP_CD_OPTIONS=nocdpath

Are they any examples that anyone knows of?

I'm willing to bother doing the necessary patches, but my prowess with
zsh completion functions is at the novice end of the scale. (Having
said that, though, I have a completion function for Subversion version
control: _svn, which I should share sometime.)



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

* Re: Options for Completion/Zsh/Command/_cd?
  2003-01-02 16:06 Options for Completion/Zsh/Command/_cd? James Devenish
@ 2003-01-02 16:43 ` Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2003-01-02 16:43 UTC (permalink / raw)
  To: James Devenish; +Cc: zsh-workers

On 3 Jan, you wrote:

> I always use a 'custom' version of _cd because:
> 
>  - I don't want tab completion to consider $cdpath
>    (in fact, I hate when that happens!)

  zstyle ':completion:*:*:cd:*' tag-order local-directories

will do this for you. Or you could use:

  zstyle ':completion:*:*:cd:*' tag-order local-directories path-directories

to only complete directories from $cdpath when no local directories match.

In any context where more than one type of thing is completed, you can
press ^Xh and it will list the tags used for completion in that context
and you can specify the order for them to be completed.

>  - I like CVS and .svn directories to be ignored.

  zstyle ':completion:*:*:cd:*' ignored-patterns '(|*/)(.svn|CVS)'

> I achieve this by scrubbing out portions of _cd and then adding an -F
> option to _path_files. It would probably be better if I were to be able

If I remember correctly, the ignored-patterns style is implemented by
adding -F.

> to set some options in my .zshrc rather than rolling a new _cd with each
> release. What is the canonical or preferred way of passing options to
> completion functions? I can envisage being able to solve my $cdpath

Not sure. The preferred way is that we don't ever and a zstyle is made
to do the job.

> I'm willing to bother doing the necessary patches, but my prowess with
> zsh completion functions is at the novice end of the scale. (Having
> said that, though, I have a completion function for Subversion version
> control: _svn, which I should share sometime.)

Please do share it.

Oliver

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


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

end of thread, other threads:[~2003-01-02 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-02 16:06 Options for Completion/Zsh/Command/_cd? James Devenish
2003-01-02 16:43 ` Oliver Kiddle

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