gpt4 book ai didi

bash - bash "autocomplete"(通过TAB TAB)条目可以着色/格式化吗?

转载 作者:行者123 更新时间:2023-12-04 14:13:55 28 4
gpt4 key购买 nike

背景:

我所说的“自动完成”功能是当你在 bash 中输入一半的命令或文件名时,如果你按两次 TAB 它将打印出建议。

问题:

条目输出看起来像默认的 ls行为。

我如何覆盖它以赋予它不同的颜色或格式(如 ls )?

编辑:复制粘贴 Answer on UnixStackExchange - 在那里投票!

在 bash 4.3 及更高版本中,您可以添加

set colored-stats on

~/.inputrc .

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. The color definitions are taken from the value of the LS_COLORS environment variable. The default is `off'.



您可以使用 http://geoff.greer.fm/lscolors/生成 LS_COLORS (由 GNU lscolored-stats 使用)和 LSCOLORS‏ (由 BSD ls 使用)。

最佳答案

追加 上设置彩色统计信息到您的 input-rc 文件。

[[ -f $INPUTRC ]] && echo set colored-stats on >> $INPUTRC
或者,如果您在默认位置拥有它:
echo set colored-stats on >> ~/.inputrc
然后重新启动bash。
就是这样。
colored completions

关于bash - bash "autocomplete"(通过TAB TAB)条目可以着色/格式化吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34808651/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com