[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: |
Baldurien |
Subject: |
Re: A question about COMP_WORDBREAKS and how to remove @ from it |
Date: |
Thu, 17 Sep 2020 01:09:14 +0200 |
Le mer. 16 sept. 2020 à 21:42, Chet Ramey <chet.ramey@case.edu> a écrit :
>
> 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/
Hello,
This worked, thanks a lot !
And I know also understand why bash_completion did not have the @
since they disable hostcompletion to add their own:
https://github.com/scop/bash-completion/blob/master/bash_completion#L1529
Regards,
Baldurien