参考链接:
https://blog.csdn.net/weixin_36429334/article/details/73935272
https://segmentfault.com/q/1010000011533134
步骤:
1、打开oh-my-zsh主题目录
//打开item2主题目录
cd .oh-my-zsh/themes
//假如你用的主题是agnoster
vi agnostic.zsh-theme
2、修改代码
# Context: user@hostname (who am I and where am I)
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
# 修改如下代码,@Mac可以你自己定义
# prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@Mac"
fi
}
如果注释掉prompt这一行,那么iterm2不显示主机名;
如果想修改成“xiaolaohu”
那么就替换成:prompt_segment black default "%(!.%{%F{yellow}%}.)xiaolaohu"
网友评论