help-bash
[Top][All Lists]
Advanced

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

Re: A question about COMP_WORDBREAKS and how to remove @ from it


From: Chet Ramey
Subject: Re: A question about COMP_WORDBREAKS and how to remove @ from it
Date: Wed, 16 Sep 2020 15:42:32 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

On 9/16/20 3:18 PM, Baldurien wrote:
> Le mar. 15 sept. 2020 à 15:12, Chet Ramey <chet.ramey@case.edu> a écrit :
>>
>> Can you remove it using an assignment statement at the shell prompt? It
>> may be that some other part of initialization, e.g., the bash-completion
>> setup or other readline initialization, restores the default value.
>>
>> --
>> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>>                  ``Ars longa, vita brevis'' - Hippocrates
>> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
> 
> Yes, if I do COMP_WORDBREAKS="${COMP_WORDBREAKS//@/}" (with
> bash_completion commented out), the @ is removed and better my
> completion works.
> 
> However, that's clearly not practical.

No, not in general, but it suggests a strategy.

I suspect that you have hostname completion enabled in your environment
(shopt -s hostcomplete). It's on by default. If it's enabled at the time
bash initializes its readline interface, bash will ensure that `@' is one
of the completion word break characters, because that's how hostname
completion works.

If it's the simplest case, you should be able to disable hostname
completion (shopt -u hostcomplete) at the same time you modify
COMP_WORDBREAKS and have it work the way you want.

If that doesn't do it, just echo $COMP_WORDBREAKS at various points in
the shell startup process (startup files, from a $PROMPT_COMMAND, at
the command prompt, etc.), with bash-completion enabled, and see what
that tells you. If you have to, turn on `set -x' at various points so
you can see exactly what's being executed.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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