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

Re: The "-g" option in compctl doesn't insert correctly

On Dec 4, 10:35am, DervishD wrote:
}     $ compctl -g '/example/dir/*(.x:t)' example
}     Now, if I press <ENTER> the completion is accepted but the cursor
} doesn't move on to allow for more completions. If I remove the ":t"
} modifier, then all works ok.

The -g option tells compctl that what's being completed are file names,
which in the absence of any other options are expected to be relative
to either the current directory or to the path prefix on the command
line; but what you're generating are the tails of file paths, relative
to some fixed directory.

Compctl is going to try to find a file (or directory) matching the
name you generated, so that it can append either a space (for a file)
or a slash (for a directory); but it's not going to find anything that
matches (unless your current directory is /example/dir) because you've
lopped off the path.  So it appends nothing.

What you really want is

    compctl -W /example/dir -g '*(.x)' example

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