我正在使用
oh-my-zsh
、powerlevel10k
、colorls
和 fig
来自定义我的 Mac 终端。现在我只有一个问题,我想要 current directory
名称以 粗体显示。
最初默认情况下,对于完整的提示目录长度,最后一个目录以粗体显示,但在我更改为缩短目录后,最后一个目录名称或当前文件夹名称变为regular字体。 我想要粗体字。如何解决?
还有一个问题是我想更改放置在每个提示开头的🅟🅑🅙
的颜色。如何实现?
根据您所做的更改,您可能需要运行
p10k configure
并生成新的 ~/.p10k.zsh
文件。
在该文件中,您要更改的设置是
POWERLEVEL9K_DIR_MAX_LENGTH=0
:
# Shorten directory if it's longer than this even if there is space for it. The value can
# be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty,
# directory will be shortened only when prompt doesn't fit or when other parameters demand it
# (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below).
# If set to `0`, directory will always be shortened to its minimum length.
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=0
将
POWERLEVEL9K_SHORTEN_STRATEGY
从 truncate_to_unique
更改为 truncate_from_right
可能很诱人,但 truncate_from_right
将立即删除所有突出显示的目录。
如果您最终得到的路径包含多个扩展单词,例如
~/.c/z/zsh_custom/p/python
,您将需要查看 local anchor_files=(...)
列表并注释掉导致目录被视为锚点并因此扩展的任何内容。
至于🅟🅑🅙的颜色,我不确定你的问题是什么,但你可能会在他的 GitHub Issues 项目页面而不是 StackOverflow 上询问开发人员。