如何在bash中自动完成子命令时更改完成着色?

由于未知的原因,看来完成的结果被bash视为破碎的符号链接。而且看起来真的很烦人。
系统信息:
编辑:我理解,通过在colored-stats中设置~/.inputrc GNU选项,将完全关闭着色:
set colored-stats off但这也会在自动完成时禁用其他着色,例如目录着色。
我觉得这很奇怪,因为我家里的Manjaro Linux盒出现了类似于断符号的着色,而我的Arch Linux盒却没有出现在工作中。两者都是用相同的bashrc和inputrc应用的。但我暂时没有检查其他潜在的差别。
再次编辑:粘贴我的~/.inputrc以供参考:
$include /etc/inputrc
$if mode=emacs
# cycle through possible completions
TAB: menu-complete
# complete until the end of common prefix before cycling through possible completions
set menu-complete-display-prefix on
# show possible completions if more than one completions are possible
set show-all-if-ambiguous on
set show-all-if-unmodified on
# do not duplicate characters after the cursor if they consist partially of possbile completion
set skip-completed-text on
# display colors when doing completion as `ls` does
set colored-stats on
# color tab-completion matched prefix part
set colored-completion-prefix on
# fuck off stty key bindings. (stty -a)
set bind-tty-special-chars off
"\C-w": unix-word-rubout
"\eh": kill-region
"\eH": copy-region-as-kill
"\C-x\'": "\'\'\C-b"
"\C-x`": "``\C-b"
"\C-x\"": "\"\"\C-b"
"\C-x{": "{}\C-b"
"\C-x[": "[]\C-b"
"\C-x(": "()\C-b"
"\C-x0": vi-eWord
"\eF": "\C-x0\C-f"
"\eB": vi-bWord
"\eD": "\e \eF\eh"
$endif 发布于 2021-04-24 10:47:55
GNU的完成着色是用colored-stats在.inputrc中启用的,正如您已经提到的。
颜色由$LS_COLORS确定,dircolors可以生成该颜色。
完成建议似乎继承了~/.dircolors中的D5属性的颜色。注释掉它(或者更改为一些不那么烦人的东西,例如删除05;以禁用闪烁)打印默认颜色的建议。$LS_COLORS中相应的条目是...:mi=03;31:... ( ANSI颜色、03和31的示例)。
类似的讨论:https://bugzilla.redhat.com/show_bug.cgi?id=1648170
参考资料:https://wiki.archlinux.org/index.php/Readline#Colorized_完成 https://wiki.archlinux.org/index.php/Color_输出_在……里面_console#ls 脏颜色:全局修改颜色设置 https://askubuntu.com/questions/466198/how-do-i-change-the-color-for-directories-with-ls-in-the-console
https://unix.stackexchange.com/questions/481493
复制相似问题