[英]Can the bash "autocomplete" (via TAB TAB) entries be colored/formated?
Background:背景:
The "autocomplete" feature I am talking about is when you half-type a command or filename in bash, if you press TAB twice it will print out suggestions.我所说的“自动完成”功能是当你在 bash 中输入一半命令或文件名时,如果你按两次 TAB 它将打印出建议。
Question:题:
The entries output looks allot like the default ls
behavior.条目输出看起来像默认的
ls
行为。
How could I override this to give it different colors or format (like ls
)?我如何覆盖它以赋予它不同的颜色或格式(如
ls
)?
EDIT: Copy paste of Answer on UnixStackExchange - vote for it there!编辑:复制粘贴UnixStackExchange 上的答案- 在那里投票!
In bash 4.3 and later you can add在 bash 4.3 及更高版本中,您可以添加
set colored-stats on
to ~/.inputrc
.到
~/.inputrc
。
See http://cnswww.cns.cwru.edu/php/chet/readline/rluserman.html :见http://cnswww.cns.cwru.edu/php/chet/readline/rluserman.html :
colored-stats
If set to `
on
', Readline displays possible completions using different colors to indicate their file type.如果设置为 `
on
',Readline 会使用不同的颜色显示可能的补全以指示其文件类型。 The color definitions are taken from the value of theLS_COLORS
environment variable.颜色定义取自
LS_COLORS
环境变量的值。 The default is `off
'.默认值为“
off
”。
You can use http://geoff.greer.fm/lscolors/ to generate both LS_COLORS
(which is used by GNU ls
and colored-stats
) and LSCOLORS
(which is used by BSD ls
).可以使用http://geoff.greer.fm/lscolors/同时生成
LS_COLORS
(其用于通过GNU ls
和colored-stats
)和LSCOLORS
其由BSD使用ls
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.