zsh-users
 help / color / mirror / code / Atom feed
* cdmatch installs where?
@ 1998-08-29 19:59 Roland Jesse
  1998-08-29 21:08 ` Owen M. Astley
  0 siblings, 1 reply; 5+ messages in thread
From: Roland Jesse @ 1998-08-29 19:59 UTC (permalink / raw)
  To: ZSH Users mailing list

Hello,

I just upgraded zsh on my private machine from 3.05 to 3.1.4. Everything
seems to work just fine. But what is kind of annoying, is the fact that
the completion for the cd command does not work (it does not complete the
directory names when pressing TAB).

I do have:

compctl -g '*(-/)' cd pushd

in my $HOME/.zcompctl and as long as this is the only rule specifying the
cd completion, everything works just fine.

But right after that comes:

# Another possibility for cd/pushd is to use it in conjunction with the
# cdmatch function (in the Functions subdirectory of zsh distribution).
if [[ -o AUTO_REMOVE_SLASH ]] then
    compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
        -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -q -S '/' -- cd pushd
else
    compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
        -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
fi

Ok, I am not as much in the zsh details as might be necessary to totally
get the idea of what is being done here. But even to me it is obvious that
the cdmatch command (that does exist in the Functions subdir of the
distribution) needs to be installed.

My question is: Even when I copy cdmatch into $PREFIX/bin (what is in my
search path), the above rule does not complete directory names by pressing
the TAB key after a cd command.

As usual are any hints pointing in the right direction appreciated.

	Roland

P.S.: zsh compiles and runs just fine out of the box on FreeBSD (2.2.7). 
If the person who is responsible for the Etc/MACHINES file could include
that, that would be great. 

	Roland


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

* Re: cdmatch installs where?
  1998-08-29 19:59 cdmatch installs where? Roland Jesse
@ 1998-08-29 21:08 ` Owen M. Astley
  1998-08-29 21:49   ` Roland Jesse
  1998-08-29 22:36   ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Owen M. Astley @ 1998-08-29 21:08 UTC (permalink / raw)
  To: ZSH Users mailing list

> # Another possibility for cd/pushd is to use it in conjunction with the
> # cdmatch function (in the Functions subdirectory of zsh distribution).
[snip other compctl example]

> Ok, I am not as much in the zsh details as might be necessary to totally
> get the idea of what is being done here. But even to me it is obvious that
> the cdmatch command (that does exist in the Functions subdir of the
> distribution) needs to be installed.
> 
> My question is: Even when I copy cdmatch into $PREFIX/bin (what is in my
> search path), the above rule does not complete directory names by pressing
> the TAB key after a cd command.

cdmatch is a function, and so needs to be in the $fpath search path,
not the $path search list.

Try making a directory ~/.zfunc, putting cdmatch in it and setting
fpath=(~/.zfunc).

btw: fpath may be set to this by default, I can't remember.

Owen



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

* Re: cdmatch installs where?
  1998-08-29 21:08 ` Owen M. Astley
@ 1998-08-29 21:49   ` Roland Jesse
  1998-08-29 22:36   ` Bart Schaefer
  1 sibling, 0 replies; 5+ messages in thread
From: Roland Jesse @ 1998-08-29 21:49 UTC (permalink / raw)
  To: ZSH Users mailing list

Owen M. Astley wrote:

> cdmatch is a function, and so needs to be in the $fpath search path,
> not the $path search list.

Ok, are there any reasons for keeping $path and $fpath different? Or would
it be ok to set fpath=$path?

That would help me out quite a lot because...

> Try making a directory ~/.zfunc, putting cdmatch in it and setting
> fpath=(~/.zfunc).

... I would be able to do this in a global directory (like /usr/local/etc)
to make the functions available for other users, too.

> btw: fpath may be set to this by default, I can't remember.

% echo $fpath

%

No, I do not think so.

	Roland


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

* Re: cdmatch installs where?
  1998-08-29 21:08 ` Owen M. Astley
  1998-08-29 21:49   ` Roland Jesse
@ 1998-08-29 22:36   ` Bart Schaefer
  1998-08-30  8:11     ` Roland Jesse
  1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 1998-08-29 22:36 UTC (permalink / raw)
  To: Roland Jesse, ZSH Users mailing list

On Aug 29,  9:59pm, Roland Jesse wrote:
} Subject: cdmatch installs where?
}
} compctl -g '*(-/)' cd pushd
} 
} in my $HOME/.zcompctl and as long as this is the only rule specifying the
} cd completion, everything works just fine.

With 3.1.4, it's better to use -/ instead of -g '*(/)'.

	compctl -/ cd chdir dirs pushd

(see Misc/compctl-examples).

On Aug 29, 10:08pm, Owen M. Astley wrote:
} Subject: Re: cdmatch installs where?
}
} > # Another possibility for cd/pushd is to use it in conjunction with the
} > # cdmatch function (in the Functions subdirectory of zsh distribution).
} [snip other compctl example]
} 
} cdmatch is a function, and so needs to be in the $fpath search path,
} not the $path search list.

That's correct, but that's not all ... it also needs to be registered with
autoload.  The easiest way to do this is (after setting fpath):

    autoload $^fpath/*(N:t)

} btw: fpath may be set to this by default, I can't remember.

FPATH and fpath are unset, by default.

On Aug 29, 11:49pm, Roland Jesse wrote:
} Subject: Re: cdmatch installs where?
}
} Ok, are there any reasons for keeping $path and $fpath different? Or would
} it be ok to set fpath=$path?

The fpath is where zsh searches for things to autoload.  Binary executables
are obviously not suitable for autoloading, so you'll have to selectively
autoload (rather than using a glob trick like I did above) if there are any
non-zsh-function files in $fpath.  Further, it requires care to make an
autoloadable file that can also be executed as a shell script by non-zsh
shells.

} That would help me out quite a lot because...
} 
} ... I would be able to do this in a global directory (like /usr/local/etc)
} to make the functions available for other users, too.

Why would this require $fpath = $path ?  $fpath can point to "global"
directories just as easily as $path can (set fpath in /etc/zshenv, for
example).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: cdmatch installs where?
  1998-08-29 22:36   ` Bart Schaefer
@ 1998-08-30  8:11     ` Roland Jesse
  0 siblings, 0 replies; 5+ messages in thread
From: Roland Jesse @ 1998-08-30  8:11 UTC (permalink / raw)
  To: ZSH Users mailing list

Bart Schaefer wrote:

> With 3.1.4, it's better to use -/ instead of -g '*(/)'.

Well, that is a good idea. This is a nice new feature. I saw it for the
first time in the other discussion about completion going on in this list
in the last couple of days.

> Why would this require $fpath = $path ?

Umm, I do not know what I was thinking. It makes of course sense to keep
$path and $fpath different.

The functions are autoloaded now and my completions works like a charme.
Thanks for all your help.

	Roland


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

end of thread, other threads:[~1998-08-30  8:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-29 19:59 cdmatch installs where? Roland Jesse
1998-08-29 21:08 ` Owen M. Astley
1998-08-29 21:49   ` Roland Jesse
1998-08-29 22:36   ` Bart Schaefer
1998-08-30  8:11     ` Roland Jesse

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