[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A question about COMP_WORDBREAKS and how to remove @ from it
From: |
Baldurien |
Subject: |
A question about COMP_WORDBREAKS and how to remove @ from it |
Date: |
Tue, 15 Sep 2020 00:45:53 +0200 |
Hello,
I am under Windows with:
- either Git for Windows 2.28.0.windows.1 and bash 4.4.23(1)-release,
- either MSYS2 20200903 and bash 4.4.23(2)-release + bash_completion
And I fail to understand how COMP_WORDBREAKS works, or at least, how I
can ensure the @ is removed from it in Git for Windows.
In Git for Windows, it contains a @, so I try to remove it in ~/.bashrc:
echo "COMP_WORDBREAKS before:"; declare -p COMP_WORDBREAKS
COMP_WORDBREAKS="==:${COMP_WORDBREAKS//@/}=="
echo "COMP_WORDBREAKS after:"; declare -p COMP_WORDBREAKS
export COMP_WORDBREAKS
However, while the echoes shows me that I removed @ from
COMP_WORDBREAKS, once I have access to the login shell (eg: when I can
type something), if I do echo $COMP_WORDBREAKS, then the @ is back and
before other characters:
$ echo $COMP_WORDBREAKS
@ "'><=;|&(:
Since Git for Windows shares part of MSYS2 components, I tried with
MSYS2 which comes with bash_completion de facto.
And surprisingly, the COMP_WORDBREAKS does not contains the @: if I
change my script to add it :
echo "COMP_WORDBREAKS before:"; declare -p COMP_WORDBREAKS
COMP_WORDBREAKS="==:@${COMP_WORDBREAKS//@/}=="
#-------------------^ HERE
echo "COMP_WORDBREAKS after:"; declare -p COMP_WORDBREAKS
export COMP_WORDBREAKS
Now the prompt ... does not contain any @.
If I directly edit C:\msys64\etc\profile.d\bash_completion.sh to
comment out the ". /usr/share/bash-completion/bash_completion" line,
then the @ is kept.
I am under the assumption that Bash or bash_completion do have some
hack to add/remove the @ depending on "something", perhaps some option
?.
What could be that something and how can I remove the @ from COMP_WORDBREAKS ?
Is there a configuration file I missed ? (I've looked in the readline
.inputrc configuration without any finding)
---
Note: I know that changing COMP_WORDBREAKS may have adverse effect on
a whole, but:
- the COMP_WORDBREAKS on @ blocks my completion and is not present
when bash_completion is present
- Git for Windows does not comes with much completion to break
- _get_comp_words_by_ref does not behave the same on Git for Windows
because it use Git internal one, whereas the one found in
bash_completion is used on most Linux:
Git "internal one":
https://github.com/git/git/blob/master/contrib/completion/git-completion.bash#L261
bash_completion version:
https://github.com/scop/bash-completion/blob/133790c464c68fa728b2957a66ee1fa012181a88/bash_completion#L369
The exact problem is a little hard to explain and unrelated to Bash,
but when regenerating the prev/words using `_get_comp_words_by_ref -n
"@=" cur prev words cword` in a completion, the result will be
different (example: for "a b @A[TAB]")
- Git for Windows => words [a, b, @, A] prev: @
- bash_completion (or Git for Windows with COMP_WORDBREAKS not
containing a @) => words [a, b, @A] prev: [b]
Regards,
Baldurien
- A question about COMP_WORDBREAKS and how to remove @ from it,
Baldurien <=