[Bash-completion-devel] how to kill trailing space from alias completion ?
Lachlan Deck
lachlan.deck at gmail.com
Tue Sep 3 07:18:24 UTC 2013
On 03/09/2013, at 4:46 PM, Ville Skyttä <ville.skytta at iki.fi> wrote:
> On Mon, Sep 2, 2013 at 11:30 PM, Lachlan Deck <lachlan.deck at gmail.com> wrote:
>> Hi there,
>>
>> I'm finding that when tab completing aliases that bash-completion keeps adding a trailing space -- which for directory aliases or exports is annoying.
>>
>> e.g.,
>> export CATALINA_HOME=/path/to/tomcat
>
> Hm, you mentioned aliases but I don't see anything alias related there
> -- do you mean completing environment variables, like "ls
> $CATALINA_HOME<TAB>" after the above?
$ cd $CAT<TAB> ends up as
$ cd $CATALINA_HOME <cursor_here>
Not sure why you'd do it, I suppose, but I believe the same behaviour happens for aliases:
alias thing="/path/to/dir"
>> Has anyone got a fix for that?
>
> I'm afraid it'd be a nontrivial change because variable completion
> occurs so early in our _init_completion function that there's no
> context there whether the variable is expected to be a file/dir one
> (in which case not appending the trailing space but perhaps a slash
> might be useful
indeed it would.
> but this would need more thought) or not (in which
> case not appending the space wouldn't be a good thing).
wouldn't you be able to tell by looking at the first char to two?
i.e., if it begins with either "/" or "~/" then it's a file?
More information about the Bash-completion-devel
mailing list