[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

completion enhancement request

From: Ian Macdonald
Subject: completion enhancement request
Date: Mon, 1 Apr 2002 09:32:40 -0800
User-agent: Mutt/1.3.28i


I would like to see a way to instruct bash that the contents of
COMPREPLY() should be regarded as partial completions and that it
should not append a space and move to the next token.


I have a cd completion function that is $CDPATH aware. This means that
it completes the current command line token against directories
relative to those listed in $CDPATH.

So, if $CDPATH=/usr:/usr/src and I do 'cd foob<Tab>' in my ~
directory, 'foobar' should be returned if either /usr/foobar or
/usr/src/foobar exists.

This works, but bash sees foobar as a distinct completion and so
appends a space. If I then want to continue to complete relative to
/usr/foobar, I must backspace, add a slash and hit <Tab> again.

'compgen -o filenames' only works if the returned completions are
recognised by bash to be file or directory names. Presumably it checks
for their existence and then appends a slash where required.

It would be nice, however, when a function is capable of returning any
number of data types depending on the parameter being completed, if it
were possible to instruct bash to not append a space and move to the
next token.

Another example is when performing remote path completion for scp. It
would be nice to be able to 'scp file host:/usr/foo<Tab>' and have
bash complete on files on the remote side. Again, I have this working,
with the problem that bash always wants to regard the path as complete
and move to the next token.

A third example might be Java class completion, where the separator is
a dot, not a slash. Here again, bash should not advance after
completing up to the current dot.

I'm not sure what the best mechanism for this might be within the
current confines of the completion implementation. Perhaps the setting
of a built-in variable, that one could set local to each function?

Is there a list of enhancements (particularly those that relate to
programmable completion) that are planned for 2.06?

Ian Macdonald               | By trying we can easily learn to endure
address@hidden             | adversity.  Another man's, I mean.   --
                            | Mark Twain 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]