I am working on completion for a command that takes an argument of type one: two: three.
In simple terms, I want ":" to be treated as the default space character. Is there an easy way to do this that I am missing?
I found that ':' is in COMP_WORDBREAKS, but that the character in COMP_WORDBREAKS is also treated as words.
So, if on the command line:
cmd one:tw[TAB]
COMP_CWORD will be 3, and COMP_WORDS [COMP_CWORD-1] will be ::
For comparison, if on the command line:
cmd one tw[TAB]
COMP_CWORD will be 2, and COMP_WORDS [COMP_CWORD-1] will be "one"
The worst part is that if you press [TAB] immediately after the separator ':', it acts basically like a space:
cmd one:[TAB]
Now COMP_CWORD will be 2, and COMP_WORDS [COMP_CWORD-1] will be "one."
I can easily enough analyze the command line from COMP_LINE, but itβs better to find a way to just make ":" act like "" in my custom add-on. Is it possible?
source share