How to get a colored tab completion?

Is there a way to get colored output when using tab completion in a terminal? My colors are fine everywhere else so I know that I've enabled a color terminal successfully.

Using bash in Ubuntu (10.10).


There's no facility within Bash to color output during completion as there is in fish and zsh. One could write completion functions that output color control sequences, but you'd have to maintain copies of the proposed completions with and without color codes or strip the out when the user makes a selection since Bash uses the selection directly normally and the color codes would get in the way.

If this is an important feature for you, I would recommend that you consider using zsh.

Update

Bash 4.3 readline adds a variable that enables color for tab completion to show different colors for executable files, directories, etc., during tab completion:

colored-stats

Readline in the upcoming Bash 4.4 adds a variable which enables color to indicate the matching portion of the string during tab completion.

colored-completion-prefix

You can see the values of these variables using

bind -v | grep color

To set them, add lines(s) to your ~/.inputrc file such as:

set colored-stats on

I do not know about completion colors for command options and arguments but for filename and directories, according to (https://unix.stackexchange.com/a/133866) user495470 states that in Bash 4.3 and later you can add set colored-stats on to ~/.inputrc to get colored completion when you do ls <tab>.