Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: cdmatch installs where?



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



Messages sorted by: Reverse Date, Date, Thread, Author