Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Colored command completion

2 views
Skip to first unread message

Peng Yu

unread,
Jan 26, 2010, 10:36:22 AM1/26/10
to bug-bash
I'm wondering if it is possible to color the files shown by command
completion (i.e. after typing <TAB>). The color scheme can be of the
same as the one used in "ls --color=auto". By this way, it is easier
to see what the type of the file is.


Chet Ramey

unread,
Jan 26, 2010, 11:34:19 AM1/26/10
to Peng Yu, bug-bash, chet....@case.edu

You mean the list of possible completions? It's not exactly what you
asked for, but look at the readline `visible-stats' variable. That
produces output in the style of `ls -F'.

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


Stephane CHAZELAS

unread,
Jan 26, 2010, 4:39:45 PM1/26/10
to
2010-01-26, 09:36(-06), Peng Yu:
[...]

A bit off topic here, but note that zsh supports that and can
use GNU ls's configuration as well ($LS_COLORS). zsh is largely
compatible with bash. You can use "compinstall" to configure
the completion, or you could try those settings (they have been
generated by compinstall for me):

(set -C && dircolors -p > ~/.dircolors) 2> /dev/null
eval "$(dircolors -b ~/.dircolors)"
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate _prefix
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' max-errors 1 not-numeric
zstyle ':completion:*' menu select=2
zstyle ':completion:*' original true
zstyle ':completion:*' prompt 'correct> '
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
autoload -U compinit
compinit -i

(you need a relatively recent version of zsh (at least
3.1.5-pws-24, circa 1999) (some OSes like Solaris come with a
very old version of zsh (or at least used to))).

--
Stï¿œphane

0 new messages