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

Re: Completion suggestions



Oliver Kiddle wrote:

> Anyway, this has reminded me of another completion feature which I'd
> like. When typing a filename as a parameter where the filename I want to
> use contains a special character (such as a space), I obviously have to
> use quoting of some sort. What would be nice is if the completion was
> aware of quotes and assumed that I wasn't going to quote unnecessarily.
> 
> For example:
> ~ [56]% :> "a file"
> ~ [57]% :> afile
> Currently:
> ~ [58]% vi "a<tab>
> Lists:
> a file   afile
> 
> I'd find it useful if it completed to the file with the space in it: I
> wouldn't have bothered to type the '"' if I wanted to edit afile. This
> will ofcourse need to be aware of \ quoting and the closing quote. I
> wouldn't be suprised if some people wouldn't like this so if
> implemented, it might need to be an option.

As an option, maybe. But if you have something like zsh -c "ls f<TAB>", 
you'll want all files.

> Another thing which would be quite useful is some way to specify if
> files listed as parameters to a command should be unique. Taking the rm
> example above, it would be pointless to type:
> 
> rm glib-1.1.so.12 glib-1.1.so.12
> 
> so rm glib{-1.1.so.12,<tab>
> should not offer -1.1.so.12 but complete to anything else such as
> -1.1.so.12.0.0

This is something I'd like to have, too. One thing I'm planning to do
is give a way to access/change/delete matches from those that were
generated in the new style completion stuff, with that it might become 
easier to do such things. You can already get this with a shell
function and the `-K' option, though, but only if used without brace
expansion (since the completion code currently doesn't see the other
strings in the braces).

> I've also just discovered the following possible bug which might have
> been fixed since the version I've got here (3.1.5; maybe pws-3):
> 
> ~ [67]% rm a{\ <tab>
> Gives me:
> ~ [67]% rm a\ file,

This is fixed since pws-<dunno>, at least 6 and 7.

> Has any thought been given to implementing tcsh's complete=enhance
> functionality. I found the `.', `-' and `_' handling occaisionally
> useful and sometimes annoying. I liked the case-insensitivity aspect
> however the ideal in my opinion would be for anything which I
> explicitly type in uppercase to remain in uppercase but anything typed
> in lowercase to be treated as completable to uppercase. If this tcsh
> functionality does get implemented there should be separate options for
> the two (very distinct in my opinion) features.

This is what the matching control is for. In any recent enough zsh you 
can do:

  compctl -M 'm:{a-z}={A-Z}'

to get the one-way-case-insesitiveness you described. The partial word 
completion can be allowed with:

  compctl -M 'r:|[._-]=* r:|=*'

See the compctl manual pages for further enlightenment.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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