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

Re: Using custom completion...



On Tue, Mar 28, 2006 at 11:47:27PM +0000, Christopher Browne wrote:
> Dominic Mitchell had set up a sample completion for psql:
> http://www.zsh.org/mla/users/2004/msg01006.html
> [it's pretty obvious which bits are script, and which aren't]
> 
> I'm not entirely sure what I need to do to get it operating.
> 
> It appears as though an appropriate place to stow it on my system is thus:
> /usr/share/zsh/4.3.2/functions/Completion/Unix/_psql

I install it on a per-user basis:

  % ls ~/libexec/zsh/_pgsql_utils
  /home/dom/libexec/zsh/_pgsql_utils

Then I've got this in my ~/.zshrc:

  fpath=( ~/libexec/zsh $fpath );

Note that it has to come before you call compinit.

> I'm not sure if I need to run anything extra to get it to be noticed;
> it doesn't seem to be turning quite right, as I'm seeing ill output:
> _arguments:comparguments:208: invalid argument:
> cbbrowne@dba2:~>
> 
> I'd be more than happy to help contribute whatever assistance to
> getting bits of it working that I can; I'm in a pretty "psql-happy"
> environment, so improving globbing on this is no bad thing ;-).

It does work well for me here, under Debian and FreeBSD.  But if it's
not working correctly, I'll gladly do what I can to make it work for
you.

A quick way to check whether or not it's working is to press ^Xh after
typing in "psql ".  You should get output like this:

    % psql
    tags in context :completion::complete:psql::
        argument-1 options  (_arguments _psql _pgsql_utils)

-Dom



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