Mac 下 Iterm2 配置的一些问题

agnoster 主题乱码

原因:是缺少 Menlo for Powerline 字体

下载字体:Menlo for Powerline

安装字体:mv "Menlo for Powerline.ttf" ~/Library/Fonts

配置:Text->Font

ls 文件夹颜色

配置:Colors->Brighten bold text 勾选掉之后

rz/sz 配置

参考文档

zsh-autosuggestion 颜色与底色相同

更改 zsh-autosuggestion 颜色,在.zshrc 最后加入 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=5'

参考文档

隐藏用户名和主机名

.zshrc 最后加入

1
prompt_context() {}

只显示用户名

.zshrc 最后加入

1
2
3
4
5
6
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
fi
}

只显示主机名

.zshrc 最后加入

1
2
3
4
5
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$HOST"
fi
}

自定义

.zshrc 最后加入

1
2
3
prompt_context () {
prompt_segment black default "JakeHu@MBP";
}

powerlevel10k

重新配置 p10k configure

参考

案例一

案例二